-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving flat configuration format for eslint.
- Loading branch information
Showing
20 changed files
with
5,568 additions
and
5,261 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,102 +1,48 @@ | ||
import globals from 'globals' | ||
import tsParser from '@typescript-eslint/parser' | ||
import path from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
import js from '@eslint/js' | ||
import { FlatCompat } from '@eslint/eslintrc' | ||
|
||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = path.dirname(__filename) | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all | ||
}) | ||
|
||
export default [ | ||
import eslintJS from '@eslint/js' | ||
import eslintTS from 'typescript-eslint' | ||
import pluginPrettier from 'eslint-plugin-prettier/recommended' | ||
import pluginSecurity from 'eslint-plugin-security' | ||
import pluginJest from 'eslint-plugin-jest' | ||
|
||
export default eslintTS.config( | ||
eslintJS.configs.recommended, | ||
...eslintTS.configs.strictTypeChecked, | ||
pluginJest.configs['flat/recommended'], | ||
pluginSecurity.configs.recommended, | ||
{ | ||
ignores: ['coverage/*', 'src/sjcl/index.js', 'src/sjcl/index.d.ts', 'lib/*'] | ||
ignores: [ | ||
'jest.config.mjs', | ||
'eslint.config.mjs', | ||
'coverage/*', | ||
'src/groupSjcl.ts', | ||
'src/sjcl/index.js', | ||
'src/sjcl/index.d.ts', | ||
'lib/*' | ||
] | ||
}, | ||
...compat.extends( | ||
'eslint:recommended', | ||
'plugin:security/recommended-legacy', | ||
'plugin:prettier/recommended' | ||
), | ||
{ | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
...globals.node | ||
}, | ||
|
||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
|
||
parserOptions: { | ||
project: true | ||
project: true, | ||
tsconfigRootDir: import.meta.dirname | ||
} | ||
} | ||
}, | ||
...compat | ||
.extends( | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:jest-formatting/recommended', | ||
'plugin:jest/recommended', | ||
'prettier' | ||
) | ||
.map((config) => ({ | ||
...config, | ||
files: ['**/*.ts'] | ||
})), | ||
{ | ||
files: ['**/*.ts'], | ||
|
||
languageOptions: { | ||
parser: tsParser, | ||
ecmaVersion: 2020, | ||
sourceType: 'module' | ||
}, | ||
|
||
rules: { | ||
'max-lines-per-function': [ | ||
'warn', | ||
{ | ||
max: 100, | ||
skipComments: true, | ||
skipBlankLines: true | ||
} | ||
], | ||
|
||
'max-statements': ['warn', 50], | ||
'max-params': ['warn', 5], | ||
'no-loop-func': 'warn', | ||
'max-lines': 'off', | ||
'no-ternary': 'off', | ||
'no-inline-comments': 'off', | ||
'line-comment-position': 'off', | ||
'no-magic-numbers': 'off', | ||
'id-length': 'off', | ||
'max-classes-per-file': 'off', | ||
'sort-keys': 'off', | ||
'sort-vars': 'off', | ||
'no-bitwise': 'off', | ||
'no-plusplus': 'off', | ||
'capitalized-comments': 'off', | ||
'multiline-comment-style': 'off', | ||
'func-style': ['error', 'declaration'], | ||
'one-var': ['error', 'never'], | ||
'@typescript-eslint/no-namespace': 'warn', | ||
|
||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
argsIgnorePattern: '^_' | ||
"args": "all", | ||
"argsIgnorePattern": "^_", | ||
"caughtErrors": "all", | ||
"varsIgnorePattern": "^_" | ||
} | ||
], | ||
|
||
'@typescript-eslint/consistent-type-imports': 'error', | ||
'@typescript-eslint/consistent-type-exports': 'error' | ||
'@typescript-eslint/consistent-type-exports': 'error', | ||
'@typescript-eslint/restrict-template-expressions': 'off' | ||
} | ||
} | ||
] | ||
}, | ||
pluginPrettier | ||
) |
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.