1
- /**
2
- * Debugging:
3
- * https://eslint.org/docs/latest/use/configure/debug
4
- * ----------------------------------------------------
5
- *
6
- * Print a file's calculated configuration
7
- *
8
- * npx eslint --print-config path/to/file.js
9
- *
10
- * Inspecting the config
11
- *
12
- * npx eslint --inspect-config
13
- *
14
- */
15
-
16
- import globals from 'globals' ;
17
- import js from '@eslint/js' ;
18
-
19
1
import ts from 'typescript-eslint' ;
20
-
21
2
import ember from 'eslint-plugin-ember/recommended' ;
22
3
23
- import qunit from 'eslint-plugin-qunit' ;
24
- import n from 'eslint-plugin-n' ;
25
-
26
- import babelParser from '@babel/eslint-parser' ;
27
-
28
4
const parserOptions = {
29
5
esm : {
30
- js : {
31
- ecmaFeatures : { modules : true } ,
32
- ecmaVersion : 'latest' ,
33
- requireConfigFile : false ,
34
- babelOptions : {
35
- plugins : [
36
- [
37
- '@babel/plugin-proposal-decorators' ,
38
- { decoratorsBeforeExport : true } ,
39
- ] ,
40
- ] ,
41
- } ,
42
- } ,
43
6
ts : {
44
7
projectService : true ,
45
8
tsconfigRootDir : import . meta. dirname ,
@@ -48,117 +11,28 @@ const parserOptions = {
48
11
} ;
49
12
50
13
export default ts . config (
51
- js . configs . recommended ,
52
- ember . configs . base ,
53
- ember . configs . gjs ,
54
- ember . configs . gts ,
55
- /**
56
- * Ignores must be in their own object
57
- * https://eslint.org/docs/latest/use/configure/ignore
58
- */
59
- {
60
- ignores : [
61
- 'declarations/' ,
62
- 'dist/' ,
63
- '.node_modules.ember-try/' ,
64
- 'coverage/' ,
65
- 'storybook-static/' ,
66
- ] ,
67
- } ,
68
- /**
69
- * https://eslint.org/docs/latest/use/configure/configuration-files#configuring-linter-options
70
- */
71
14
{
72
- linterOptions : {
73
- reportUnusedDisableDirectives : 'error' ,
74
- } ,
75
- } ,
76
- {
77
- files : [ '**/*.js' ] ,
78
- languageOptions : {
79
- parser : babelParser ,
80
- } ,
81
- } ,
82
- {
83
- files : [ '**/*.{js,gjs}' ] ,
84
- languageOptions : {
85
- parserOptions : parserOptions . esm . js ,
86
- globals : {
87
- ...globals . browser ,
88
- } ,
89
- } ,
15
+ ignores : [ '**/*.js' , '**/*.mjs' ] ,
90
16
} ,
91
17
{
18
+ name : 'ts' ,
92
19
files : [ '**/*.ts' ] ,
93
20
languageOptions : {
21
+ // Uncommenting this fixes the issue so it seems to be related to switching parsers for different kinds of typed files?
22
+ // parser: ember.parser,
94
23
parserOptions : parserOptions . esm . ts ,
95
24
} ,
96
- extends : [ ember . configs . base , ...ts . configs . recommendedTypeChecked ] ,
25
+ extends : [ ...ts . configs . recommendedTypeChecked ] ,
26
+ // extends: [...ts.configs.recommended], // also fails
97
27
} ,
98
28
{
29
+ name : 'gts' ,
99
30
files : [ '**/*.gts' ] ,
100
31
languageOptions : {
101
32
parser : ember . parser ,
102
33
parserOptions : parserOptions . esm . ts ,
103
34
} ,
104
- extends : [ ...ts . configs . recommendedTypeChecked , ember . configs . gts ] ,
105
- rules : {
106
- // This works around an issue in Glint https://github.com/typed-ember/glint/issues/697
107
- // It also makes adding state to a component easier, since no other code changes would be needed.
108
- 'ember/no-empty-glimmer-component-classes' : 'off' ,
109
- } ,
110
- } ,
111
- {
112
- files : [ 'tests/**/*-test.{js,gjs,ts,gts}' ] ,
113
- plugins : {
114
- qunit,
115
- } ,
116
- } ,
117
- /**
118
- * CJS node files
119
- */
120
- {
121
- files : [
122
- 'index.js' ,
123
- '**/*.cjs' ,
124
- 'config/**/*.js' ,
125
- 'testem.js' ,
126
- 'testem*.js' ,
127
- '.prettierrc.js' ,
128
- '.stylelintrc.js' ,
129
- '.template-lintrc.js' ,
130
- 'ember-cli-build.js' ,
131
- 'tests/dummy/config/**/*.js' ,
132
- '.storybook/main.js' ,
133
- ] ,
134
- plugins : {
135
- n,
136
- } ,
137
-
138
- languageOptions : {
139
- sourceType : 'script' ,
140
- ecmaVersion : 'latest' ,
141
- globals : {
142
- ...globals . node ,
143
- } ,
144
- } ,
145
- } ,
146
- /**
147
- * ESM node files
148
- */
149
- {
150
- files : [ '**/*.mjs' ] ,
151
- plugins : {
152
- n,
153
- } ,
154
-
155
- languageOptions : {
156
- sourceType : 'module' ,
157
- ecmaVersion : 'latest' ,
158
- parserOptions : parserOptions . esm . js ,
159
- globals : {
160
- ...globals . node ,
161
- } ,
162
- } ,
35
+ // These don't really matter, commented or not, it fails
36
+ // extends: [...ts.configs.recommendedTypeChecked, ember.configs.gts],
163
37
} ,
164
38
) ;
0 commit comments