-
Notifications
You must be signed in to change notification settings - Fork 26
/
eslint.config.mjs
66 lines (64 loc) · 1.56 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
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import eslint from '@eslint/js';
import jestPlugin from 'eslint-plugin-jest';
import tseslint from 'typescript-eslint';
import tsdocPlugin from 'eslint-plugin-tsdoc';
export default [
{
// config with just ignores is the replacement for `.eslintignore`
ignores: ['**/build/**', '**/dist/**', 'src/some/file/to/ignore.ts'],
},
eslint.configs.recommended,
...tseslint.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
parserOptions: {
project: './tsconfig.eslint.json',
},
},
rules: {
'max-len': [
'error',
160,
2,
{
ignoreUrls: true,
ignoreComments: true,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
'comma-dangle': ['error', 'always-multiline'],
},
},
{
files: ['**/*.ts'],
plugins: {
tsdoc: tsdocPlugin,
},
rules: { 'tsdoc/syntax': 'error' },
},
{
// disable type-aware linting on JS files
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
...tseslint.configs.disableTypeChecked,
},
{
files: ['**/*.cjs'],
languageOptions: {
sourceType: 'commonjs',
},
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
},
{
// enable jest rules on test files
files: ['**/*.spec.ts', '**/*.mock.ts'],
...jestPlugin.configs['flat/recommended'],
},
eslintPluginPrettierRecommended,
];