diff options
author | 2023-07-30 10:55:59 -0600 | |
---|---|---|
committer | 2023-07-30 23:57:51 +0000 | |
commit | 080d8b05297f3f5afcf33354a40a5201697b1df5 (patch) | |
tree | 35180bd3cb9fcd137feca3fe169032cbbb469463 /.eslintrc.js | |
parent | refactor: various improvements (#1296) (diff) | |
download | ferdium-app-080d8b05297f3f5afcf33354a40a5201697b1df5.tar.gz ferdium-app-080d8b05297f3f5afcf33354a40a5201697b1df5.tar.zst ferdium-app-080d8b05297f3f5afcf33354a40a5201697b1df5.zip |
refactor: more lint improvements
- set parserOptions.ecmaVersion to latest and env to es2024 in eslint config
- install missing types libraries
- install eslint-plugin-sonar
- enable eslint-plugin-sonar recommended rules and declare jsx-runtime for react in eslint config
- clean up disabled lint rules which don't inflict problems anymore
- disable various lint issues and fix others
Diffstat (limited to '.eslintrc.js')
-rw-r--r-- | .eslintrc.js | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/.eslintrc.js b/.eslintrc.js index ef8af48c8..94dcbf8e8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js | |||
@@ -5,15 +5,17 @@ module.exports = { | |||
5 | ecmaFeatures: { | 5 | ecmaFeatures: { |
6 | jsx: true, | 6 | jsx: true, |
7 | }, | 7 | }, |
8 | ecmaVersion: 2018, | 8 | ecmaVersion: 'latest', |
9 | sourceType: 'module', | 9 | sourceType: 'module', |
10 | project: './tsconfig.json', | 10 | project: './tsconfig.json', |
11 | }, | 11 | }, |
12 | ignorePatterns: ['node_modules', 'build', 'recipes'], | 12 | ignorePatterns: ['node_modules', 'build', 'recipes'], |
13 | extends: [ | 13 | extends: [ |
14 | 'airbnb', | 14 | 'airbnb', |
15 | 'plugin:react/jsx-runtime', | ||
15 | 'plugin:jest/recommended', | 16 | 'plugin:jest/recommended', |
16 | 'plugin:unicorn/recommended', | 17 | 'plugin:unicorn/recommended', |
18 | 'plugin:sonar/recommended', | ||
17 | 'plugin:prettier/recommended', | 19 | 'plugin:prettier/recommended', |
18 | ], | 20 | ], |
19 | plugins: ['jest'], | 21 | plugins: ['jest'], |
@@ -28,7 +30,7 @@ module.exports = { | |||
28 | }, | 30 | }, |
29 | env: { | 31 | env: { |
30 | browser: true, | 32 | browser: true, |
31 | es6: true, | 33 | es2024: true, |
32 | node: true, | 34 | node: true, |
33 | jest: true, | 35 | jest: true, |
34 | }, | 36 | }, |
@@ -66,7 +68,7 @@ module.exports = { | |||
66 | '@typescript-eslint/no-empty-interface': 0, | 68 | '@typescript-eslint/no-empty-interface': 0, |
67 | 69 | ||
68 | // eslint-plugin-import | 70 | // eslint-plugin-import |
69 | 'import/no-extraneous-dependencies': 0, // various false positives, re-enable at some point | 71 | 'import/no-extraneous-dependencies': 0, |
70 | }, | 72 | }, |
71 | }, | 73 | }, |
72 | ], | 74 | ], |
@@ -75,8 +77,6 @@ module.exports = { | |||
75 | 'array-callback-return': 1, | 77 | 'array-callback-return': 1, |
76 | 'class-methods-use-this': 0, | 78 | 'class-methods-use-this': 0, |
77 | 'consistent-return': 1, | 79 | 'consistent-return': 1, |
78 | // TODO: Turn this rule on once the js to ts conversions are over | ||
79 | // This is necessary as workaround for window.ferdium vs window['ferdium'] | ||
80 | 'no-await-in-loop': 1, | 80 | 'no-await-in-loop': 1, |
81 | 'no-return-assign': 1, | 81 | 'no-return-assign': 1, |
82 | 'no-console': [ | 82 | 'no-console': [ |
@@ -94,26 +94,20 @@ module.exports = { | |||
94 | 'import/prefer-default-export': 0, | 94 | 'import/prefer-default-export': 0, |
95 | 'import/no-unresolved': 0, | 95 | 'import/no-unresolved': 0, |
96 | 'import/no-cycle': 1, | 96 | 'import/no-cycle': 1, |
97 | 'import/no-extraneous-dependencies': 0, // various false positives, re-enable at some point | 97 | 'import/no-extraneous-dependencies': 0, |
98 | // eslint-plugin-react | 98 | // eslint-plugin-react |
99 | 'react/forbid-prop-types': 1, | 99 | 'react/forbid-prop-types': 1, |
100 | 'react/destructuring-assignment': 0, | 100 | 'react/destructuring-assignment': 0, |
101 | 'react/react-in-jsx-scope': 0, | ||
102 | 'react/jsx-filename-extension': 1, | 101 | 'react/jsx-filename-extension': 1, |
103 | 'react/jsx-one-expression-per-line': 0, | ||
104 | 'react/jsx-no-bind': 1, | 102 | 'react/jsx-no-bind': 1, |
105 | 'react/jsx-props-no-spreading': 0, | 103 | 'react/jsx-props-no-spreading': 0, |
106 | 'react/prefer-stateless-function': 1, | 104 | 'react/prefer-stateless-function': 1, |
107 | 'react/prop-types': 0, | ||
108 | 'react/static-property-placement': 0, | 105 | 'react/static-property-placement': 0, |
109 | 'react/state-in-constructor': 1, | 106 | 'react/state-in-constructor': 1, |
110 | 'react/sort-comp': 0, | 107 | 'react/sort-comp': 0, |
111 | 'react/function-component-definition': 0, | 108 | 'react/function-component-definition': 0, |
112 | 'react/jsx-no-useless-fragment': 0, | ||
113 | // TODO: [TS DEBT] should remove below config once application converted to TS | ||
114 | 'react/default-props-match-prop-types': 0, | 109 | 'react/default-props-match-prop-types': 0, |
115 | 'react/require-default-props': 0, | 110 | 'react/require-default-props': 0, |
116 | 'react/button-has-type': 0, | ||
117 | 'react/no-unused-prop-types': 1, | 111 | 'react/no-unused-prop-types': 1, |
118 | 'react/no-deprecated': 1, | 112 | 'react/no-deprecated': 1, |
119 | // eslint-plugin-jsx-a11y | 113 | // eslint-plugin-jsx-a11y |
@@ -133,10 +127,8 @@ module.exports = { | |||
133 | // eslint-plugin-unicorn | 127 | // eslint-plugin-unicorn |
134 | 'unicorn/filename-case': 0, | 128 | 'unicorn/filename-case': 0, |
135 | 'unicorn/no-null': 0, | 129 | 'unicorn/no-null': 0, |
136 | 'unicorn/no-useless-undefined': 0, | ||
137 | 'unicorn/prefer-module': 0, | 130 | 'unicorn/prefer-module': 0, |
138 | 'unicorn/prevent-abbreviations': 0, | 131 | 'unicorn/prevent-abbreviations': 0, |
139 | 'unicorn/prefer-node-protocol': 0, | ||
140 | 'unicorn/import-style': [ | 132 | 'unicorn/import-style': [ |
141 | 2, | 133 | 2, |
142 | { | 134 | { |
@@ -148,7 +140,7 @@ module.exports = { | |||
148 | }, | 140 | }, |
149 | ], | 141 | ], |
150 | 'unicorn/consistent-destructuring': 0, | 142 | 'unicorn/consistent-destructuring': 0, |
151 | // INFO: Turned off due to src/internal-server/database/factory.js | 143 | // eslint-plugin-sonar |
152 | 'unicorn/no-empty-file': 0, | 144 | 'sonar/function-name': 0, |
153 | }, | 145 | }, |
154 | }; | 146 | }; |