11module . exports = {
2- parser : '@babel/eslint-parser' ,
32 env : {
43 browser : true ,
54 es6 : true ,
65 node : true ,
76 } ,
87 extends : [
98 'eslint:recommended' ,
9+ 'plugin:import/recommended' ,
1010 'plugin:react/recommended' ,
1111 'plugin:prettier/recommended' ,
1212 ] ,
13+ globals : {
14+ // enable webpack require
15+ require : 'readonly' ,
16+ // fix for eslint-plugin-flowtype/384 not supporting wildcard
17+ _ : 'readonly' ,
18+ } ,
19+ parser : '@babel/eslint-parser' ,
1320 parserOptions : {
1421 ecmaFeatures : {
1522 jsx : true ,
1623 } ,
1724 ecmaVersion : 2018 ,
1825 sourceType : 'module' ,
1926 } ,
20- settings : {
21- react : {
22- version : 'detect' ,
23- } ,
24- } ,
25- globals : {
26- // enable webpack require
27- require : 'readonly' ,
28- // fix for eslint-plugin-flowtype/384 not supporting wildcard
29- _ : 'readonly' ,
30- } ,
3127 plugins : [ 'react' , 'react-hooks' , 'import' ] ,
3228 rules : {
33- 'no-shadow' : [ 'error' ] ,
34- indent : [ 'off' ] ,
35- 'linebreak-style' : [ 'off' ] ,
36- quotes : [ 'off' ] ,
37- semi : [ 'off' ] ,
38- 'newline-before-return' : [ 'error' ] ,
39- 'prettier/prettier' : [ 'warn' ] ,
40- 'react/no-direct-mutation-state' : [ 'off' ] ,
41- 'react/display-name' : [ 'off' ] ,
42- 'react-hooks/rules-of-hooks' : [ 'error' ] ,
43- 'react-hooks/exhaustive-deps' : [ 'warn' ] ,
44- 'react/prop-types' : [ 'off' ] ,
29+ 'import/order' : [
30+ 'error' ,
31+ {
32+ alphabetize : {
33+ order : 'asc' ,
34+ } ,
35+ 'newlines-between' : 'always' ,
36+ } ,
37+ ] ,
38+ indent : 'off' ,
39+ 'linebreak-style' : 'off' ,
40+ 'newline-before-return' : 'error' ,
41+ 'no-shadow' : 'error' ,
42+ 'prettier/prettier' : 'warn' ,
43+ quotes : 'off' ,
44+ 'react/display-name' : 'off' ,
45+ 'react/no-direct-mutation-state' : 'off' ,
46+ 'react/prop-types' : 'off' ,
47+ 'react-hooks/exhaustive-deps' : 'warn' ,
48+ 'react-hooks/rules-of-hooks' : 'error' ,
49+ semi : 'off' ,
4550 } ,
4651 overrides : [
4752 {
4853 // Flow specific rules
49- files : [
50- 'src/index.js.flow' ,
51- 'src/server/index.js.flow' ,
52- '*/*flow.js' ,
53- 'examples/*-flow/*/*.js' ,
54- ] ,
5554 extends : [ 'plugin:flowtype/recommended' ] ,
55+ files : [ '*.flow' ] ,
5656 plugins : [ 'flowtype' ] ,
5757 rules : {
58- 'flowtype/generic-spacing' : [ 'off' ] ,
58+ 'flowtype/generic-spacing' : 'off' ,
5959 } ,
6060 } ,
6161 {
6262 // TypeScript specific rules
6363 files : [ '*.{ts,tsx}' ] ,
64- extends : [ 'plugin:@typescript-eslint/recommended' ] ,
64+ extends : [
65+ 'plugin:@typescript-eslint/recommended' ,
66+ 'plugin:import/typescript' ,
67+ ] ,
6568 rules : {
66- '@typescript-eslint/explicit-function-return-type' : 'off' ,
67- '@typescript-eslint/no-use-before-define' : 'off' ,
68- '@typescript-eslint/no-explicit-any' : 'off' ,
69- '@typescript-eslint/no-implicit-any' : 'off' ,
70- '@typescript-eslint/explicit-member-accessibility' : 'off' ,
71- '@typescript-eslint/no-unnecessary-type-constraint' : 'off' ,
72- '@typescript-eslint/no-non-null-assertion' : 'off' ,
73- '@typescript-eslint/no-empty-interface' : 'off' ,
7469 '@typescript-eslint/ban-ts-comment' : 'off' ,
7570 '@typescript-eslint/no-empty-function' : 'off' ,
71+ '@typescript-eslint/no-empty-interface' : 'off' ,
72+ '@typescript-eslint/no-explicit-any' : 'off' ,
73+ '@typescript-eslint/no-non-null-assertion' : 'off' ,
7674 '@typescript-eslint/no-unused-vars' : [
7775 'error' ,
7876 { vars : 'all' , args : 'after-used' , ignoreRestSiblings : true } ,
7977 ] ,
78+ '@typescript-eslint/no-unnecessary-type-constraint' : 'off' ,
79+ } ,
80+ settings : {
81+ 'import/resolver' : {
82+ typescript : true ,
83+ } ,
8084 } ,
8185 } ,
8286 {
@@ -87,4 +91,9 @@ module.exports = {
8791 } ,
8892 } ,
8993 ] ,
94+ settings : {
95+ react : {
96+ version : 'detect' ,
97+ } ,
98+ } ,
9099} ;
0 commit comments