Skip to content

Commit

Permalink
add rule explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBenediktBusch committed Feb 8, 2024
1 parent 188efd7 commit 18b077c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,31 @@ module.exports = {
env: { browser: true, es2020: true },
ignorePatterns: ['dist', '.eslintrc.cjs'],
rules: {
// 1. 'react-refresh/only-export-components': Ensure React components are exported properly
// Warn because it's important but not necessarily an error
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],

// 2. '@typescript-eslint/ban-ts-comment': Avoid using @ts-ignore comments
// Warn to discourage usage, but doesn't necessarily break the build
'@typescript-eslint/ban-ts-comment': 'warn',

// 3. '@typescript-eslint/no-var-requires': Discourage using require() in favor of ES6 imports
// Warn to discourage usage, but doesn't necessarily break the build
'@typescript-eslint/no-var-requires': 'warn',

// 4. '@typescript-eslint/no-explicit-any': Avoid using explicit 'any' types
// Warn to encourage type safety, could be upgraded to 'error' for stricter enforcement
'@typescript-eslint/no-explicit-any': 'warn',

// 5. '@tanstack/query/exhaustive-deps': Ensure exhaustive dependency arrays in React hooks
// Warn to highlight potential issues, but doesn't necessarily break the build
'@tanstack/query/exhaustive-deps': 'warn',

// 6. '@typescript-eslint/no-unused-vars': Avoid unused variables, enforcing cleaner code
// Error to ensure unused variables are caught during linting
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_ignored', ignoreRestSiblings: true },
],
},
};
};

0 comments on commit 18b077c

Please sign in to comment.