eslint-config-nodebb 0.2.0 → 1.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/lib.js +87 -109
- package/package.json +5 -5
- package/public.js +64 -79
- /package/{index.js → index.cjs} +0 -0
package/lib.js
CHANGED
|
@@ -1,115 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
files: ['**/*.js'],
|
|
4
|
+
languageOptions: {
|
|
5
|
+
ecmaVersion: 2020,
|
|
6
|
+
sourceType: 'script', // equivalent to your v8 "parserOptions.sourceType"
|
|
7
|
+
globals: {
|
|
8
|
+
// Node.js globals are implied, no need to redefine unless custom ones are used
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
linterOptions: {
|
|
12
|
+
reportUnusedDisableDirectives: true
|
|
13
|
+
},
|
|
14
|
+
rules: {
|
|
15
|
+
// === Project Style Rules ===
|
|
16
|
+
'import/no-unresolved': 'error',
|
|
17
|
+
'quotes': ['error', 'single', {
|
|
18
|
+
avoidEscape: true,
|
|
19
|
+
allowTemplateLiterals: true
|
|
16
20
|
}],
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// allow dangling commas in functions
|
|
28
|
-
// require them everywhere else
|
|
29
|
-
"comma-dangle": ["error", {
|
|
30
|
-
"arrays": "always-multiline",
|
|
31
|
-
"objects": "always-multiline",
|
|
32
|
-
"imports": "always-multiline",
|
|
33
|
-
"exports": "always-multiline",
|
|
34
|
-
"functions": "only-multiline"
|
|
21
|
+
'no-else-return': ['error', { allowElseIf: true }],
|
|
22
|
+
'operator-linebreak': ['error', 'after'],
|
|
23
|
+
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
|
|
24
|
+
'handle-callback-err': ['error', '^(e$|(e|(.*(_e|E)))rr)'],
|
|
25
|
+
'comma-dangle': ['error', {
|
|
26
|
+
arrays: 'always-multiline',
|
|
27
|
+
objects: 'always-multiline',
|
|
28
|
+
imports: 'always-multiline',
|
|
29
|
+
exports: 'always-multiline',
|
|
30
|
+
functions: 'only-multiline'
|
|
35
31
|
}],
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
|
|
53
|
-
// allow using functions defined later
|
|
54
|
-
"no-use-before-define": ["error", "nofunc"],
|
|
55
|
-
// require consistent newlines before and after braces
|
|
56
|
-
// if contents are multiline
|
|
57
|
-
"object-curly-newline": ["error", { "consistent": true, "multiline": true }],
|
|
58
|
-
// require consistent linebreaks inline function parenthesis (arguments or params)
|
|
59
|
-
"function-paren-newline": ["error", "consistent"],
|
|
60
|
-
// only require const if all parts of destructuring can be const
|
|
61
|
-
"prefer-const": ["error", { "destructuring": "all" }],
|
|
62
|
-
// don't require destructuring for arrays or assignment
|
|
63
|
-
"prefer-destructuring": ["error", {
|
|
64
|
-
"VariableDeclarator": { "array": false, "object": true },
|
|
65
|
-
"AssignmentExpression": { "array": false, "object": false }
|
|
32
|
+
'no-return-await': 'off',
|
|
33
|
+
'no-constant-condition': ['error', { checkLoops: false }],
|
|
34
|
+
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
35
|
+
'no-mixed-operators': ['error', { allowSamePrecedence: true }],
|
|
36
|
+
'strict': ['error', 'global'],
|
|
37
|
+
'indent': ['error', 'tab', { SwitchCase: 1 }],
|
|
38
|
+
'no-tabs': ['error', { allowIndentationTabs: true }],
|
|
39
|
+
'no-eq-null': 'off',
|
|
40
|
+
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
|
41
|
+
'no-use-before-define': ['error', 'nofunc'],
|
|
42
|
+
'object-curly-newline': ['error', { consistent: true, multiline: true }],
|
|
43
|
+
'function-paren-newline': ['error', 'consistent'],
|
|
44
|
+
'prefer-const': ['error', { destructuring: 'all' }],
|
|
45
|
+
'prefer-destructuring': ['error', {
|
|
46
|
+
VariableDeclarator: { array: false, object: true },
|
|
47
|
+
AssignmentExpression: { array: false, object: false }
|
|
66
48
|
}],
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
49
|
+
'no-restricted-syntax': [
|
|
50
|
+
'error',
|
|
51
|
+
{
|
|
52
|
+
selector: 'ForInStatement',
|
|
53
|
+
message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
selector: 'LabeledStatement',
|
|
57
|
+
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
selector: 'WithStatement',
|
|
61
|
+
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.'
|
|
62
|
+
}
|
|
82
63
|
],
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"func-names": "off",
|
|
92
|
-
// allow console
|
|
93
|
-
"no-console": "off",
|
|
94
|
-
// allow new for side effects
|
|
95
|
-
// allow new with non-capitalized
|
|
96
|
-
"no-new": "off",
|
|
97
|
-
"new-cap": "off",
|
|
98
|
-
// allow shadowing variables (usually callbacks)
|
|
99
|
-
"no-shadow": "off",
|
|
100
|
-
// allow multiple empty lines in a row
|
|
101
|
-
"no-multiple-empty-lines": "off",
|
|
102
|
-
// allow not using object shorthand
|
|
103
|
-
"object-shorthand": "off",
|
|
64
|
+
'max-len': ['error', {
|
|
65
|
+
code: 120,
|
|
66
|
+
tabWidth: 2,
|
|
67
|
+
ignoreUrls: true,
|
|
68
|
+
ignoreStrings: true,
|
|
69
|
+
ignoreTemplateLiterals: true,
|
|
70
|
+
ignoreRegExpLiterals: true
|
|
71
|
+
}],
|
|
104
72
|
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
73
|
+
// === Disable Rules ===
|
|
74
|
+
'camelcase': 'off',
|
|
75
|
+
'no-underscore-dangle': 'off',
|
|
76
|
+
'func-names': 'off',
|
|
77
|
+
'no-console': 'off',
|
|
78
|
+
'no-new': 'off',
|
|
79
|
+
'new-cap': 'off',
|
|
80
|
+
'no-shadow': 'off',
|
|
81
|
+
'no-multiple-empty-lines': 'off',
|
|
82
|
+
'object-shorthand': 'off',
|
|
83
|
+
'consistent-return': 'off',
|
|
84
|
+
'no-restricted-globals': 'off',
|
|
85
|
+
'no-prototype-builtins': 'off',
|
|
86
|
+
'import/no-extraneous-dependencies': 'off',
|
|
87
|
+
'import/no-dynamic-require': 'off',
|
|
88
|
+
'global-require': 'off',
|
|
89
|
+
'no-param-reassign': 'off',
|
|
90
|
+
'default-case': 'off'
|
|
91
|
+
}
|
|
114
92
|
}
|
|
115
|
-
|
|
93
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-nodebb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
},
|
|
9
9
|
"keywords": [],
|
|
10
10
|
"author": "",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./index.js",
|
|
13
|
+
"./public": "./public.js"
|
|
13
14
|
},
|
|
14
15
|
"peerDependencies": {
|
|
15
|
-
"eslint": "
|
|
16
|
-
"eslint-plugin-import": "2.x"
|
|
16
|
+
"eslint": "^9.x"
|
|
17
17
|
},
|
|
18
18
|
"license": "ISC"
|
|
19
19
|
}
|
package/public.js
CHANGED
|
@@ -1,83 +1,68 @@
|
|
|
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
|
-
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
files: ['**/*.js'],
|
|
4
|
+
languageOptions: {
|
|
5
|
+
ecmaVersion: 2020,
|
|
6
|
+
sourceType: 'module',
|
|
7
|
+
globals: {
|
|
8
|
+
app: 'writable',
|
|
9
|
+
io: 'writable',
|
|
10
|
+
socket: 'writable',
|
|
11
|
+
ajaxify: 'writable',
|
|
12
|
+
config: 'writable',
|
|
13
|
+
utils: 'writable',
|
|
14
|
+
overrides: 'writable',
|
|
15
|
+
componentHandler: 'writable',
|
|
16
|
+
bootbox: 'writable',
|
|
17
|
+
Tinycon: 'writable',
|
|
18
|
+
Promise: 'writable',
|
|
19
|
+
navigator: 'writable',
|
|
20
|
+
ace: 'writable'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
linterOptions: {
|
|
24
|
+
reportUnusedDisableDirectives: true
|
|
25
|
+
},
|
|
26
|
+
rules: {
|
|
27
|
+
'comma-dangle': ['error', {
|
|
28
|
+
arrays: 'always-multiline',
|
|
29
|
+
objects: 'always-multiline',
|
|
30
|
+
imports: 'always-multiline',
|
|
31
|
+
exports: 'always-multiline',
|
|
32
|
+
functions: 'never'
|
|
30
33
|
}],
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
'block-scoped-var': 'off',
|
|
35
|
+
'no-dupe-class-members': 'off',
|
|
36
|
+
'prefer-object-spread': 'off',
|
|
37
|
+
'prefer-reflect': 'off',
|
|
38
|
+
strict: 'off',
|
|
39
|
+
|
|
40
|
+
// ES6 rules
|
|
41
|
+
'prefer-rest-params': 'off',
|
|
42
|
+
'prefer-spread': 'off',
|
|
43
|
+
'prefer-arrow-callback': 'off',
|
|
44
|
+
'prefer-template': 'off',
|
|
45
|
+
'no-var': 'off',
|
|
46
|
+
'object-shorthand': 'off',
|
|
47
|
+
'vars-on-top': 'off',
|
|
48
|
+
'prefer-destructuring': 'off',
|
|
35
49
|
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"message": "iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations."
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"selector": "LabeledStatement",
|
|
55
|
-
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"selector": "WithStatement",
|
|
59
|
-
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
|
|
60
|
-
}
|
|
50
|
+
// Custom restrictions
|
|
51
|
+
'no-restricted-syntax': [
|
|
52
|
+
'error',
|
|
53
|
+
{
|
|
54
|
+
selector: 'ForOfStatement',
|
|
55
|
+
message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
selector: 'LabeledStatement',
|
|
59
|
+
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
selector: 'WithStatement',
|
|
63
|
+
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.'
|
|
64
|
+
}
|
|
61
65
|
]
|
|
62
|
-
|
|
63
|
-
"parserOptions": {
|
|
64
|
-
"ecmaVersion": 2020,
|
|
65
|
-
"sourceType": "module",
|
|
66
|
-
"ecmaFeatures": {
|
|
67
|
-
"classes": false,
|
|
68
|
-
"defaultParams": false,
|
|
69
|
-
"blockBindings": false,
|
|
70
|
-
"forOf": false,
|
|
71
|
-
"generators": false,
|
|
72
|
-
"globalReturn": false,
|
|
73
|
-
"jsx": false,
|
|
74
|
-
"objectLiteralComputedProperties": false,
|
|
75
|
-
"objectLiteralDuplicateProperties": false,
|
|
76
|
-
"objectLiteralShorthandMethods": false,
|
|
77
|
-
"objectLiteralShorthandProperties": false,
|
|
78
|
-
"impliedStrict": false,
|
|
79
|
-
"restParams": false,
|
|
80
|
-
"superInFunctions": false
|
|
81
|
-
}
|
|
66
|
+
}
|
|
82
67
|
}
|
|
83
|
-
|
|
68
|
+
];
|
/package/{index.js → index.cjs}
RENAMED
|
File without changes
|