-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
87 lines (82 loc) · 2.22 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import globals from 'globals';
import importPlugin from 'eslint-plugin-import';
import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin';
import { FlatCompat } from '@eslint/eslintrc';
import path from 'path';
import tsParser from '@typescript-eslint/parser';
import jest from 'eslint-plugin-jest';
// mimic CommonJS variables -- not needed if using CommonJS
const __dirname = path.dirname(import.meta.url);
const compat = new FlatCompat({
baseDirectory: __dirname,
resolvePluginsRelativeTo: __dirname,
});
export default [
...compat.config({
extends: ['airbnb-base'],
rules: {
// fix airbnb conflicts
'import/extensions': 'off',
'import/no-unresolved': 'off',
},
}),
{
files: ['**/*.+(ts|tsx|mts|cts|js|mjs|cjs|jsx)'],
plugins: {
'@typescript-eslint': typescriptEslintPlugin,
import: importPlugin,
},
languageOptions: {
ecmaVersion: 'latest',
parser: tsParser,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
},
},
rules: {
'no-underscore-dangle': 0,
'no-param-reassign': 0,
'max-len': [2, 150, 4],
'max-classes-per-file': 0,
'space-before-function-paren': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/ban-ts-comment': 0,
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': 'error',
// fix try/catch unused (e)
'@typescript-eslint/no-unused-vars': [
'error', {
ignoreRestSiblings: true,
caughtErrors: 'none',
},
],
'no-unused-vars': 'off',
},
settings: {
...importPlugin.configs.typescript.settings,
'import/resolver': {
...importPlugin.configs.typescript.settings['import/resolver'],
},
},
},
{
files: ['tests/**'],
...jest.configs['flat/recommended'],
rules: {
'jest/no-conditional-expect': 'off',
'import/prefer-default-export': 'off',
},
},
{
files: ['eslint.config.mjs'],
rules: {
'import/no-extraneous-dependencies': 'off',
},
},
{
ignores: ['dist/**', 'node_modules/**', 'tests/unit/*.js'],
},
];