forked from CorentinTh/it-tools
-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy patheslint.config.js
More file actions
155 lines (153 loc) · 5.96 KB
/
Copy patheslint.config.js
File metadata and controls
155 lines (153 loc) · 5.96 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import antfu from '@antfu/eslint-config';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import autoImportGlobals from './.eslintrc-auto-import.json' with { type: 'json' };
const antfuConfig = antfu(
{
unocss: true,
vue: true,
typescript: true,
markdown: false,
ignores: ['src/libs/*', 'components.d.ts'],
},
{
linterOptions: {
// TODO: re-enable when all eslint-disable comments updated to new rule names
reportUnusedDisableDirectives: 'off',
},
languageOptions: {
globals: Object.fromEntries(
Object.keys(autoImportGlobals.globals).map(k => [k, 'readonly']),
),
},
rules: {
'curly': ['error', 'all'],
'style/semi': ['error', 'always'],
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error', { allowNamedExports: true, functions: false }],
'vue/no-empty-component-block': ['error'],
'import/order': 'off',
// TODO: enable import/export sorting and formatting gradually in a dedicated PR
'perfectionist/sort-imports': 'off',
'perfectionist/sort-named-imports': 'off',
'perfectionist/sort-named-exports': 'off',
'import/consistent-type-specifier-style': 'off',
'antfu/consistent-list-newline': 'off',
'style/indent-binary-ops': 'off',
'style/member-delimiter-style': 'off',
'no-restricted-imports': ['error', {
paths: [{
name: '@vueuse/core',
importNames: ['useClipboard'],
message: 'Please use local useCopy from src/composable/copy.ts instead of useClipboard.',
}],
}],
// TODO: gradually enable these rules in follow-up PRs once existing
// violations are fixed — they were newly introduced by @antfu/eslint-config v9
'regexp/no-unused-capturing-group': 'off',
'regexp/no-super-linear-backtracking': 'off',
'regexp/no-misleading-capturing-group': 'off',
'regexp/optimal-quantifier-concatenation': 'off',
'regexp/no-useless-assertions': 'off',
'regexp/no-potentially-useless-backreference': 'off',
'regexp/no-obscure-range': 'off',
'regexp/strict': 'off',
'regexp/no-useless-flag': 'off',
'regexp/no-empty-lookarounds-assertion': 'off',
'regexp/no-empty-group': 'off',
'regexp/no-empty-alternative': 'off',
'regexp/negation': 'off',
'regexp/no-dupe-characters-character-class': 'off',
'regexp/no-trivially-nested-quantifier': 'off',
'regexp/no-useless-character-class': 'off',
'regexp/no-useless-escape': 'off',
'regexp/no-useless-lazy': 'off',
'regexp/no-useless-non-capturing-group': 'off',
'regexp/prefer-character-class': 'off',
'regexp/prefer-d': 'off',
'regexp/prefer-range': 'off',
'regexp/prefer-w': 'off',
'regexp/sort-flags': 'off',
'regexp/use-ignore-case': 'off',
'unicorn/prefer-dom-node-text-content': 'off',
'unicorn/new-for-builtins': 'off',
'antfu/no-top-level-await': 'off',
'node/prefer-global/buffer': 'off',
'ts/method-signature-style': 'off',
'ts/no-unused-expressions': 'off',
'ts/no-namespace': 'off',
'ts/ban-ts-comment': 'off',
'jsonc/no-dupe-keys': 'off',
'vue/no-required-prop-with-default': 'off',
'vue/no-side-effects-in-computed-properties': 'off',
'vue/return-in-computed-property': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/prefer-ts-expect-error': 'off',
'@typescript-eslint/no-namespace': 'off',
'test/no-identical-title': 'off',
'test/consistent-test-it': 'off',
'test/prefer-lowercase-title': 'off',
'no-irregular-whitespace': 'off',
'style/max-statements-per-line': 'off',
'style/no-trailing-spaces': 'off',
'style/type-annotation-spacing': 'off',
'style/indent': 'off',
'style/no-tabs': 'off',
'style/eol-last': 'off',
'style/quotes': 'off',
'style/comma-dangle': 'off',
'style/comma-spacing': 'off',
'style/key-spacing': 'off',
'style/object-curly-spacing': 'off',
'style/space-before-blocks': 'off',
'style/space-before-function-paren': 'off',
'style/no-extra-parens': 'off',
'style/no-multi-spaces': 'off',
'style/operator-linebreak': 'off',
'style/quote-props': 'off',
'style/semi-spacing': 'off',
'style/generator-star-spacing': 'off',
'style/jsx-curly-brace-presence': 'off',
'style/jsx-one-expression-per-line': 'off',
'style/type-generic-spacing': 'off',
'jsonc/indent': 'off',
'jsonc/object-curly-newline': 'off',
'jsonc/object-curly-spacing': 'off',
'ts/consistent-type-definitions': 'off',
'ts/no-import-type-side-effects': 'off',
'ts/no-wrapper-object-types': 'off',
'ts/prefer-namespace-keyword': 'off',
'e18e/prefer-array-some': 'off',
'e18e/prefer-date-now': 'off',
'e18e/prefer-nullish-coalescing': 'off',
'e18e/prefer-object-has-own': 'off',
'e18e/prefer-regex-test': 'off',
'antfu/consistent-chaining': 'off',
'import/newline-after-import': 'off',
'vue/no-ref-as-operand': 'off',
'unused-imports/no-unused-vars': ['warn', {
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
caughtErrors: 'none',
}],
},
},
{
// Shim .d.ts files use no-semicolon style — don't enforce semi there
// TODO: align these files to project style in a follow-up PR
files: ['**/*.d.ts'],
rules: {
'style/semi': 'off',
},
},
);
// Re-register @typescript-eslint plugin under its legacy name as a standalone
// config entry so inline eslint-disable comments using the old name don't
// produce "Definition not found" errors after @antfu/eslint-config v9 renamed
// the plugin to 'ts/'.
// TODO: migrate all eslint-disable comments in source files to use 'ts/' prefix
export default [
{ plugins: { '@typescript-eslint': tsPlugin } },
...await antfuConfig,
];