Skip to content

Commit

Permalink
Merge pull request #5000 from kobotoolbox/eslint-type-duplicate-imports
Browse files Browse the repository at this point in the history
Update ESLint config to accept separate type imports in TS again
  • Loading branch information
magicznyleszek authored Jul 17, 2024
2 parents e4056df + ad79423 commit bd881d9
Show file tree
Hide file tree
Showing 3 changed files with 439 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ const tsRules = Object.assign({}, jsRules, {
'comma-dangle': 'off',
'comma-spacing': 'off',
'func-call-spacing': 'off',
'no-duplicate-imports': [1, {includeExports: true}],
// The 'import' plugin supports separately importing types
// (@typescript-eslint/no-duplicate-imports is deprecated)
'import/no-duplicates': 1,
// Turn off ESLint's version of this rule when in TypeScript
'no-duplicate-imports': 'off',
'no-nonoctal-decimal-escape': 'off',
// It is recommended that this check is disabled for TS files, see:
// https://typescript-eslint.io/docs/linting/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
Expand Down Expand Up @@ -213,7 +217,18 @@ module.exports = {
{
files: ['**/*.ts', '**/*.tsx'],
parser: '@typescript-eslint/parser',
plugins: ['react', '@typescript-eslint'],
plugins: [
'react',
'@typescript-eslint',
// For import/no-duplicates
// Could do more with it.
'import',
],
settings: {
'import/resolver': {
typescript: true,
},
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parserOptions: {
project: ['./tsconfig.json'],
Expand Down
Loading

0 comments on commit bd881d9

Please sign in to comment.