Skip to content

Commit 624e6f1

Browse files
committed
Apply typescript-eslint's recommended config to gts files
"Patch" `typescript-eslint`'s recommended config to allow us to extend it to `gts` files, and also add test cases to verify that we're applying the ruleset to both `ts` and `gts` files. Fixes #119
1 parent 17e0a56 commit 624e6f1

File tree

4 files changed

+49
-1
lines changed

4 files changed

+49
-1
lines changed

files/eslint.config.mjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,15 @@ export default defineConfig([
7171
...globals.browser,
7272
},
7373
},
74-
extends: [...ts.configs.recommendedTypeChecked, ember.configs.gts],
74+
extends: [
75+
...ts.configs.recommendedTypeChecked,
76+
// https://github.com/ember-cli/ember-addon-blueprint/issues/119
77+
{
78+
...ts.configs.eslintRecommended,
79+
files: undefined,
80+
},
81+
ember.configs.gts,
82+
],
7583
},<% } %>
7684
{
7785
files: ['src/**/*'],
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* This file is used to ensure that `eslint.config.mjs` is properly configured
3+
* to apply `typescript-eslint`'s recommended rules to `.gts` files. It ensures
4+
* that:
5+
*
6+
* - `no-undef` is disabled (otherwise the undefined symbol would cause a
7+
* linting error)
8+
* - `@typescript-eslint/no-unsafe-return` is enabled (otherwise the
9+
* `eslint-disable-next-line` comment would cause a linting error)
10+
*/
11+
export default function () {
12+
// @ts-expect-error testing lint
13+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
14+
return notDefined;
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* This file is used to ensure that `eslint.config.mjs` is properly configured
3+
* to apply `typescript-eslint`'s recommended rules to `.ts` files. It ensures
4+
* that:
5+
*
6+
* - `no-undef` is disabled (otherwise the undefined symbol would cause a
7+
* linting error)
8+
* - `@typescript-eslint/no-unsafe-return` is enabled (otherwise the
9+
* `eslint-disable-next-line` comment would cause a linting error)
10+
*/
11+
export default function () {
12+
// @ts-expect-error testing lint
13+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
14+
return notDefined;
15+
}

tests/smoke-tests/--typescript.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) {
9797
).toMatchInlineSnapshot(`
9898
[
9999
"src/index.ts",
100+
"src/lint-test-gts.gts",
101+
"src/lint-test-ts.ts",
100102
"src/template-registry.ts",
101103
"src/components/another-gts.gts",
102104
"src/components/template-import.gts",
@@ -111,6 +113,10 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) {
111113
[
112114
"dist/index.js",
113115
"dist/index.js.map",
116+
"dist/lint-test-gts.js",
117+
"dist/lint-test-gts.js.map",
118+
"dist/lint-test-ts.js",
119+
"dist/lint-test-ts.js.map",
114120
"dist/template-registry.js",
115121
"dist/template-registry.js.map",
116122
"dist/components/another-gts.js",
@@ -124,6 +130,10 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) {
124130
"dist/_app_/services/example.js",
125131
"declarations/index.d.ts",
126132
"declarations/index.d.ts.map",
133+
"declarations/lint-test-gts.d.ts",
134+
"declarations/lint-test-gts.d.ts.map",
135+
"declarations/lint-test-ts.d.ts",
136+
"declarations/lint-test-ts.d.ts.map",
127137
"declarations/template-registry.d.ts",
128138
"declarations/template-registry.d.ts.map",
129139
"declarations/components/another-gts.d.ts",

0 commit comments

Comments
 (0)