1- module . exports = {
1+ const { resolve } = require ( "path" ) ;
2+
3+ const baseConfig = {
24 parser : "@typescript-eslint/parser" ,
35 parserOptions : {
46 ecmaVersion : 2018 ,
57 sourceType : "module" ,
6- project : [ "tsconfig.json" , "./src/**/tsconfig.json" , "./test/**/tsconfig.json" , "./gulpfile.ts/tsconfig.json" , "./scripts/tsconfig.json" , "./.storybook/tsconfig.json" ] ,
8+ project : [
9+ resolve ( __dirname , "tsconfig.lint.json" ) ,
10+ resolve ( __dirname , "src/**/tsconfig.json" ) ,
11+ resolve ( __dirname , "test/**/tsconfig.json" ) ,
12+ resolve ( __dirname , "gulpfile.ts/tsconfig.json" ) ,
13+ resolve ( __dirname , "scripts/tsconfig.json" ) ,
14+ resolve ( __dirname , ".storybook/tsconfig.json" ) ,
15+ ] ,
716 } ,
8- plugins : [
9- "github" ,
10- "@typescript-eslint" ,
11- "etc"
12- ] ,
17+ plugins : [ "github" , "@typescript-eslint" , "etc" ] ,
1318 env : {
1419 node : true ,
1520 es6 : true ,
@@ -21,7 +26,7 @@ module.exports = {
2126 "plugin:github/typescript" ,
2227 "plugin:jest-dom/recommended" ,
2328 "plugin:prettier/recommended" ,
24- "plugin:@typescript-eslint/recommended"
29+ "plugin:@typescript-eslint/recommended" ,
2530 ] ,
2631 rules : {
2732 "@typescript-eslint/no-use-before-define" : 0 ,
@@ -37,14 +42,14 @@ module.exports = {
3742 "@typescript-eslint/explicit-module-boundary-types" : "off" ,
3843 "@typescript-eslint/no-non-null-assertion" : "off" ,
3944 "@typescript-eslint/no-explicit-any" : "off" ,
40- "@typescript-eslint/no-floating-promises" : [ "error" , { ignoreVoid : true } ] ,
45+ "@typescript-eslint/no-floating-promises" : [ "error" , { ignoreVoid : true } ] ,
4146 "@typescript-eslint/no-invalid-this" : "off" ,
4247 "@typescript-eslint/no-shadow" : "off" ,
4348 "prefer-const" : [ "warn" , { destructuring : "all" } ] ,
4449 "@typescript-eslint/no-throw-literal" : "error" ,
4550 "no-useless-escape" : 0 ,
46- " camelcase" : "off" ,
47- " eqeqeq" : "off" ,
51+ camelcase : "off" ,
52+ eqeqeq : "off" ,
4853 "escompat/no-regexp-lookbehind" : "off" ,
4954 "etc/no-implicit-any-catch" : "error" ,
5055 "filenames/match-regex" : "off" ,
@@ -72,3 +77,158 @@ module.exports = {
7277 "github/no-then" : "off" ,
7378 } ,
7479} ;
80+
81+ module . exports = {
82+ root : true ,
83+ ...baseConfig ,
84+ overrides : [
85+ {
86+ files : [ "src/stories/**/*" ] ,
87+ parserOptions : {
88+ project : resolve ( __dirname , "src/stories/tsconfig.json" ) ,
89+ } ,
90+ extends : [
91+ ...baseConfig . extends ,
92+ "plugin:react/recommended" ,
93+ "plugin:react-hooks/recommended" ,
94+ "plugin:storybook/recommended" ,
95+ ] ,
96+ rules : {
97+ ...baseConfig . rules ,
98+ "filenames/match-regex" : "off" ,
99+ "import/named" : "off" ,
100+ "import/no-namespace" : "off" ,
101+ "import/no-unresolved" : "off" ,
102+ "no-unused-vars" : "off" ,
103+ } ,
104+ settings : {
105+ react : {
106+ version : "detect" ,
107+ } ,
108+ } ,
109+ } ,
110+ {
111+ files : [ "src/view/**/*" ] ,
112+ parserOptions : {
113+ project : resolve ( __dirname , "src/view/tsconfig.json" ) ,
114+ } ,
115+ extends : [
116+ ...baseConfig . extends ,
117+ "plugin:react/recommended" ,
118+ "plugin:react-hooks/recommended" ,
119+ ] ,
120+ rules : {
121+ ...baseConfig . rules ,
122+ "@typescript-eslint/no-explicit-any" : "off" ,
123+ "@typescript-eslint/no-invalid-this" : "off" ,
124+ "@typescript-eslint/no-shadow" : "off" ,
125+ camelcase : "off" ,
126+ eqeqeq : "off" ,
127+ "filenames/match-regex" : "off" ,
128+ "i18n-text/no-en" : "off" ,
129+ "import/named" : "off" ,
130+ "import/no-dynamic-require" : "off" ,
131+ "import/no-dynamic-required" : "off" ,
132+ "import/no-namespace" : "off" ,
133+ "import/no-unresolved" : "off" ,
134+ "jsx-a11y/anchor-is-valid" : "off" ,
135+ "jsx-a11y/no-noninteractive-element-interactions" : "off" ,
136+ "jsx-a11y/no-static-element-interactions" : "off" ,
137+ "jsx-a11y/click-events-have-key-events" : "off" ,
138+ "no-console" : "off" ,
139+ "no-invalid-this" : "off" ,
140+ "no-undef" : "off" ,
141+ "no-unused-vars" : "off" ,
142+ "no-shadow" : "off" ,
143+ "github/array-foreach" : "off" ,
144+ } ,
145+ settings : {
146+ react : {
147+ version : "detect" ,
148+ } ,
149+ } ,
150+ } ,
151+ {
152+ files : [ "test/**/*" ] ,
153+ parserOptions : {
154+ project : resolve ( __dirname , "test/tsconfig.json" ) ,
155+ } ,
156+ env : {
157+ jest : true ,
158+ } ,
159+ rules : {
160+ ...baseConfig . rules ,
161+ "@typescript-eslint/no-explicit-any" : "off" ,
162+ "@typescript-eslint/no-shadow" : "off" ,
163+ camelcase : "off" ,
164+ "filenames/match-regex" : "off" ,
165+ "i18n-text/no-en" : "off" ,
166+ "import/no-namespace" : "off" ,
167+ "import/no-unresolved" : "off" ,
168+ "no-console" : "off" ,
169+ "no-shadow" : "off" ,
170+ "no-undef" : "off" ,
171+ "github/array-foreach" : "off" ,
172+ } ,
173+ } ,
174+ {
175+ files : [ "test/vscode-tests/**/*" ] ,
176+ parserOptions : {
177+ project : resolve ( __dirname , "test/tsconfig.json" ) ,
178+ } ,
179+ env : {
180+ jest : true ,
181+ } ,
182+ rules : {
183+ ...baseConfig . rules ,
184+ "@typescript-eslint/ban-types" : [
185+ "error" ,
186+ {
187+ // For a full list of the default banned types, see:
188+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md
189+ extendDefaults : true ,
190+ types : {
191+ // Don't complain about the `Function` type in test files. (Default is `true`.)
192+ Function : false ,
193+ } ,
194+ } ,
195+ ] ,
196+ "@typescript-eslint/no-explicit-any" : "off" ,
197+ "@typescript-eslint/no-shadow" : "off" ,
198+ "@typescript-eslint/no-invalid-this" : "off" ,
199+ eqeqeq : "off" ,
200+ "filenames/match-regex" : "off" ,
201+ "filenames/match-regexp" : "off" ,
202+ "i18n-text/no-en" : "off" ,
203+ "import/no-anonymous-default-export" : "off" ,
204+ "import/no-dynamic-require" : "off" ,
205+ "import/no-mutable-exports" : "off" ,
206+ "import/no-namespace" : "off" ,
207+ "import/no-unresolved" : "off" ,
208+ "no-console" : "off" ,
209+ "github/array-foreach" : "off" ,
210+ "github/no-then" : "off" ,
211+ } ,
212+ } ,
213+ {
214+ files : [
215+ ".eslintrc.js" ,
216+ "test/**/jest-runner-vscode.config.js" ,
217+ "test/**/jest-runner-vscode.config.base.js" ,
218+ ] ,
219+ parser : undefined ,
220+ plugins : [ "github" ] ,
221+ extends : [
222+ "eslint:recommended" ,
223+ "plugin:github/recommended" ,
224+ "plugin:prettier/recommended" ,
225+ ] ,
226+ rules : {
227+ "import/no-commonjs" : "off" ,
228+ "prefer-template" : "off" ,
229+ "filenames/match-regex" : "off" ,
230+ "@typescript-eslint/no-var-requires" : "off" ,
231+ } ,
232+ } ,
233+ ] ,
234+ } ;
0 commit comments