Skip to content

Commit

Permalink
🔧 (eslint) convert rules from ERROR to WARN to improve devX (#1599)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis authored Sep 9, 2023
1 parent ba4885c commit faa4a7c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
40 changes: 20 additions & 20 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,28 @@ 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: '^_',
ignoreRestSiblings: true,
},
],

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
Expand All @@ -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,
Expand Down Expand Up @@ -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:
Expand All @@ -142,7 +142,7 @@ module.exports = {
},
],
'no-restricted-imports': [
'error',
'warn',
{ patterns: [...restrictedImportPatterns, ...restrictedImportColors] },
],

Expand All @@ -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
Expand All @@ -190,7 +190,7 @@ module.exports = {
files: ['./packages/loot-core/src/**/*'],
rules: {
'no-restricted-imports': [
'error',
'warn',
{
patterns: [
...restrictedImportPatterns,
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/1599.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit faa4a7c

Please sign in to comment.