79 lines
2.2 KiB
JavaScript
79 lines
2.2 KiB
JavaScript
import js from '@eslint/js';
|
|
import tseslint from 'typescript-eslint';
|
|
import prettier from 'eslint-config-prettier';
|
|
|
|
export default tseslint.config(
|
|
{ ignores: ['dist', 'node_modules', 'coverage'] },
|
|
|
|
js.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
|
|
{
|
|
files: ['src/**/*.ts'],
|
|
extends: [...tseslint.configs.recommendedTypeChecked],
|
|
languageOptions: {
|
|
parserOptions: {
|
|
projectService: true,
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/switch-exhaustiveness-check': 'warn',
|
|
'@typescript-eslint/no-unnecessary-condition': 'warn',
|
|
},
|
|
},
|
|
|
|
{
|
|
rules: {
|
|
complexity: ['warn', 12],
|
|
'max-depth': ['warn', 4],
|
|
'max-params': ['warn', 4],
|
|
'max-lines-per-function': [
|
|
'warn',
|
|
{ max: 60, skipBlankLines: true, skipComments: true, IIFEs: true },
|
|
],
|
|
|
|
'no-else-return': ['warn', { allowElseIf: false }],
|
|
'no-lonely-if': 'warn',
|
|
'no-param-reassign': ['warn', { props: false }],
|
|
eqeqeq: ['warn', 'always', { null: 'ignore' }],
|
|
|
|
'prefer-const': 'warn',
|
|
'prefer-template': 'warn',
|
|
'object-shorthand': 'warn',
|
|
'no-console': 'warn',
|
|
|
|
'@typescript-eslint/explicit-function-return-type': [
|
|
'warn',
|
|
{
|
|
allowExpressions: true,
|
|
allowTypedFunctionExpressions: true,
|
|
allowHigherOrderFunctions: true,
|
|
allowDirectConstAssertionInArrowFunctions: true,
|
|
allowIIFEs: true,
|
|
},
|
|
],
|
|
'@typescript-eslint/consistent-type-imports': 'warn',
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'warn',
|
|
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
|
|
],
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
},
|
|
},
|
|
|
|
{
|
|
files: ['**/*.test.ts', '**/*.spec.ts'],
|
|
rules: {
|
|
'max-lines-per-function': 'off',
|
|
'max-params': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
},
|
|
},
|
|
|
|
prettier,
|
|
);
|