@jobscale/eslint-plugin-standard 0.0.1 → 0.0.3
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/index.js +74 -19
- package/package.json +5 -3
- package/rules/best-practices.js +4 -4
- package/rules/errors.js +1 -1
- package/rules/es6.js +6 -6
- package/rules/node.js +2 -2
- package/rules/strict.js +2 -2
package/index.js
CHANGED
|
@@ -1,39 +1,94 @@
|
|
|
1
|
-
import globals from
|
|
2
|
-
import pluginJs from
|
|
1
|
+
import globals from 'globals';
|
|
2
|
+
import pluginJs from '@eslint/js';
|
|
3
|
+
import importPlugin from 'eslint-plugin-import';
|
|
4
|
+
import airbnbPractices from './rules/best-practices.js';
|
|
5
|
+
import airbnbStrict from './rules/strict.js';
|
|
6
|
+
import airbnbEs6 from './rules/es6.js';
|
|
7
|
+
import airbnbErrors from './rules/errors.js';
|
|
8
|
+
import airbnbNode from './rules/node.js';
|
|
3
9
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
const rules = {
|
|
11
|
+
indent: ['error', 2, { MemberExpression: 0 }],
|
|
12
|
+
quotes: ['error', 'single', { avoidEscape: true }],
|
|
13
|
+
camelcase: ['error', { properties: 'never' }],
|
|
14
|
+
semi: ['error', 'always'],
|
|
15
|
+
eqeqeq: ['error', 'always'],
|
|
16
|
+
'class-methods-use-this': 'off',
|
|
17
|
+
'no-await-in-loop': 'off',
|
|
18
|
+
'no-confusing-arrow': 'off',
|
|
19
|
+
'arrow-parens': 'off',
|
|
20
|
+
'comma-dangle': ['error', 'always-multiline'],
|
|
21
|
+
'quote-props': ['error', 'as-needed'],
|
|
22
|
+
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
|
|
23
|
+
'padded-blocks': ['error', 'never'],
|
|
24
|
+
'linebreak-style': ['error', 'unix'],
|
|
25
|
+
'no-trailing-spaces': ['error'],
|
|
26
|
+
'object-curly-newline': ['error', {
|
|
27
|
+
ObjectExpression: { minProperties: 6, multiline: true, consistent: true },
|
|
28
|
+
ObjectPattern: { minProperties: 6, multiline: true, consistent: true },
|
|
29
|
+
ImportDeclaration: { minProperties: 6, multiline: true, consistent: true },
|
|
30
|
+
ExportDeclaration: { minProperties: 6, multiline: true, consistent: true },
|
|
31
|
+
}],
|
|
32
|
+
|
|
33
|
+
// --- JavaScript coding style rule ---
|
|
34
|
+
'array-bracket-spacing': ['error', 'never'],
|
|
35
|
+
'block-spacing': ['error', 'always'],
|
|
36
|
+
'comma-spacing': ['error', { before: false, after: true }],
|
|
37
|
+
'func-call-spacing': ['error', 'never'],
|
|
38
|
+
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
|
39
|
+
'keyword-spacing': ['error', { before: true, after: true }],
|
|
40
|
+
'lines-between-class-members': ['error', 'always'],
|
|
41
|
+
'no-debugger': ['error'],
|
|
42
|
+
'no-multi-spaces': ['error'],
|
|
43
|
+
'object-curly-spacing': ['error', 'always'],
|
|
44
|
+
'space-before-blocks': ['error', 'always'],
|
|
45
|
+
'space-in-parens': ['error', 'never'],
|
|
46
|
+
'space-infix-ops': ['error'],
|
|
47
|
+
'spaced-comment': ['error', 'always'],
|
|
48
|
+
'no-shadow': 'error',
|
|
49
|
+
'no-console': ['warn'],
|
|
50
|
+
'no-restricted-syntax': ['error', {
|
|
51
|
+
selector: "CallExpression[callee.name='Number']",
|
|
52
|
+
message: 'using to Number.parseInt, Number.parseFloat',
|
|
53
|
+
}],
|
|
54
|
+
|
|
55
|
+
// --- import rule ---
|
|
56
|
+
'import/named': ['error'],
|
|
57
|
+
'import/default': ['error'],
|
|
58
|
+
'import/order': ['error'],
|
|
59
|
+
'import/no-duplicates': ['error'],
|
|
60
|
+
'import/newline-after-import': ['error'],
|
|
61
|
+
'import/no-mutable-exports': ['error'],
|
|
62
|
+
};
|
|
9
63
|
|
|
10
64
|
const recommended = {
|
|
11
|
-
name:
|
|
12
|
-
files: [
|
|
65
|
+
name: 'eslint-plugin-standard/recommended',
|
|
66
|
+
files: ['**/*.{js,mjs,cjs}'],
|
|
13
67
|
languageOptions: {
|
|
14
68
|
ecmaVersion: 'latest',
|
|
15
|
-
sourceType:
|
|
69
|
+
sourceType: 'module',
|
|
16
70
|
globals: {
|
|
17
71
|
...globals.browser,
|
|
18
72
|
...globals.node,
|
|
19
73
|
...globals.jest,
|
|
20
74
|
},
|
|
21
75
|
},
|
|
76
|
+
plugins: {
|
|
77
|
+
import: importPlugin,
|
|
78
|
+
},
|
|
22
79
|
rules: {
|
|
23
|
-
...
|
|
24
|
-
...
|
|
25
|
-
...
|
|
26
|
-
...
|
|
27
|
-
...
|
|
28
|
-
|
|
29
|
-
"class-methods-use-this": "off",
|
|
30
|
-
"no-await-in-loop": "off",
|
|
31
|
-
"arrow-parens": "off",
|
|
80
|
+
...airbnbPractices.rules,
|
|
81
|
+
...airbnbStrict.rules,
|
|
82
|
+
...airbnbEs6.rules,
|
|
83
|
+
...airbnbErrors.rules,
|
|
84
|
+
...airbnbNode.rules,
|
|
85
|
+
...rules,
|
|
32
86
|
},
|
|
33
87
|
};
|
|
34
88
|
|
|
35
89
|
const standard = {
|
|
36
90
|
...recommended,
|
|
91
|
+
name: 'eslint-plugin-standard/standard',
|
|
37
92
|
rules: {
|
|
38
93
|
...pluginJs.configs.recommended.rules,
|
|
39
94
|
...recommended.rules,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobscale/eslint-plugin-standard",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "eslint plugin standard",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -18,12 +18,14 @@
|
|
|
18
18
|
"lint": "eslint",
|
|
19
19
|
"test": "npm run lint"
|
|
20
20
|
},
|
|
21
|
-
"pre-commit": [
|
|
21
|
+
"pre-commit": [
|
|
22
|
+
"test"
|
|
23
|
+
],
|
|
22
24
|
"dependencies": {
|
|
23
25
|
"eslint-plugin-import": "^2"
|
|
24
26
|
},
|
|
25
27
|
"devDependencies": {
|
|
26
28
|
"eslint": "^9",
|
|
27
|
-
"
|
|
29
|
+
"pre-commit": "^1"
|
|
28
30
|
}
|
|
29
31
|
}
|
package/rules/best-practices.js
CHANGED
|
@@ -96,7 +96,7 @@ export default {
|
|
|
96
96
|
'arrowFunctions',
|
|
97
97
|
'functions',
|
|
98
98
|
'methods',
|
|
99
|
-
]
|
|
99
|
+
],
|
|
100
100
|
}],
|
|
101
101
|
|
|
102
102
|
// disallow empty destructuring patterns
|
|
@@ -237,7 +237,7 @@ export default {
|
|
|
237
237
|
'response', // for Express responses
|
|
238
238
|
'$scope', // for Angular 1 scopes
|
|
239
239
|
'staticContext', // for ReactRouter context
|
|
240
|
-
]
|
|
240
|
+
],
|
|
241
241
|
}],
|
|
242
242
|
|
|
243
243
|
// disallow usage of __proto__ property
|
|
@@ -403,6 +403,6 @@ export default {
|
|
|
403
403
|
|
|
404
404
|
// require or disallow Yoda conditions
|
|
405
405
|
// https://eslint.org/docs/rules/yoda
|
|
406
|
-
yoda: 'error'
|
|
407
|
-
}
|
|
406
|
+
yoda: 'error',
|
|
407
|
+
},
|
|
408
408
|
};
|
package/rules/errors.js
CHANGED
package/rules/es6.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
env: {
|
|
3
|
-
es6: true
|
|
3
|
+
es6: true,
|
|
4
4
|
},
|
|
5
5
|
parserOptions: {
|
|
6
6
|
ecmaVersion: 6,
|
|
7
7
|
sourceType: 'module',
|
|
8
8
|
ecmaFeatures: {
|
|
9
9
|
generators: false,
|
|
10
|
-
objectLiteralDuplicateProperties: false
|
|
11
|
-
}
|
|
10
|
+
objectLiteralDuplicateProperties: false,
|
|
11
|
+
},
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
rules: {
|
|
@@ -73,7 +73,7 @@ export default {
|
|
|
73
73
|
// https://eslint.org/docs/rules/no-restricted-imports
|
|
74
74
|
'no-restricted-imports': ['off', {
|
|
75
75
|
paths: [],
|
|
76
|
-
patterns: []
|
|
76
|
+
patterns: [],
|
|
77
77
|
}],
|
|
78
78
|
|
|
79
79
|
// disallow to use this/super before super() calling in constructors.
|
|
@@ -180,6 +180,6 @@ export default {
|
|
|
180
180
|
|
|
181
181
|
// enforce spacing around the * in yield* expressions
|
|
182
182
|
// https://eslint.org/docs/rules/yield-star-spacing
|
|
183
|
-
'yield-star-spacing': ['error', 'after']
|
|
184
|
-
}
|
|
183
|
+
'yield-star-spacing': ['error', 'after'],
|
|
184
|
+
},
|
|
185
185
|
};
|
package/rules/node.js
CHANGED
package/rules/strict.js
CHANGED