From 628e2a2300b868875ffc6979b3bfcdbb3583fe67 Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Sat, 9 Sep 2023 17:54:06 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20(eslint)=20convert=20rules=20fro?= =?UTF-8?q?m=20ERROR=20to=20WARN=20to=20improve=20devX=20(#1599)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 40 +++++++++++++++++----------------- upcoming-release-notes/1599.md | 6 +++++ 2 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 upcoming-release-notes/1599.md diff --git a/.eslintrc.js b/.eslintrc.js index fb9d445ee54..89ea002f043 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -44,10 +44,10 @@ module.exports = { parserOptions: { project: [path.join(__dirname, './tsconfig.json')] }, reportUnusedDisableDirectives: true, rules: { - 'prettier/prettier': 'error', + 'prettier/prettier': 'warn', 'no-unused-vars': 'off', '@typescript-eslint/no-unused-vars': [ - 'error', + 'warn', { args: 'none', varsIgnorePattern: '^_', @@ -55,17 +55,17 @@ module.exports = { }, ], - curly: ['error', 'multi-line', 'consistent'], + curly: ['warn', 'multi-line', 'consistent'], - 'no-restricted-globals': ['error'].concat( + 'no-restricted-globals': ['warn'].concat( require('confusing-browser-globals').filter(g => g !== 'self'), ), - 'react/jsx-no-useless-fragment': 'error', - 'react/self-closing-comp': 'error', + 'react/jsx-no-useless-fragment': 'warn', + 'react/self-closing-comp': 'warn', - 'rulesdir/typography': 'error', - 'rulesdir/prefer-if-statement': 'error', + 'rulesdir/typography': 'warn', + 'rulesdir/prefer-if-statement': 'warn', // https://github.com/eslint/eslint/issues/16954 // https://github.com/eslint/eslint/issues/16953 @@ -80,24 +80,24 @@ module.exports = { 'react/display-name': 'off', 'react/react-in-jsx-scope': 'off', // 'react-hooks/exhaustive-deps': [ - // 'error', + // 'warn', // { // additionalHooks: 'useLiveQuery', // }, // ], 'import/extensions': [ - 'error', + 'warn', 'never', { json: 'always', }, ], - 'import/no-useless-path-segments': 'error', - 'import/no-duplicates': ['error', { 'prefer-inline': true }], - 'import/no-unused-modules': ['error', { unusedExports: true }], + 'import/no-useless-path-segments': 'warn', + 'import/no-duplicates': ['warn', { 'prefer-inline': true }], + 'import/no-unused-modules': ['warn', { unusedExports: true }], 'import/order': [ - 'error', + 'warn', { alphabetize: { caseInsensitive: true, @@ -126,7 +126,7 @@ module.exports = { ], 'no-restricted-syntax': [ - 'error', + 'warn', { // forbid React.* as they are legacy https://twitter.com/dan_abramov/status/1308739731551858689 selector: @@ -142,7 +142,7 @@ module.exports = { }, ], 'no-restricted-imports': [ - 'error', + 'warn', { patterns: [...restrictedImportPatterns, ...restrictedImportColors] }, ], @@ -167,14 +167,14 @@ module.exports = { ], rules: { // enforce type over interface - '@typescript-eslint/consistent-type-definitions': ['error', 'type'], + '@typescript-eslint/consistent-type-definitions': ['warn', 'type'], // enforce import type '@typescript-eslint/consistent-type-imports': [ - 'error', + 'warn', { prefer: 'type-imports', fixStyle: 'inline-type-imports' }, ], '@typescript-eslint/ban-types': [ - 'error', + 'warn', { types: { // forbid FC as superflous @@ -190,7 +190,7 @@ module.exports = { files: ['./packages/loot-core/src/**/*'], rules: { 'no-restricted-imports': [ - 'error', + 'warn', { patterns: [ ...restrictedImportPatterns, diff --git a/upcoming-release-notes/1599.md b/upcoming-release-notes/1599.md new file mode 100644 index 00000000000..fb2c2f2c45b --- /dev/null +++ b/upcoming-release-notes/1599.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [MatissJanis] +--- + +Convert eslint rules from "error" to "warn" to improve dev-experience; CI jobs treat warnings as errors, so we still have the same level of protection, but the local-dev experience is slightly improved