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,102 @@ 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+ } ,
99+ settings : {
100+ react : {
101+ version : "detect" ,
102+ } ,
103+ } ,
104+ } ,
105+ {
106+ files : [ "src/view/**/*" ] ,
107+ parserOptions : {
108+ project : resolve ( __dirname , "src/view/tsconfig.json" ) ,
109+ } ,
110+ extends : [
111+ ...baseConfig . extends ,
112+ "plugin:react/recommended" ,
113+ "plugin:react-hooks/recommended" ,
114+ ] ,
115+ rules : {
116+ ...baseConfig . rules ,
117+ } ,
118+ settings : {
119+ react : {
120+ version : "detect" ,
121+ } ,
122+ } ,
123+ } ,
124+ {
125+ files : [ "test/**/*" ] ,
126+ parserOptions : {
127+ project : resolve ( __dirname , "test/tsconfig.json" ) ,
128+ } ,
129+ env : {
130+ jest : true ,
131+ } ,
132+ } ,
133+ {
134+ files : [ "test/vscode-tests/**/*" ] ,
135+ parserOptions : {
136+ project : resolve ( __dirname , "test/tsconfig.json" ) ,
137+ } ,
138+ env : {
139+ jest : true ,
140+ } ,
141+ rules : {
142+ ...baseConfig . rules ,
143+ "@typescript-eslint/ban-types" : [
144+ "error" ,
145+ {
146+ // For a full list of the default banned types, see:
147+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md
148+ extendDefaults : true ,
149+ types : {
150+ // Don't complain about the `Function` type in test files. (Default is `true`.)
151+ Function : false ,
152+ } ,
153+ } ,
154+ ] ,
155+ } ,
156+ } ,
157+ {
158+ files : [
159+ ".eslintrc.js" ,
160+ "test/**/jest-runner-vscode.config.js" ,
161+ "test/**/jest-runner-vscode.config.base.js" ,
162+ ] ,
163+ parser : undefined ,
164+ plugins : [ "github" ] ,
165+ extends : [
166+ "eslint:recommended" ,
167+ "plugin:github/recommended" ,
168+ "plugin:prettier/recommended" ,
169+ ] ,
170+ rules : {
171+ "import/no-commonjs" : "off" ,
172+ "prefer-template" : "off" ,
173+ "filenames/match-regex" : "off" ,
174+ "@typescript-eslint/no-var-requires" : "off" ,
175+ } ,
176+ } ,
177+ ] ,
178+ } ;
0 commit comments