@@ -6,6 +6,8 @@ module.exports = {
66 'plugin:@typescript-eslint/recommended' ,
77 'plugin:@typescript-eslint/recommended-requiring-type-checking' ,
88 'airbnb/hooks' ,
9+ 'prettier/@typescript-eslint' ,
10+ 'plugin:prettier/recommended' ,
911 'plugin:eslint-comments/recommended' ,
1012 'plugin:jest/recommended' ,
1113 'plugin:promise/recommended' ,
@@ -16,14 +18,44 @@ module.exports = {
1618 'plugin:import/warnings' ,
1719 'plugin:import/typescript' ,
1820 ] ,
19- plugins : [ '@typescript-eslint' , 'eslint-comments' , 'jest' , 'import' , 'promise' , 'unicorn' , 'header' , 'react-hooks' , 'jsx-a11y' ] ,
21+ plugins : [
22+ '@typescript-eslint' ,
23+ 'eslint-comments' ,
24+ 'jest' ,
25+ 'import' ,
26+ 'promise' ,
27+ 'unicorn' ,
28+ 'header' ,
29+ 'react-hooks' ,
30+ 'jsx-a11y' ,
31+ 'prettier' ,
32+ ] ,
2033 rules : {
2134 /**
2235 * depricated to be deleted
2336 */
2437 // https://github.com/typescript-eslint/typescript-eslint/issues/2077
2538 '@typescript-eslint/camelcase' : 0 ,
2639
40+ /**
41+ *****************************************
42+ * Rules with high processing demand
43+ *****************************************
44+ */
45+ 'import/no-restricted-paths' :
46+ process . env . NODE_ENV === 'production'
47+ ? [
48+ 'error' ,
49+ {
50+ zones : [
51+ { target : './src' , from : './src/index.ts' } ,
52+ { target : './src' , from : './' , except : [ './src' , './node_modules/' ] } ,
53+ ] ,
54+ } ,
55+ ]
56+ : 0 ,
57+ 'import/namespace' : process . env . NODE_ENV === 'production' ? 2 : 0 ,
58+
2759 /**
2860 *****************************************
2961 * Rules to consider adding/fixing later
@@ -99,14 +131,18 @@ module.exports = {
99131 ExportDeclaration : { consistent : true } ,
100132 } ,
101133 ] ,
102- quotes : [ 'error' , 'single' ] ,
103134 semi : [ 'error' , 'always' ] ,
104135 // https://github.com/typescript-eslint/typescript-eslint/issues/1824
105- indent : [ 'error' , 2 , {
106- SwitchCase : 1 ,
107- MemberExpression : 1 ,
108- offsetTernaryExpressions : true ,
109- } ] ,
136+ // TODO: Add back once indent ts rule is fixed
137+ // indent: [
138+ // 'error',
139+ // 2,
140+ // {
141+ // SwitchCase: 1,
142+ // MemberExpression: 1,
143+ // offsetTernaryExpressions: true,
144+ // },
145+ // ],
110146 'max-len' : [
111147 'warn' ,
112148 {
@@ -144,7 +180,6 @@ module.exports = {
144180 '@typescript-eslint/indent' : 0 ,
145181 '@typescript-eslint/no-inferrable-types' : 0 ,
146182 '@typescript-eslint/ban-ts-comment' : 1 ,
147- '@typescript-eslint/space-before-function-paren' : [ 2 , 'never' ] ,
148183 '@typescript-eslint/no-unused-vars' : [
149184 'error' ,
150185 {
@@ -166,22 +201,15 @@ module.exports = {
166201 /*
167202 * import plugin
168203 */
169- 'import/order' : [ 'error' , {
170- 'newlines-between' : 'always' ,
171- groups : [
172- 'builtin' ,
173- 'external' ,
174- [ 'parent' , 'sibling' , 'index' , 'internal' ] ,
175- ] ,
176- alphabetize : { order : 'asc' , caseInsensitive : true } , // todo replace with directory gradient ordering
177- } ] ,
178- 'import/no-unresolved' : [ 'error' , { ignore : [ 'theme_dark.scss' , 'theme_light.scss' ] } ] ,
179- 'import/no-restricted-paths' : [
204+ 'import/order' : [
180205 'error' ,
181206 {
182- zones : [ { target : './src' , from : './src/index.ts' } , { target : './src' , from : './' , except : [ './src' , './node_modules/' ] } ] ,
207+ 'newlines-between' : 'always' ,
208+ groups : [ 'builtin' , 'external' , [ 'parent' , 'sibling' , 'index' , 'internal' ] ] ,
209+ alphabetize : { order : 'asc' , caseInsensitive : true } , // todo replace with directory gradient ordering
183210 } ,
184211 ] ,
212+ 'import/no-unresolved' : [ 'error' , { ignore : [ 'theme_dark.scss' , 'theme_light.scss' ] } ] ,
185213 // https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html
186214 'import/prefer-default-export' : 0 ,
187215 // Limit usage in development directories
@@ -192,6 +220,10 @@ module.exports = {
192220 */
193221 'react/jsx-curly-brace-presence' : [ 'error' , { props : 'never' , children : 'never' } ] ,
194222 'react/prop-types' : 0 ,
223+ 'react/sort-comp' : 0 ,
224+ 'react/jsx-one-expression-per-line' : 0 ,
225+ 'react/jsx-curly-newline' : 0 ,
226+ 'react/jsx-indent' : 0 ,
195227 // Too restrictive: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
196228 'react/destructuring-assignment' : 0 ,
197229 // No jsx extension: https://github.com/facebook/create-react-app/issues/87#issuecomment-234627904
@@ -347,6 +379,12 @@ module.exports = {
347379 ] ,
348380 } ,
349381 } ,
382+ {
383+ files : [ '.playground/**/*.ts?(x)' ] ,
384+ rules : {
385+ 'react/prefer-stateless-function' : 0 ,
386+ } ,
387+ } ,
350388 {
351389 files : [ '*.test.ts?(x)' ] ,
352390 rules : {
0 commit comments