107 lines
2.7 KiB
JavaScript
107 lines
2.7 KiB
JavaScript
/* eslint no-use-before-define: 0 */
|
|
|
|
import globals from 'globals';
|
|
import pluginJs from '@eslint/js';
|
|
import tseslint from 'typescript-eslint';
|
|
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
import unicorn from 'eslint-plugin-unicorn';
|
|
import prettier from 'eslint-plugin-prettier';
|
|
import tsParser from '@typescript-eslint/parser';
|
|
|
|
export default [
|
|
{ files: ['**/*.{js,mjs,cjs,ts}'] },
|
|
{ languageOptions: { globals: globals.browser } },
|
|
pluginJs.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
{
|
|
plugins: {
|
|
'@typescript-eslint': typescriptEslint,
|
|
unicorn,
|
|
prettier,
|
|
},
|
|
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
},
|
|
|
|
parser: tsParser,
|
|
ecmaVersion: 5,
|
|
sourceType: 'script',
|
|
|
|
parserOptions: {
|
|
project: ['./tsconfig.json'],
|
|
},
|
|
},
|
|
|
|
settings: {
|
|
'import/resolver': {
|
|
node: {
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
},
|
|
},
|
|
},
|
|
|
|
rules: {
|
|
curly: ['error', 'multi-line'],
|
|
'eol-last': ['error', 'always'],
|
|
semi: ['error', 'always'],
|
|
quotes: ['error', 'single'],
|
|
'no-await-in-loop': 'warn',
|
|
'no-constructor-return': 'error',
|
|
'no-duplicate-imports': 'error',
|
|
'no-self-compare': 'error',
|
|
'no-unreachable-loop': 'error',
|
|
'no-trailing-spaces': 'error',
|
|
'no-console': 'warn',
|
|
'no-shadow': 'off',
|
|
'@typescript-eslint/no-shadow': ['error'],
|
|
'no-unused-vars': 'off',
|
|
'@typescript-eslint/no-unused-vars': ['error'],
|
|
'no-use-before-define': 'off',
|
|
'@typescript-eslint/no-use-before-define': ['error'],
|
|
'@typescript-eslint/require-await': 'warn',
|
|
|
|
'@typescript-eslint/no-misused-promises': ['error', {
|
|
checksVoidReturn: false,
|
|
}],
|
|
|
|
'@typescript-eslint/naming-convention': ['error', {
|
|
selector: 'default',
|
|
format: ['camelCase'],
|
|
}, {
|
|
selector: 'variableLike',
|
|
format: ['camelCase', 'PascalCase'],
|
|
}, {
|
|
selector: 'memberLike',
|
|
format: ['camelCase'],
|
|
}, {
|
|
selector: 'typeLike',
|
|
format: ['PascalCase'],
|
|
}, {
|
|
selector: 'property',
|
|
format: ['snake_case'],
|
|
}, {
|
|
selector: 'method',
|
|
format: ['camelCase'],
|
|
}, {
|
|
selector: ['enumMember', 'enum'],
|
|
format: ['UPPER_CASE'],
|
|
}],
|
|
|
|
'unicorn/empty-brace-spaces': 'off',
|
|
'unicorn/expiring-todo-comments': 'off',
|
|
'unicorn/no-array-for-each': 'off',
|
|
|
|
'unicorn/filename-case': ['error', {
|
|
case: 'camelCase',
|
|
}],
|
|
|
|
'unicorn/numeric-separators-style': 'off',
|
|
'unicorn/prevent-abbreviations': 'off',
|
|
},
|
|
|
|
"ignores": ["*.config.js"]
|
|
}
|
|
];
|