-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy patheslint.config.mjs
More file actions
111 lines (107 loc) · 2.89 KB
/
Copy patheslint.config.mjs
File metadata and controls
111 lines (107 loc) · 2.89 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import js from '@eslint/js'
import tseslint from 'typescript-eslint'
import unicorn from 'eslint-plugin-unicorn'
import nodePlugin from 'eslint-plugin-n'
import globals from 'globals'
const customRules = {
'no-useless-constructor': 'warn',
'prefer-object-spread': 'warn',
'no-template-curly-in-string': 'off',
'newline-before-return': 'off',
'padding-line-between-statements': 'off',
'quote-props': ['error', 'consistent'],
'capitalized-comments': 'off',
'arrow-body-style': 'off',
'comma-dangle': 'off',
'complexity': 'off',
'max-depth': 'off',
'object-shorthand': 'off',
'operator-linebreak': 'off',
'object-curly-spacing': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/empty-brace-spaces': 'off',
'unicorn/no-this-assignment': 'off',
'unicorn/prefer-ternary': 'off',
'unicorn/no-array-for-each': 'warn',
'unicorn/prefer-logical-operator-over-ternary': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prefer-node-protocol': 'off',
'unicorn/prefer-spread': 'off',
'unicorn/switch-case-braces': 'off',
'unicorn/no-null': 'off',
'unicorn/text-encoding-identifier-case': 'off',
'unicorn/no-instanceof-builtins': 'off',
'unicorn/prefer-at': 'off',
'unicorn/prefer-switch': 'off',
'unicorn/no-immediate-mutation': 'off',
'unicorn/no-useless-undefined': 'off',
'unicorn/consistent-existence-index-check': 'off',
'unicorn/consistent-compound-words': 'off',
'unicorn/prefer-split-limit': 'off'
}
const styleRules = {
indent: ['error', 'tab', {SwitchCase: 1}],
semi: ['error', 'never'],
quotes: ['error', 'single', {avoidEscape: true}],
'no-unexpected-multiline': 'error'
}
const tsCustomRules = {
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-explicit-any': 'off'
}
export default tseslint.config(
{
ignores: [
'coverage/**',
'docs/**',
'docsrc/**',
'scripts/**',
'node_modules/**'
]
},
js.configs.recommended,
unicorn.configs.recommended,
{
files: ['**/*.js'],
...nodePlugin.configs['flat/recommended-script'],
languageOptions: {
sourceType: 'commonjs',
globals: {
...globals.node
}
},
rules: {
...nodePlugin.configs['flat/recommended-script'].rules,
...styleRules,
...customRules,
'n/file-extension-in-import': 'off',
'n/prefer-global/process': 'off',
// Allow `_`-prefixed identifiers as intentional throwaways (e.g. `_ => {}`).
'no-unused-vars': ['error', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}]
}
},
{
files: ['**/*.ts'],
extends: [tseslint.configs.recommended],
rules: {
...styleRules,
...customRules,
...tsCustomRules
}
},
{
files: ['test/**/*.{js,ts}', 'config/jest.setup.js'],
languageOptions: {
globals: {
...globals.jest
}
}
}
)