@cabloy/lint 5.0.21 → 5.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/eslint.js +32 -24
- package/common/rules.js +40 -28
- package/front/eslint.js +33 -24
- package/index.js +3 -0
- package/oxc/format.js +37 -0
- package/oxc/lint.js +1476 -0
- package/oxc/lintVue.js +1472 -0
- package/package.json +11 -6
package/api/eslint.js
CHANGED
|
@@ -1,33 +1,41 @@
|
|
|
1
1
|
import antfu from '@antfu/eslint-config';
|
|
2
2
|
import globals from 'globals';
|
|
3
|
+
|
|
3
4
|
import { rules } from '../common/rules.js';
|
|
4
5
|
|
|
5
6
|
export default function eslintConfig(config, ...args) {
|
|
6
|
-
config = Object.assign(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
typescript: true,
|
|
15
|
-
gitignore: false,
|
|
16
|
-
}, config);
|
|
17
|
-
return antfu(config, {
|
|
18
|
-
files: ['**/*.ts', '**/*.tsx'],
|
|
19
|
-
rules,
|
|
20
|
-
languageOptions: {
|
|
21
|
-
parserOptions: {
|
|
22
|
-
emitDecoratorMetadata: true,
|
|
23
|
-
experimentalDecorators: true,
|
|
24
|
-
projectService: true,
|
|
7
|
+
config = Object.assign(
|
|
8
|
+
{
|
|
9
|
+
// isInEditor: false,
|
|
10
|
+
stylistic: {
|
|
11
|
+
indent: 2,
|
|
12
|
+
quotes: 'single',
|
|
13
|
+
semi: true,
|
|
14
|
+
jsx: true,
|
|
25
15
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
typescript: true,
|
|
17
|
+
gitignore: false,
|
|
18
|
+
},
|
|
19
|
+
config,
|
|
20
|
+
);
|
|
21
|
+
return antfu(
|
|
22
|
+
config,
|
|
23
|
+
{
|
|
24
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
25
|
+
rules,
|
|
26
|
+
languageOptions: {
|
|
27
|
+
parserOptions: {
|
|
28
|
+
emitDecoratorMetadata: true,
|
|
29
|
+
experimentalDecorators: true,
|
|
30
|
+
projectService: true,
|
|
31
|
+
},
|
|
32
|
+
globals: {
|
|
33
|
+
...globals.node,
|
|
34
|
+
...globals.jest,
|
|
35
|
+
NodeJS: true,
|
|
36
|
+
},
|
|
30
37
|
},
|
|
31
38
|
},
|
|
32
|
-
|
|
39
|
+
...args,
|
|
40
|
+
);
|
|
33
41
|
}
|
package/common/rules.js
CHANGED
|
@@ -114,37 +114,49 @@ export const rules = {
|
|
|
114
114
|
'@typescript-eslint/no-empty-object-type': 'off',
|
|
115
115
|
'@typescript-eslint/no-unsafe-function-type': 'off',
|
|
116
116
|
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
|
|
117
|
-
'@stylistic/max-len': [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
117
|
+
'@stylistic/max-len': [
|
|
118
|
+
'error',
|
|
119
|
+
{
|
|
120
|
+
code: 150,
|
|
121
|
+
tabWidth: 2,
|
|
122
|
+
ignoreComments: true,
|
|
123
|
+
ignoreTrailingComments: true,
|
|
124
|
+
ignoreUrls: true,
|
|
125
|
+
ignoreStrings: true,
|
|
126
|
+
ignoreTemplateLiterals: true,
|
|
127
|
+
ignoreRegExpLiterals: true,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
127
130
|
'@stylistic/arrow-parens': ['error', 'as-needed'],
|
|
128
131
|
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
129
132
|
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
|
|
130
133
|
'@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
|
|
131
|
-
'@stylistic/keyword-spacing': [
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
134
|
+
'@stylistic/keyword-spacing': [
|
|
135
|
+
'error',
|
|
136
|
+
{
|
|
137
|
+
overrides: {
|
|
138
|
+
this: { before: true },
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
'@stylistic/indent': [
|
|
143
|
+
'error',
|
|
144
|
+
2,
|
|
145
|
+
{
|
|
146
|
+
SwitchCase: 1,
|
|
147
|
+
VariableDeclarator: 'first',
|
|
148
|
+
outerIIFEBody: 1,
|
|
149
|
+
MemberExpression: 1,
|
|
150
|
+
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
151
|
+
FunctionExpression: { body: 1, parameters: 1 },
|
|
152
|
+
StaticBlock: { body: 1 },
|
|
153
|
+
CallExpression: { arguments: 1 },
|
|
154
|
+
ArrayExpression: 1,
|
|
155
|
+
ObjectExpression: 1,
|
|
156
|
+
ImportDeclaration: 1,
|
|
157
|
+
flatTernaryExpressions: true,
|
|
158
|
+
offsetTernaryExpressions: true,
|
|
159
|
+
},
|
|
160
|
+
],
|
|
149
161
|
'@stylistic/jsx-closing-tag-location': 'off',
|
|
150
162
|
};
|
package/front/eslint.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import antfu from '@antfu/eslint-config';
|
|
2
2
|
import globals from 'globals';
|
|
3
|
+
|
|
3
4
|
import { rules } from '../common/rules.js';
|
|
4
5
|
import { rulesVue } from '../common/rulesVue.js';
|
|
5
6
|
|
|
@@ -19,32 +20,40 @@ const globalsMy = {
|
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
export default function eslintConfig(config, ...args) {
|
|
22
|
-
config = Object.assign(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
config = Object.assign(
|
|
24
|
+
{
|
|
25
|
+
stylistic: {
|
|
26
|
+
indent: 2,
|
|
27
|
+
quotes: 'single',
|
|
28
|
+
semi: true,
|
|
29
|
+
jsx: true,
|
|
30
|
+
},
|
|
31
|
+
typescript: true,
|
|
32
|
+
vue: true,
|
|
33
|
+
gitignore: false,
|
|
28
34
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
config,
|
|
36
|
+
);
|
|
37
|
+
return antfu(
|
|
38
|
+
config,
|
|
39
|
+
{
|
|
40
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
41
|
+
rules,
|
|
42
|
+
languageOptions: {
|
|
43
|
+
parserOptions: {
|
|
44
|
+
emitDecoratorMetadata: true,
|
|
45
|
+
experimentalDecorators: true,
|
|
46
|
+
},
|
|
47
|
+
globals: globalsMy,
|
|
40
48
|
},
|
|
41
|
-
globals: globalsMy,
|
|
42
49
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
{
|
|
51
|
+
files: ['**/*.vue'],
|
|
52
|
+
rules: Object.assign({}, rules, rulesVue),
|
|
53
|
+
languageOptions: {
|
|
54
|
+
globals: globalsMy,
|
|
55
|
+
},
|
|
48
56
|
},
|
|
49
|
-
|
|
57
|
+
...args,
|
|
58
|
+
);
|
|
50
59
|
}
|
package/index.js
ADDED
package/oxc/format.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const _configDefault = {
|
|
2
|
+
printWidth: 150,
|
|
3
|
+
tabWidth: 2,
|
|
4
|
+
useTabs: false,
|
|
5
|
+
semi: true,
|
|
6
|
+
singleQuote: true,
|
|
7
|
+
jsxSingleQuote: false,
|
|
8
|
+
bracketSpacing: true,
|
|
9
|
+
trailingComma: 'all',
|
|
10
|
+
arrowParens: 'avoid',
|
|
11
|
+
quoteProps: 'consistent',
|
|
12
|
+
sortImports: {
|
|
13
|
+
groups: [
|
|
14
|
+
'type-import',
|
|
15
|
+
['value-builtin', 'value-external'],
|
|
16
|
+
'type-internal',
|
|
17
|
+
'value-internal',
|
|
18
|
+
['type-parent', 'type-sibling', 'type-index'],
|
|
19
|
+
['value-parent', 'value-sibling', 'value-index'],
|
|
20
|
+
'unknown',
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
sortPackageJson: true,
|
|
24
|
+
overrides: [
|
|
25
|
+
{
|
|
26
|
+
files: ['*.json'],
|
|
27
|
+
options: {
|
|
28
|
+
printWidth: 80,
|
|
29
|
+
trailingComma: 'none',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export function oxcFormatConfig(configCustom) {
|
|
36
|
+
return Object.assign({}, _configDefault, configCustom);
|
|
37
|
+
}
|