@cabloy/lint 4.0.20 → 5.0.1
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 +63 -26
- package/api/prettier.js +1 -1
- package/api/tsconfig.base.cjs.json +17 -17
- package/api/tsconfig.base.esm.json +1 -1
- package/common/rules.js +66 -47
- package/common/rulesVue.js +4 -0
- package/front/eslint.js +106 -36
- package/front/prettier.js +2 -2
- package/front/tsconfig.base.cjs.json +1 -1
- package/package.json +12 -13
package/api/eslint.js
CHANGED
|
@@ -1,27 +1,64 @@
|
|
|
1
|
-
|
|
1
|
+
import antfu from '@antfu/eslint-config';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import { rules } from '../common/rules.js';
|
|
2
4
|
|
|
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
|
-
|
|
5
|
+
export default function eslintConfig(config, ...args) {
|
|
6
|
+
config = Object.assign({
|
|
7
|
+
stylistic: {
|
|
8
|
+
indent: 2,
|
|
9
|
+
quotes: 'single',
|
|
10
|
+
semi: true,
|
|
11
|
+
jsx: true,
|
|
12
|
+
},
|
|
13
|
+
typescript: true,
|
|
14
|
+
}, config);
|
|
15
|
+
return antfu(config, {
|
|
16
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
17
|
+
rules,
|
|
18
|
+
languageOptions: {
|
|
19
|
+
globals: {
|
|
20
|
+
...globals.node,
|
|
21
|
+
...globals.jest,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}, ...args);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// export default function eslintConfig(config, ...args) {
|
|
28
|
+
// return [
|
|
29
|
+
// ...tseslint.configs.recommended,
|
|
30
|
+
// stylistic.configs.customize({
|
|
31
|
+
// flat: true,
|
|
32
|
+
// indent: 2,
|
|
33
|
+
// quotes: 'single',
|
|
34
|
+
// semi: true,
|
|
35
|
+
// jsx: true,
|
|
36
|
+
// }),
|
|
37
|
+
// {
|
|
38
|
+
// files,
|
|
39
|
+
// languageOptions: {
|
|
40
|
+
// parser: parserTs,
|
|
41
|
+
// parserOptions: {
|
|
42
|
+
// ecmaFeatures: {
|
|
43
|
+
// jsx: true,
|
|
44
|
+
// tsx: true,
|
|
45
|
+
// },
|
|
46
|
+
// ecmaVersion: 'latest',
|
|
47
|
+
// useJSXTextNode: true,
|
|
48
|
+
// sourceType: 'module',
|
|
49
|
+
// },
|
|
50
|
+
// globals: {
|
|
51
|
+
// ...globals.node,
|
|
52
|
+
// ...globals.jest,
|
|
53
|
+
// },
|
|
54
|
+
// },
|
|
55
|
+
// rules,
|
|
56
|
+
// },
|
|
57
|
+
// {
|
|
58
|
+
// files: ['**/*.json'],
|
|
59
|
+
// ignores: ['package-lock.json'],
|
|
60
|
+
// language: 'json/json',
|
|
61
|
+
// ...json.configs.recommended,
|
|
62
|
+
// },
|
|
63
|
+
// ];
|
|
64
|
+
// }
|
package/api/prettier.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"composite": true,
|
|
4
3
|
"incremental": true,
|
|
5
|
-
"
|
|
6
|
-
"declarationMap": true,
|
|
7
|
-
"sourceMap": true,
|
|
8
|
-
"noEmit": false,
|
|
9
|
-
"noEmitOnError": true,
|
|
4
|
+
"composite": true,
|
|
10
5
|
"target": "ES2020",
|
|
6
|
+
"useDefineForClassFields": true,
|
|
7
|
+
"emitDecoratorMetadata": true,
|
|
8
|
+
"experimentalDecorators": true,
|
|
11
9
|
"module": "NodeNext",
|
|
12
10
|
"moduleResolution": "NodeNext",
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"resolvePackageJsonImports": true,
|
|
13
|
+
"allowJs": false,
|
|
14
|
+
"checkJs": false,
|
|
13
15
|
"strict": true,
|
|
16
|
+
"strictPropertyInitialization": false,
|
|
14
17
|
"noImplicitAny": false,
|
|
15
18
|
"noUnusedLocals": true,
|
|
16
19
|
"noUnusedParameters": true,
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"allowSyntheticDefaultImports": true,
|
|
20
|
+
"declaration": true,
|
|
21
|
+
"declarationMap": true,
|
|
22
|
+
"noEmit": false,
|
|
23
|
+
"noEmitOnError": true,
|
|
24
|
+
"sourceMap": true,
|
|
23
25
|
"stripInternal": true,
|
|
26
|
+
"allowSyntheticDefaultImports": true,
|
|
24
27
|
"esModuleInterop": true,
|
|
28
|
+
"forceConsistentCasingInFileNames": true,
|
|
25
29
|
"isolatedModules": true,
|
|
26
|
-
"
|
|
27
|
-
"emitDecoratorMetadata": true,
|
|
28
|
-
"allowJs": false,
|
|
29
|
-
"checkJs": false,
|
|
30
|
-
"skipLibCheck": true,
|
|
30
|
+
"skipLibCheck": true
|
|
31
31
|
}
|
|
32
32
|
}
|
package/common/rules.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
const rules = {
|
|
2
|
-
'
|
|
1
|
+
export const rules = {
|
|
2
|
+
'no-extend-native': ['error', { exceptions: ['Set'] }],
|
|
3
|
+
'no-new-func': 'off',
|
|
4
|
+
'regexp/no-super-linear-backtracking': 'off',
|
|
5
|
+
'no-template-curly-in-string': 'off',
|
|
6
|
+
'n/prefer-global/process': 'off',
|
|
7
|
+
'unicorn/error-message': 'off',
|
|
8
|
+
'antfu/if-newline': 'off',
|
|
9
|
+
'import/no-duplicates': 'off',
|
|
10
|
+
'eslint-comments/no-unlimited-disable': 'off',
|
|
3
11
|
'prefer-promise-reject-errors': 'off',
|
|
4
|
-
|
|
5
|
-
'
|
|
6
|
-
'error',
|
|
7
|
-
'single',
|
|
8
|
-
{
|
|
9
|
-
avoidEscape: true,
|
|
10
|
-
},
|
|
11
|
-
],
|
|
12
|
-
// this rule, if on, would require explicit return type on the `render` function
|
|
13
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
14
|
-
'vue/multi-word-component-names': 'off',
|
|
15
|
-
'vue/prefer-import-from-vue': 'off',
|
|
16
|
-
'@typescript-eslint/no-namespace': 'off',
|
|
17
|
-
|
|
18
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
12
|
+
'no-console': 'warn',
|
|
13
|
+
'no-debugger': 'warn',
|
|
19
14
|
'prefer-const': [
|
|
20
15
|
'error',
|
|
21
16
|
{
|
|
@@ -23,20 +18,6 @@ const rules = {
|
|
|
23
18
|
ignoreReadBeforeAssign: true,
|
|
24
19
|
},
|
|
25
20
|
],
|
|
26
|
-
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
27
|
-
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
28
|
-
'max-len': [
|
|
29
|
-
'error',
|
|
30
|
-
{
|
|
31
|
-
code: 120,
|
|
32
|
-
ignoreComments: true,
|
|
33
|
-
ignoreTrailingComments: true,
|
|
34
|
-
ignoreUrls: true,
|
|
35
|
-
ignoreStrings: true,
|
|
36
|
-
ignoreTemplateLiterals: true,
|
|
37
|
-
ignoreRegExpLiterals: true,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
21
|
'no-undef': [
|
|
41
22
|
'error',
|
|
42
23
|
{
|
|
@@ -77,8 +58,27 @@ const rules = {
|
|
|
77
58
|
'space-before-function-paren': [0],
|
|
78
59
|
'generator-star-spacing': [0],
|
|
79
60
|
'newline-per-chained-call': [0],
|
|
80
|
-
'
|
|
61
|
+
'prefer-rest-params': 'off',
|
|
62
|
+
// 'no-setter-return': 'off', // no effect for typescript check
|
|
63
|
+
'ts/method-signature-style': 'off',
|
|
64
|
+
'ts/no-redeclare': 'off',
|
|
65
|
+
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
|
|
66
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
67
|
+
'@typescript-eslint/no-namespace': 'off',
|
|
68
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
81
69
|
'@typescript-eslint/no-var-requires': 'off',
|
|
70
|
+
'unused-imports/no-unused-vars': [
|
|
71
|
+
'error',
|
|
72
|
+
{
|
|
73
|
+
args: 'all',
|
|
74
|
+
argsIgnorePattern: '^_',
|
|
75
|
+
caughtErrors: 'all',
|
|
76
|
+
caughtErrorsIgnorePattern: '^_',
|
|
77
|
+
destructuredArrayIgnorePattern: '^_',
|
|
78
|
+
varsIgnorePattern: '^_',
|
|
79
|
+
ignoreRestSiblings: true,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
82
|
'@typescript-eslint/no-unused-vars': [
|
|
83
83
|
'error',
|
|
84
84
|
{
|
|
@@ -100,19 +100,38 @@ const rules = {
|
|
|
100
100
|
'ts-ignore': 'allow-with-description',
|
|
101
101
|
},
|
|
102
102
|
],
|
|
103
|
-
'@typescript-eslint/
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
103
|
+
'@typescript-eslint/no-empty-object-type': 'off',
|
|
104
|
+
'@typescript-eslint/no-unsafe-function-type': 'off',
|
|
105
|
+
'@stylistic/max-len': ['error', {
|
|
106
|
+
code: 130,
|
|
107
|
+
tabWidth: 2,
|
|
108
|
+
ignoreComments: true,
|
|
109
|
+
ignoreTrailingComments: true,
|
|
110
|
+
ignoreUrls: true,
|
|
111
|
+
ignoreStrings: true,
|
|
112
|
+
ignoreTemplateLiterals: true,
|
|
113
|
+
ignoreRegExpLiterals: true,
|
|
114
|
+
}],
|
|
115
|
+
'@stylistic/arrow-parens': ['error', 'as-needed'],
|
|
116
|
+
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
117
|
+
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
|
|
118
|
+
'@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
|
|
119
|
+
'@stylistic/keyword-spacing': ['error', { overrides: {
|
|
120
|
+
this: { before: true },
|
|
121
|
+
} }],
|
|
122
|
+
'@stylistic/indent': ['error', 2, {
|
|
123
|
+
SwitchCase: 1,
|
|
124
|
+
VariableDeclarator: 'first',
|
|
125
|
+
outerIIFEBody: 1,
|
|
126
|
+
MemberExpression: 1,
|
|
127
|
+
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
128
|
+
FunctionExpression: { body: 1, parameters: 1 },
|
|
129
|
+
StaticBlock: { body: 1 },
|
|
130
|
+
CallExpression: { arguments: 1 },
|
|
131
|
+
ArrayExpression: 1,
|
|
132
|
+
ObjectExpression: 1,
|
|
133
|
+
ImportDeclaration: 1,
|
|
134
|
+
flatTernaryExpressions: true,
|
|
135
|
+
offsetTernaryExpressions: true,
|
|
136
|
+
}],
|
|
116
137
|
};
|
|
117
|
-
|
|
118
|
-
module.exports = rules;
|
package/front/eslint.js
CHANGED
|
@@ -1,37 +1,107 @@
|
|
|
1
|
-
|
|
1
|
+
import antfu from '@antfu/eslint-config';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import { rules } from '../common/rules.js';
|
|
4
|
+
import { rulesVue } from '../common/rulesVue.js';
|
|
2
5
|
|
|
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
|
-
|
|
6
|
+
export default function eslintConfig(config, ...args) {
|
|
7
|
+
config = Object.assign({
|
|
8
|
+
stylistic: {
|
|
9
|
+
indent: 2,
|
|
10
|
+
quotes: 'single',
|
|
11
|
+
semi: true,
|
|
12
|
+
jsx: true,
|
|
13
|
+
},
|
|
14
|
+
typescript: true,
|
|
15
|
+
vue: true,
|
|
16
|
+
}, config);
|
|
17
|
+
return antfu(config, {
|
|
18
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
19
|
+
rules,
|
|
20
|
+
languageOptions: {
|
|
21
|
+
globals: {
|
|
22
|
+
...globals.node,
|
|
23
|
+
...globals.jest,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}, {
|
|
27
|
+
files: ['**/*.vue'],
|
|
28
|
+
rules: Object.assign({}, rules, rulesVue),
|
|
29
|
+
languageOptions: {
|
|
30
|
+
globals: {
|
|
31
|
+
...globals.browser,
|
|
32
|
+
...globals.jest,
|
|
33
|
+
ga: 'readonly', // Google Analytics
|
|
34
|
+
cordova: 'readonly',
|
|
35
|
+
__statics: 'readonly',
|
|
36
|
+
__QUASAR_SSR__: 'readonly',
|
|
37
|
+
__QUASAR_SSR_SERVER__: 'readonly',
|
|
38
|
+
__QUASAR_SSR_CLIENT__: 'readonly',
|
|
39
|
+
__QUASAR_SSR_PWA__: 'readonly',
|
|
40
|
+
process: 'readonly',
|
|
41
|
+
Capacitor: 'readonly',
|
|
42
|
+
chrome: 'readonly',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
}, ...args);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// export default [
|
|
49
|
+
// ...tseslint.configs.recommended,
|
|
50
|
+
// ...eslintVue.configs['flat/recommended'],
|
|
51
|
+
// stylistic.configs.customize({
|
|
52
|
+
// indent: 2,
|
|
53
|
+
// quotes: 'single',
|
|
54
|
+
// semi: true,
|
|
55
|
+
// jsx: true,
|
|
56
|
+
// }),
|
|
57
|
+
// {
|
|
58
|
+
// languageOptions: {
|
|
59
|
+
// parser: vueParser,
|
|
60
|
+
// parserOptions: {
|
|
61
|
+
// extraFileExtensions: ['.vue'],
|
|
62
|
+
// ecmaFeatures: {
|
|
63
|
+
// jsx: true,
|
|
64
|
+
// tsx: true,
|
|
65
|
+
// },
|
|
66
|
+
// ecmaVersion: 'latest',
|
|
67
|
+
// useJSXTextNode: true,
|
|
68
|
+
// sourceType: 'module',
|
|
69
|
+
// parser: parserTs,
|
|
70
|
+
// },
|
|
71
|
+
// globals: {
|
|
72
|
+
// ...globals.browser,
|
|
73
|
+
// ...globals.jest,
|
|
74
|
+
// ga: 'readonly', // Google Analytics
|
|
75
|
+
// cordova: 'readonly',
|
|
76
|
+
// __statics: 'readonly',
|
|
77
|
+
// __QUASAR_SSR__: 'readonly',
|
|
78
|
+
// __QUASAR_SSR_SERVER__: 'readonly',
|
|
79
|
+
// __QUASAR_SSR_CLIENT__: 'readonly',
|
|
80
|
+
// __QUASAR_SSR_PWA__: 'readonly',
|
|
81
|
+
// process: 'readonly',
|
|
82
|
+
// Capacitor: 'readonly',
|
|
83
|
+
// chrome: 'readonly',
|
|
84
|
+
// // $: true,
|
|
85
|
+
// // util: true,
|
|
86
|
+
// // env: true,
|
|
87
|
+
// // App: true,
|
|
88
|
+
// // getApp: true,
|
|
89
|
+
// // Page: true,
|
|
90
|
+
// // wx: true,
|
|
91
|
+
// // define: true,
|
|
92
|
+
// Proxy: true,
|
|
93
|
+
// },
|
|
94
|
+
// },
|
|
95
|
+
// rules: Object.assign({}, rules, rulesVue),
|
|
96
|
+
// },
|
|
97
|
+
// {
|
|
98
|
+
// plugins: {
|
|
99
|
+
// json,
|
|
100
|
+
// },
|
|
101
|
+
// files: ['**/*.json'],
|
|
102
|
+
// language: 'json/json',
|
|
103
|
+
// rules: {
|
|
104
|
+
// 'json/no-duplicate-keys': 'error',
|
|
105
|
+
// },
|
|
106
|
+
// },
|
|
107
|
+
// ];
|
package/front/prettier.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import config from '../api/prettier.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default config;
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabloy/lint",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "5.0.1",
|
|
5
|
+
"description": "Node Style Guide for Cabloy.",
|
|
5
6
|
"publishConfig": {
|
|
6
7
|
"access": "public"
|
|
7
8
|
},
|
|
@@ -11,15 +12,13 @@
|
|
|
11
12
|
"front"
|
|
12
13
|
],
|
|
13
14
|
"dependencies": {
|
|
14
|
-
"@
|
|
15
|
-
"@
|
|
16
|
-
"eslint": "^
|
|
17
|
-
"eslint
|
|
18
|
-
"eslint-plugin-
|
|
19
|
-
"
|
|
20
|
-
"eslint
|
|
21
|
-
"eslint-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
"gitHead": "2d40c063c115b230fdbc89f5a78b4412ebd0dfc9"
|
|
15
|
+
"@antfu/eslint-config": "^4.2.1",
|
|
16
|
+
"@eslint/json": "^0.10.0",
|
|
17
|
+
"@stylistic/eslint-plugin": "^3.1.0",
|
|
18
|
+
"@typescript-eslint/parser": "^8.24.0",
|
|
19
|
+
"eslint-plugin-vue": "^9.32.0",
|
|
20
|
+
"globals": "^15.15.0",
|
|
21
|
+
"typescript-eslint": "^8.24.0",
|
|
22
|
+
"vue-eslint-parser": "^9.4.3"
|
|
23
|
+
}
|
|
25
24
|
}
|