-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from dmanto/migrate-to-eslint-9.x
Migrate to latest ESLint Version
- Loading branch information
Showing
18 changed files
with
156 additions
and
82 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import importPlugin from 'eslint-plugin-import-x'; | ||
import globals from 'globals'; | ||
import tsParser from '@typescript-eslint/parser'; | ||
import eslintJs from '@eslint/js'; | ||
import eslintTs from 'typescript-eslint'; | ||
|
||
const tsFiles = ['{src,test}/**/*.ts']; | ||
const jsFiles = ['test/**/*.js']; | ||
|
||
const languageOptions = { | ||
globals: { | ||
...globals.node | ||
}, | ||
ecmaVersion: 2023, | ||
sourceType: 'module' | ||
}; | ||
|
||
const customTypescriptConfig = { | ||
files: tsFiles, | ||
plugins: { | ||
import: importPlugin, | ||
'import/parsers': tsParser | ||
}, | ||
languageOptions: { | ||
...languageOptions, | ||
parser: tsParser, | ||
parserOptions: { | ||
project: './tsconfig.eslint.json' | ||
} | ||
}, | ||
settings: { | ||
'import/parsers': { | ||
'@typescript-eslint/parser': ['.ts'] | ||
} | ||
}, | ||
rules: { | ||
'import/export': 'error', | ||
'import/no-duplicates': 'warn', | ||
...importPlugin.configs.typescript.rules, | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'require-await': 'off', | ||
'no-duplicate-imports': 'error', | ||
'no-unneeded-ternary': 'error', | ||
'prefer-object-spread': 'error', | ||
|
||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
ignoreRestSiblings: true, | ||
args: 'none' | ||
} | ||
], | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: ['type', 'builtin', ['sibling', 'parent'], 'index', 'object'], | ||
'newlines-between': 'never', | ||
|
||
alphabetize: { | ||
order: 'asc', | ||
caseInsensitive: true | ||
} | ||
} | ||
], | ||
|
||
'@typescript-eslint/consistent-type-imports': [ | ||
'error', | ||
{ | ||
prefer: 'type-imports' | ||
} | ||
], | ||
|
||
'@typescript-eslint/no-explicit-any': 'off' | ||
} | ||
}; | ||
|
||
const customJavascriptConfig = { | ||
files: jsFiles, | ||
languageOptions: { | ||
...languageOptions, | ||
parserOptions: { | ||
ecmaVersion: 2023 | ||
} | ||
}, | ||
rules: { | ||
'no-duplicate-imports': 'error', | ||
'no-unneeded-ternary': 'error', | ||
'prefer-object-spread': 'error', | ||
'no-unused-vars': [ | ||
'error', | ||
{ | ||
ignoreRestSiblings: true, | ||
args: 'none' | ||
} | ||
] | ||
} | ||
}; | ||
const recommendedTypeScriptConfigs = [ | ||
...eslintTs.configs.recommended.map(config => ({ | ||
...config, | ||
files: tsFiles | ||
})), | ||
...eslintTs.configs.stylistic.map(config => ({ | ||
...config, | ||
files: tsFiles | ||
})) | ||
]; | ||
|
||
export default [ | ||
{ignores: ['docs/*', 'lib/*']}, | ||
eslintJs.configs.recommended, | ||
customJavascriptConfig, | ||
...recommendedTypeScriptConfigs, | ||
customTypescriptConfig | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.