Skip to content

Commit bef2d36

Browse files
fix: switch tseslint's tsconfigRootDir to implicit (#2245)
## PR Checklist - [x] Addresses an existing open issue: fixes #2242 - [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 Remove the explicit setting of [`tsconfigRootDir`](https://typescript-eslint.io/packages/parser/#tsconfigrootdir). Since the corresponding PR in typescript-eslint is now in review, I think it's "soon enough" to make this change in userland. Setting it explicitly is a safety precaution for edge cases. 🎁
1 parent ae26c93 commit bef2d36

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

eslint.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export default tseslint.config(
4848
projectService: {
4949
allowDefaultProject: ["*.config.*s", "bin/index.js"],
5050
},
51-
tsconfigRootDir: import.meta.dirname,
5251
},
5352
},
5453
rules: {

src/blocks/blockESLint.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ describe("blockESLint", () => {
120120
{ ignores: ["lib", "node_modules", "pnpm-lock.yaml"] },
121121
{ linterOptions: {"reportUnusedDisableDirectives":"error"} },
122122
eslint.configs.recommended,
123-
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]},"tsconfigRootDir":import.meta.dirname}}, }
123+
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]}}}, }
124124
);",
125125
},
126126
"scripts": [
@@ -274,7 +274,7 @@ describe("blockESLint", () => {
274274
{ ignores: ["lib", "node_modules", "pnpm-lock.yaml"] },
275275
{ linterOptions: {"reportUnusedDisableDirectives":"error"} },
276276
eslint.configs.recommended,
277-
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]},"tsconfigRootDir":import.meta.dirname}}, }
277+
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]}}}, }
278278
);",
279279
},
280280
"scripts": [
@@ -431,7 +431,7 @@ describe("blockESLint", () => {
431431
{ ignores: ["lib", "node_modules", "pnpm-lock.yaml"] },
432432
{ linterOptions: {"reportUnusedDisableDirectives":"error"} },
433433
eslint.configs.recommended,
434-
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,mjs,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]},"tsconfigRootDir":import.meta.dirname}}, },{ files: ["*.mjs"], languageOptions: {"sourceType":"module"}, }
434+
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,mjs,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]}}}, },{ files: ["*.mjs"], languageOptions: {"sourceType":"module"}, }
435435
);",
436436
},
437437
"scripts": [
@@ -610,7 +610,7 @@ describe("blockESLint", () => {
610610
{ ignores: ["generated", "lib", "node_modules", "pnpm-lock.yaml"] },
611611
{ linterOptions: {"reportUnusedDisableDirectives":"error"} },
612612
eslint.configs.recommended,
613-
a.configs.recommended,{ extends: [b.configs.recommended], files: ["**/*.b"], rules: {"b/c":"error","b/d":["error",{"e":"f"}]}, },{ extends: [c.configs.recommended], rules: {"c/d":"error","c/e":["error",{"f":"g"}]}, },{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]},"tsconfigRootDir":import.meta.dirname}}, rules: {"a/b": "error","a/c": ["error",{"d":"e"}],}, settings: {"react":{"version":"detect"}}, }
613+
a.configs.recommended,{ extends: [b.configs.recommended], files: ["**/*.b"], rules: {"b/c":"error","b/d":["error",{"e":"f"}]}, },{ extends: [c.configs.recommended], rules: {"c/d":"error","c/e":["error",{"f":"g"}]}, },{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]}}}, rules: {"a/b": "error","a/c": ["error",{"d":"e"}],}, settings: {"react":{"version":"detect"}}, }
614614
);",
615615
},
616616
"scripts": [
@@ -746,7 +746,7 @@ describe("blockESLint", () => {
746746
{ ignores: ["lib", "node_modules", "pnpm-lock.yaml"] },
747747
{ linterOptions: {"reportUnusedDisableDirectives":"error"} },
748748
eslint.configs.recommended,
749-
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]},"tsconfigRootDir":import.meta.dirname}}, rules: {
749+
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]}}}, rules: {
750750
751751
// Duplicated comment
752752
"a": "error","c": "error",
@@ -888,7 +888,7 @@ describe("blockESLint", () => {
888888
{ ignores: ["lib", "node_modules", "pnpm-lock.yaml"] },
889889
{ linterOptions: {"reportUnusedDisableDirectives":"error"} },
890890
eslint.configs.recommended,
891-
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]},"tsconfigRootDir":import.meta.dirname}}, rules: {
891+
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]}}}, rules: {
892892
893893
// One line
894894
"a": "error",
@@ -1026,7 +1026,7 @@ describe("blockESLint", () => {
10261026
{ ignores: ["lib", "node_modules", "pnpm-lock.yaml"] },
10271027
{ linterOptions: {"reportUnusedDisableDirectives":"error"} },
10281028
eslint.configs.recommended,
1029-
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s","bin/index.js"]},"tsconfigRootDir":import.meta.dirname}}, }
1029+
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s","bin/index.js"]}}}, }
10301030
);",
10311031
},
10321032
"scripts": [
@@ -1152,7 +1152,7 @@ describe("blockESLint", () => {
11521152
{ ignores: ["lib", "node_modules", "pnpm-lock.yaml"] },
11531153
{ linterOptions: {"reportUnusedDisableDirectives":"error"} },
11541154
eslint.configs.recommended,
1155-
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s","bin/index.js"]},"tsconfigRootDir":import.meta.dirname}}, }
1155+
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s","bin/index.js"]}}}, }
11561156
);",
11571157
},
11581158
"scripts": [
@@ -1275,7 +1275,7 @@ describe("blockESLint", () => {
12751275
{ ignores: ["lib", "node_modules", "pnpm-lock.yaml"] },
12761276
{ linterOptions: {"reportUnusedDisableDirectives":"error"} },
12771277
eslint.configs.recommended,
1278-
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,mjs,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]},"tsconfigRootDir":import.meta.dirname}}, },{ files: ["*.mjs"], languageOptions: {"sourceType":"module"}, }
1278+
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,mjs,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]}}}, },{ files: ["*.mjs"], languageOptions: {"sourceType":"module"}, }
12791279
);",
12801280
},
12811281
"scripts": [
@@ -1398,7 +1398,7 @@ describe("blockESLint", () => {
13981398
{ ignores: ["lib", "node_modules", "pnpm-lock.yaml"] },
13991399
{ linterOptions: {"reportUnusedDisableDirectives":"error"} },
14001400
eslint.configs.recommended,
1401-
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]},"tsconfigRootDir":import.meta.dirname}}, }
1401+
{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]}}}, }
14021402
);",
14031403
},
14041404
"scripts": [

src/blocks/blockESLint.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ export const blockESLint = base.createBlock({
102102
),
103103
),
104104
},
105-
tsconfigRootDir: "import.meta.dirname",
106105
},
107106
},
108107
...(rules && { rules }),

0 commit comments

Comments
 (0)