-
-
Notifications
You must be signed in to change notification settings - Fork 43
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 #622 from 3flex/eslint9
Update to ESLint 9
- Loading branch information
Showing
5 changed files
with
373 additions
and
374 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,145 @@ | ||
import jsdoc from 'eslint-plugin-jsdoc'; | ||
import promise from 'eslint-plugin-promise'; | ||
import importPlugin from 'eslint-plugin-import'; | ||
import globals from 'globals'; | ||
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; | ||
import eslint from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
import json from 'eslint-plugin-json'; | ||
|
||
export default [ | ||
eslint.configs.recommended, | ||
jsdoc.configs['flat/recommended'], | ||
eslintPluginPrettierRecommended, | ||
...tseslint.configs.recommended, | ||
promise.configs['flat/recommended'], | ||
importPlugin.flatConfigs.errors, | ||
importPlugin.flatConfigs.warnings, | ||
{ | ||
ignores: ['dist/*'] | ||
}, | ||
{ | ||
settings: { | ||
'import/resolver': { | ||
typescript: { | ||
alwaysTryTypes: true | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
files: ['**/*.json'], | ||
...json.configs['recommended'] | ||
}, | ||
{ | ||
files: ['**/*.ts'], | ||
...importPlugin.flatConfigs.typescript, | ||
languageOptions: { | ||
parser: tseslint.parser | ||
} | ||
}, | ||
{ | ||
files: ['**/*.ts', '**/*.js'], | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
...globals.es2015 | ||
} | ||
}, | ||
rules: { | ||
'@typescript-eslint/explicit-function-return-type': 'error', | ||
'@typescript-eslint/no-explicit-any': 'warn', | ||
'@typescript-eslint/no-unused-expressions': 'warn', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ caughtErrors: 'none' } | ||
], | ||
'@typescript-eslint/prefer-ts-expect-error': 'error', | ||
curly: 'error', | ||
'import/newline-after-import': 'error', | ||
'import/order': 'error', | ||
'jsdoc/check-indentation': 'error', | ||
'jsdoc/check-param-names': 'error', | ||
'jsdoc/check-property-names': 'error', | ||
'jsdoc/check-syntax': 'error', | ||
'jsdoc/check-tag-names': 'error', | ||
'jsdoc/no-types': 'error', | ||
'jsdoc/require-description': 'warn', | ||
'jsdoc/require-hyphen-before-param-description': 'error', | ||
'jsdoc/require-jsdoc': 'error', | ||
'jsdoc/require-param-description': 'warn', | ||
//TypeScript and IntelliSense already provides us information about the function typings while hovering and | ||
// eslint-jsdoc doesn't detect a mismatch between what's declared in the function and what's declared in | ||
// JSDOC. | ||
'jsdoc/require-param-type': 'off', | ||
'jsdoc/require-returns-type': 'off', | ||
'jsdoc/valid-types': 'off', | ||
'padding-line-between-statements': [ | ||
'error', | ||
// Always require blank lines after directives (like 'use-strict'), except between directives | ||
{ blankLine: 'always', next: '*', prev: 'directive' }, | ||
{ blankLine: 'any', next: 'directive', prev: 'directive' }, | ||
// Always require blank lines after import, except between imports | ||
{ blankLine: 'always', next: '*', prev: 'import' }, | ||
{ blankLine: 'any', next: 'import', prev: 'import' }, | ||
// Always require blank lines before and after every sequence of variable declarations and export | ||
{ | ||
blankLine: 'always', | ||
next: ['const', 'let', 'var', 'export'], | ||
prev: '*' | ||
}, | ||
{ | ||
blankLine: 'always', | ||
next: '*', | ||
prev: ['const', 'let', 'var', 'export'] | ||
}, | ||
{ | ||
blankLine: 'any', | ||
next: ['const', 'let', 'var', 'export'], | ||
prev: ['const', 'let', 'var', 'export'] | ||
}, | ||
// Always require blank lines before and after class declaration, if, do/while, switch, try | ||
{ | ||
blankLine: 'always', | ||
next: [ | ||
'if', | ||
'class', | ||
'for', | ||
'do', | ||
'while', | ||
'switch', | ||
'try' | ||
], | ||
prev: '*' | ||
}, | ||
{ | ||
blankLine: 'always', | ||
next: '*', | ||
prev: ['if', 'class', 'for', 'do', 'while', 'switch', 'try'] | ||
}, | ||
// Always require blank lines before return statements | ||
{ blankLine: 'always', next: 'return', prev: '*' } | ||
], | ||
'prefer-arrow-callback': 'error', | ||
'prefer-template': 'error', | ||
'promise/no-nesting': 'error', | ||
'promise/no-return-in-finally': 'error', | ||
'promise/prefer-await-to-callbacks': 'error', | ||
'promise/prefer-await-to-then': 'error', | ||
'sort-keys': [ | ||
'error', | ||
'asc', | ||
{ caseSensitive: false, minKeys: 2, natural: true } | ||
], | ||
'sort-vars': 'error' | ||
} | ||
}, | ||
{ | ||
files: ['*.js'], | ||
languageOptions: { | ||
globals: { | ||
...globals.node | ||
} | ||
} | ||
} | ||
]; |
Oops, something went wrong.