Skip to content

Commit d2f6a1f

Browse files
feat: typescript-eslint@8 (#1595)
## PR Checklist - [x] Addresses an existing open issue: fixes #1594 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Also removes an unnecessary `"outDir": "lib"` from the `tsconfig.json`. It's a holdover from when `tsc` was used to compile to the `lib/` directory. 💖
1 parent dfee927 commit d2f6a1f

11 files changed

+133
-61
lines changed

eslint.config.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ export default tseslint.config(
5555
files: ["**/*.js", "**/*.ts"],
5656
languageOptions: {
5757
parserOptions: {
58-
EXPERIMENTAL_useProjectService: {
59-
allowDefaultProjectForFiles: ["./*.*s", "eslint.config.js"],
58+
projectService: {
59+
allowDefaultProject: ["*.config.*s", "bin/*.js", "script/*.ts"],
6060
defaultProject: "./tsconfig.json",
6161
},
62+
tsconfigRootDir: import.meta.dirname,
6263
},
6364
},
6465
rules: {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"tsup": "^8.1.0",
101101
"tsx": "^4.9.0",
102102
"typescript": "^5.5.2",
103-
"typescript-eslint": "^7.7.0",
103+
"typescript-eslint": "^8.0.0",
104104
"vitest": "^2.0.2"
105105
},
106106
"engines": {

pnpm-lock.yaml

+102-41
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

script/__snapshots__/migrate-test-e2e.ts.snap

+9
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ exports[`expected file changes > eslint.config.js 1`] = `
116116
import eslint from "@eslint/js";
117117
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
118118
import jsdoc from "eslint-plugin-jsdoc";
119+
@@ ... @@ export default tseslint.config(
120+
languageOptions: {
121+
parserOptions: {
122+
projectService: {
123+
- allowDefaultProject: ["*.config.*s", "bin/*.js", "script/*.ts"],
124+
+ allowDefaultProject: ["*.*s", "eslint.config.js"],
125+
defaultProject: "./tsconfig.json",
126+
},
127+
tsconfigRootDir: import.meta.dirname,
119128
@@ ... @@ export default tseslint.config(
120129
"no-constant-condition": "off",
121130

script/migrate-test-e2e.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ await fs.writeFile(
7474
.replace(
7575
/All Contributors: \d+/g,
7676
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
77-
originalReadme.match(/All Contributors: \d+/)![0],
77+
/All Contributors: \d+/.exec(originalReadme)![0],
7878
)
7979
.replace(
8080
/all_contributors-\d+/g,
8181
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
82-
originalReadme.match(/all_contributors-\d+/)![0],
82+
/all_contributors-\d+/.exec(originalReadme)![0],
8383
),
8484
);
8585

@@ -90,12 +90,12 @@ await fs.writeFile(
9090
.replace(
9191
/All Contributors: \d+/g,
9292
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
93-
originalReadme.match(/All Contributors: \d+/)![0],
93+
/All Contributors: \d+/.exec(originalReadme)![0],
9494
)
9595
.replace(
9696
/all_contributors-\d+/g,
9797
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
98-
originalReadme.match(/all_contributors-\d+/)![0],
98+
/all_contributors-\d+/.exec(originalReadme)![0],
9999
),
100100
);
101101

src/shared/options/createOptionDefaults/readDefaultsFromDevelopment.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export function readDefaultsFromDevelopment() {
88
);
99

1010
const guideTag = lazyValue(async () =>
11-
(await development()).match(
12-
/> .*guided walkthrough, see \[((?!\[).+)\]\((.+)\)/i,
11+
/> .*guided walkthrough, see \[((?!\[).+)\]\((.+)\)/i.exec(
12+
await development(),
1313
),
1414
);
1515

src/shared/options/createOptionDefaults/readDefaultsFromReadme.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function readDefaultsFromReadme() {
66
const readme = lazyValue(async () => await readFileSafe("README.md", ""));
77

88
const imageTag = lazyValue(
9-
async () => (await readme()).match(/<img.+src.+\/>/)?.[0],
9+
async () => /<img.+src.+\/>/.exec(await readme())?.[0],
1010
);
1111

1212
return {
@@ -15,8 +15,8 @@ export function readDefaultsFromReadme() {
1515
?.match(/src\s*=(.+)?\/>/)?.[1]
1616
?.replaceAll(/^['"]|['"]$/g, ""),
1717
title: async () =>
18-
(await readme())
19-
.match(/^(?:# |<h1\s+align="center">)(.*?)(?:<\/h1>)?$/i)?.[1]
18+
/^(?:# |<h1\s+align="center">)(.*?)(?:<\/h1>)?$/i
19+
.exec(await readme())?.[1]
2020
?.trim()
2121
.replace(/<[^>]+(?:>|$)/g, ""),
2222
};

0 commit comments

Comments
 (0)