@cabloy/lint 4.0.19 → 5.0.0
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 +33 -25
- package/api/prettier.js +1 -1
- package/common/rules.js +40 -45
- package/common/rulesVue.js +4 -0
- package/front/eslint.js +57 -35
- package/front/prettier.js +2 -2
- package/package.json +10 -13
package/api/eslint.js
CHANGED
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
2
|
+
import parserTs from '@typescript-eslint/parser';
|
|
3
|
+
import tseslint from 'typescript-eslint';
|
|
4
|
+
import globals from 'globals';
|
|
5
|
+
import { rules } from '../common/rules.js';
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
export default [
|
|
8
|
+
...tseslint.configs.recommended,
|
|
9
|
+
stylistic.configs.customize({
|
|
10
|
+
flat: true,
|
|
11
|
+
indent: 2,
|
|
12
|
+
quotes: 'single',
|
|
13
|
+
semi: true,
|
|
14
|
+
jsx: true,
|
|
15
|
+
}),
|
|
16
|
+
{
|
|
17
|
+
languageOptions: {
|
|
18
|
+
parser: parserTs,
|
|
19
|
+
parserOptions: {
|
|
20
|
+
ecmaFeatures: {
|
|
21
|
+
jsx: true,
|
|
22
|
+
tsx: true,
|
|
23
|
+
},
|
|
24
|
+
ecmaVersion: 'latest',
|
|
25
|
+
useJSXTextNode: true,
|
|
26
|
+
sourceType: 'module',
|
|
27
|
+
},
|
|
28
|
+
globals: {
|
|
29
|
+
...globals.node,
|
|
30
|
+
...globals.jest,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
rules,
|
|
8
34
|
},
|
|
9
|
-
|
|
10
|
-
env: {
|
|
11
|
-
browser: true,
|
|
12
|
-
es2021: true,
|
|
13
|
-
node: true,
|
|
14
|
-
mocha: true,
|
|
15
|
-
},
|
|
16
|
-
globals: {
|
|
17
|
-
// $: true,
|
|
18
|
-
// util: true,
|
|
19
|
-
// env: true,
|
|
20
|
-
// App: true,
|
|
21
|
-
// getApp: true,
|
|
22
|
-
// Page: true,
|
|
23
|
-
// wx: true,
|
|
24
|
-
// define: true,
|
|
25
|
-
Proxy: true,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
35
|
+
];
|
package/api/prettier.js
CHANGED
package/common/rules.js
CHANGED
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
const rules = {
|
|
2
|
-
'prettier/prettier': ['error', { singleQuote: true }],
|
|
1
|
+
export const rules = {
|
|
3
2
|
'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',
|
|
3
|
+
'no-console': 'warn',
|
|
4
|
+
'no-debugger': 'warn',
|
|
19
5
|
'prefer-const': [
|
|
20
6
|
'error',
|
|
21
7
|
{
|
|
@@ -23,20 +9,6 @@ const rules = {
|
|
|
23
9
|
ignoreReadBeforeAssign: true,
|
|
24
10
|
},
|
|
25
11
|
],
|
|
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
12
|
'no-undef': [
|
|
41
13
|
'error',
|
|
42
14
|
{
|
|
@@ -77,7 +49,12 @@ const rules = {
|
|
|
77
49
|
'space-before-function-paren': [0],
|
|
78
50
|
'generator-star-spacing': [0],
|
|
79
51
|
'newline-per-chained-call': [0],
|
|
80
|
-
'
|
|
52
|
+
'prefer-rest-params': 'off',
|
|
53
|
+
// 'no-setter-return': 'off', // no effect for typescript check
|
|
54
|
+
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
|
|
55
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
56
|
+
'@typescript-eslint/no-namespace': 'off',
|
|
57
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
81
58
|
'@typescript-eslint/no-var-requires': 'off',
|
|
82
59
|
'@typescript-eslint/no-unused-vars': [
|
|
83
60
|
'error',
|
|
@@ -100,17 +77,35 @@ const rules = {
|
|
|
100
77
|
'ts-ignore': 'allow-with-description',
|
|
101
78
|
},
|
|
102
79
|
],
|
|
103
|
-
'@typescript-eslint/
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
],
|
|
80
|
+
'@typescript-eslint/no-empty-object-type': 'off',
|
|
81
|
+
'@typescript-eslint/no-unsafe-function-type': 'off',
|
|
82
|
+
'@stylistic/max-len': ['error', {
|
|
83
|
+
code: 130, tabWidth: 2,
|
|
84
|
+
ignoreComments: true,
|
|
85
|
+
ignoreTrailingComments: true,
|
|
86
|
+
ignoreUrls: true,
|
|
87
|
+
ignoreStrings: true,
|
|
88
|
+
ignoreTemplateLiterals: true,
|
|
89
|
+
ignoreRegExpLiterals: true,
|
|
90
|
+
}],
|
|
91
|
+
'@stylistic/arrow-parens': ['error', 'as-needed'],
|
|
92
|
+
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
93
|
+
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
|
|
94
|
+
'@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
|
|
95
|
+
'@stylistic/keyword-spacing': ['error', { overrides: {
|
|
96
|
+
this: { before: true },
|
|
97
|
+
} }],
|
|
98
|
+
'@stylistic/indent': ['error', 2, {
|
|
99
|
+
SwitchCase: 1, VariableDeclarator: 'first', outerIIFEBody: 1,
|
|
100
|
+
MemberExpression: 1,
|
|
101
|
+
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
102
|
+
FunctionExpression: { body: 1, parameters: 1 },
|
|
103
|
+
StaticBlock: { body: 1 },
|
|
104
|
+
CallExpression: { arguments: 1 },
|
|
105
|
+
ArrayExpression: 1,
|
|
106
|
+
ObjectExpression: 1,
|
|
107
|
+
ImportDeclaration: 1,
|
|
108
|
+
flatTernaryExpressions: true,
|
|
109
|
+
offsetTernaryExpressions: true,
|
|
110
|
+
}],
|
|
114
111
|
};
|
|
115
|
-
|
|
116
|
-
module.exports = rules;
|
package/front/eslint.js
CHANGED
|
@@ -1,37 +1,59 @@
|
|
|
1
|
-
|
|
1
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
2
|
+
import vueParser from 'vue-eslint-parser';
|
|
3
|
+
import parserTs from '@typescript-eslint/parser';
|
|
4
|
+
import tseslint from 'typescript-eslint';
|
|
5
|
+
import eslintVue from 'eslint-plugin-vue';
|
|
6
|
+
import globals from 'globals';
|
|
7
|
+
import { rules } from '../common/rules.js';
|
|
8
|
+
import { rulesVue } from '../common/rulesVue.js';
|
|
2
9
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
export default [
|
|
11
|
+
...tseslint.configs.recommended,
|
|
12
|
+
...eslintVue.configs['flat/recommended'],
|
|
13
|
+
stylistic.configs.customize({
|
|
14
|
+
indent: 2,
|
|
15
|
+
quotes: 'single',
|
|
16
|
+
semi: true,
|
|
17
|
+
jsx: true,
|
|
18
|
+
}),
|
|
19
|
+
{
|
|
20
|
+
languageOptions: {
|
|
21
|
+
parser: vueParser,
|
|
22
|
+
parserOptions: {
|
|
23
|
+
extraFileExtensions: ['.vue'],
|
|
24
|
+
ecmaFeatures: {
|
|
25
|
+
jsx: true,
|
|
26
|
+
tsx: true,
|
|
27
|
+
},
|
|
28
|
+
ecmaVersion: 'latest',
|
|
29
|
+
useJSXTextNode: true,
|
|
30
|
+
sourceType: 'module',
|
|
31
|
+
parser: parserTs,
|
|
32
|
+
},
|
|
33
|
+
globals: {
|
|
34
|
+
...globals.browser,
|
|
35
|
+
...globals.jest,
|
|
36
|
+
ga: 'readonly', // Google Analytics
|
|
37
|
+
cordova: 'readonly',
|
|
38
|
+
__statics: 'readonly',
|
|
39
|
+
__QUASAR_SSR__: 'readonly',
|
|
40
|
+
__QUASAR_SSR_SERVER__: 'readonly',
|
|
41
|
+
__QUASAR_SSR_CLIENT__: 'readonly',
|
|
42
|
+
__QUASAR_SSR_PWA__: 'readonly',
|
|
43
|
+
process: 'readonly',
|
|
44
|
+
Capacitor: 'readonly',
|
|
45
|
+
chrome: 'readonly',
|
|
46
|
+
// $: true,
|
|
47
|
+
// util: true,
|
|
48
|
+
// env: true,
|
|
49
|
+
// App: true,
|
|
50
|
+
// getApp: true,
|
|
51
|
+
// Page: true,
|
|
52
|
+
// wx: true,
|
|
53
|
+
// define: true,
|
|
54
|
+
Proxy: true,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
rules: Object.assign({}, rules, rulesVue),
|
|
9
58
|
},
|
|
10
|
-
|
|
11
|
-
env: {
|
|
12
|
-
browser: true,
|
|
13
|
-
es2021: true,
|
|
14
|
-
node: true,
|
|
15
|
-
},
|
|
16
|
-
globals: {
|
|
17
|
-
ga: 'readonly', // Google Analytics
|
|
18
|
-
cordova: 'readonly',
|
|
19
|
-
__statics: 'readonly',
|
|
20
|
-
__QUASAR_SSR__: 'readonly',
|
|
21
|
-
__QUASAR_SSR_SERVER__: 'readonly',
|
|
22
|
-
__QUASAR_SSR_CLIENT__: 'readonly',
|
|
23
|
-
__QUASAR_SSR_PWA__: 'readonly',
|
|
24
|
-
process: 'readonly',
|
|
25
|
-
Capacitor: 'readonly',
|
|
26
|
-
chrome: 'readonly',
|
|
27
|
-
// $: true,
|
|
28
|
-
// util: true,
|
|
29
|
-
// env: true,
|
|
30
|
-
// App: true,
|
|
31
|
-
// getApp: true,
|
|
32
|
-
// Page: true,
|
|
33
|
-
// wx: true,
|
|
34
|
-
// define: true,
|
|
35
|
-
Proxy: true,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
59
|
+
];
|
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,25 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabloy/lint",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Node Style Guide for
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"description": "Node Style Guide for Cabloy.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
+
"type": "module",
|
|
8
9
|
"files": [
|
|
9
10
|
"api",
|
|
10
11
|
"common",
|
|
11
12
|
"front"
|
|
12
13
|
],
|
|
13
14
|
"dependencies": {
|
|
14
|
-
"@
|
|
15
|
-
"@typescript-eslint/parser": "^
|
|
16
|
-
"eslint": "^
|
|
17
|
-
"
|
|
18
|
-
"eslint
|
|
19
|
-
"eslint-
|
|
20
|
-
|
|
21
|
-
"eslint-plugin-vue": "9.26.0",
|
|
22
|
-
"prettier": "^3.2.5"
|
|
23
|
-
},
|
|
24
|
-
"gitHead": "2d40c063c115b230fdbc89f5a78b4412ebd0dfc9"
|
|
15
|
+
"@stylistic/eslint-plugin": "^3.1.0",
|
|
16
|
+
"@typescript-eslint/parser": "^8.24.0",
|
|
17
|
+
"eslint-plugin-vue": "^9.32.0",
|
|
18
|
+
"globals": "^15.15.0",
|
|
19
|
+
"typescript-eslint": "^8.24.0",
|
|
20
|
+
"vue-eslint-parser": "^9.4.3"
|
|
21
|
+
}
|
|
25
22
|
}
|