eslint-config-nodebb 1.0.4 → 1.0.6
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.cjs +95 -0
- package/package.json +3 -3
- package/public.cjs +78 -0
- package/index.js +0 -92
- package/public.js +0 -68
package/index.cjs
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const globals = require('globals');
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
files: [
|
|
6
|
+
'*.js', 'src/**/*.js', 'lib/**/*.js', 'install/**/*.js', 'nodebb',
|
|
7
|
+
],
|
|
8
|
+
languageOptions: {
|
|
9
|
+
ecmaVersion: 2020,
|
|
10
|
+
sourceType: 'commonjs',
|
|
11
|
+
globals: {
|
|
12
|
+
...globals.node,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
linterOptions: {
|
|
16
|
+
reportUnusedDisableDirectives: true,
|
|
17
|
+
},
|
|
18
|
+
rules: {
|
|
19
|
+
// === Project Style Rules ===
|
|
20
|
+
'quotes': ['error', 'single', {
|
|
21
|
+
avoidEscape: true,
|
|
22
|
+
allowTemplateLiterals: true,
|
|
23
|
+
}],
|
|
24
|
+
'no-else-return': ['error', { allowElseIf: true }],
|
|
25
|
+
'no-unused-vars': ['error', { caughtErrors: 'none' }],
|
|
26
|
+
'operator-linebreak': ['error', 'after'],
|
|
27
|
+
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
|
|
28
|
+
'handle-callback-err': ['error', '^(e$|(e|(.*(_e|E)))rr)'],
|
|
29
|
+
'comma-dangle': ['error', {
|
|
30
|
+
arrays: 'always-multiline',
|
|
31
|
+
objects: 'always-multiline',
|
|
32
|
+
imports: 'always-multiline',
|
|
33
|
+
exports: 'always-multiline',
|
|
34
|
+
functions: 'only-multiline',
|
|
35
|
+
}],
|
|
36
|
+
'no-return-await': 'off',
|
|
37
|
+
'no-constant-condition': ['error', { checkLoops: false }],
|
|
38
|
+
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
39
|
+
'no-mixed-operators': ['error', { allowSamePrecedence: true }],
|
|
40
|
+
'strict': ['error', 'global'],
|
|
41
|
+
'indent': ['error', 'tab', { SwitchCase: 1 }],
|
|
42
|
+
'no-tabs': ['error', { allowIndentationTabs: true }],
|
|
43
|
+
'no-eq-null': 'off',
|
|
44
|
+
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
|
45
|
+
'no-use-before-define': ['error', 'nofunc'],
|
|
46
|
+
'object-curly-newline': ['error', { consistent: true, multiline: true }],
|
|
47
|
+
'function-paren-newline': ['error', 'consistent'],
|
|
48
|
+
'prefer-const': ['error', { destructuring: 'all' }],
|
|
49
|
+
'prefer-destructuring': ['error', {
|
|
50
|
+
VariableDeclarator: { array: false, object: true },
|
|
51
|
+
AssignmentExpression: { array: false, object: false },
|
|
52
|
+
}],
|
|
53
|
+
'no-restricted-syntax': [
|
|
54
|
+
'error',
|
|
55
|
+
{
|
|
56
|
+
selector: 'ForInStatement',
|
|
57
|
+
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.',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
selector: 'LabeledStatement',
|
|
61
|
+
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
selector: 'WithStatement',
|
|
65
|
+
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
'max-len': ['error', {
|
|
69
|
+
code: 120,
|
|
70
|
+
tabWidth: 2,
|
|
71
|
+
ignoreUrls: true,
|
|
72
|
+
ignoreStrings: true,
|
|
73
|
+
ignoreTemplateLiterals: true,
|
|
74
|
+
ignoreRegExpLiterals: true,
|
|
75
|
+
}],
|
|
76
|
+
|
|
77
|
+
// === Disable Rules ===
|
|
78
|
+
'camelcase': 'off',
|
|
79
|
+
'no-underscore-dangle': 'off',
|
|
80
|
+
'func-names': 'off',
|
|
81
|
+
'no-console': 'off',
|
|
82
|
+
'no-new': 'off',
|
|
83
|
+
'new-cap': 'off',
|
|
84
|
+
'no-shadow': 'off',
|
|
85
|
+
'no-multiple-empty-lines': 'off',
|
|
86
|
+
'object-shorthand': 'off',
|
|
87
|
+
'consistent-return': 'off',
|
|
88
|
+
'no-restricted-globals': 'off',
|
|
89
|
+
'no-prototype-builtins': 'off',
|
|
90
|
+
'global-require': 'off',
|
|
91
|
+
'no-param-reassign': 'off',
|
|
92
|
+
'default-case': 'off',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-nodebb",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"keywords": [],
|
|
10
10
|
"author": "",
|
|
11
11
|
"exports": {
|
|
12
|
-
".": "./index.
|
|
13
|
-
"./public": "./public.
|
|
12
|
+
".": "./index.cjs",
|
|
13
|
+
"./public": "./public.cjs"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"eslint": "^9.x",
|
package/public.cjs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const globals = require('globals');
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
files: ['public/**/*.js', 'static/**/*.js'],
|
|
6
|
+
languageOptions: {
|
|
7
|
+
ecmaVersion: 2020,
|
|
8
|
+
sourceType: 'module',
|
|
9
|
+
globals: {
|
|
10
|
+
app: 'writable',
|
|
11
|
+
io: 'writable',
|
|
12
|
+
socket: 'writable',
|
|
13
|
+
ajaxify: 'writable',
|
|
14
|
+
config: 'writable',
|
|
15
|
+
utils: 'writable',
|
|
16
|
+
overrides: 'writable',
|
|
17
|
+
bootbox: 'writable',
|
|
18
|
+
Tinycon: 'writable',
|
|
19
|
+
Promise: 'writable',
|
|
20
|
+
ace: 'writable',
|
|
21
|
+
$: 'readonly',
|
|
22
|
+
jQuery: 'readonly',
|
|
23
|
+
define: 'readonly',
|
|
24
|
+
require: 'readonly',
|
|
25
|
+
module: 'readonly',
|
|
26
|
+
...globals.browser,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
linterOptions: {
|
|
30
|
+
reportUnusedDisableDirectives: true,
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
'comma-dangle': ['error', {
|
|
34
|
+
arrays: 'always-multiline',
|
|
35
|
+
objects: 'always-multiline',
|
|
36
|
+
imports: 'always-multiline',
|
|
37
|
+
exports: 'always-multiline',
|
|
38
|
+
functions: 'never',
|
|
39
|
+
}],
|
|
40
|
+
'block-scoped-var': 'off',
|
|
41
|
+
'no-dupe-class-members': 'off',
|
|
42
|
+
'prefer-object-spread': 'off',
|
|
43
|
+
'prefer-reflect': 'off',
|
|
44
|
+
strict: 'off',
|
|
45
|
+
|
|
46
|
+
// ES6 rules
|
|
47
|
+
'no-prototype-builtins': 'off',
|
|
48
|
+
'prefer-rest-params': 'off',
|
|
49
|
+
'prefer-spread': 'off',
|
|
50
|
+
'prefer-arrow-callback': 'off',
|
|
51
|
+
'prefer-template': 'off',
|
|
52
|
+
'no-var': 'off',
|
|
53
|
+
'object-shorthand': 'off',
|
|
54
|
+
'vars-on-top': 'off',
|
|
55
|
+
'prefer-destructuring': 'off',
|
|
56
|
+
|
|
57
|
+
// Custom restrictions
|
|
58
|
+
'no-restricted-syntax': [
|
|
59
|
+
'error',
|
|
60
|
+
{
|
|
61
|
+
selector: 'ForOfStatement',
|
|
62
|
+
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.',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
selector: 'LabeledStatement',
|
|
66
|
+
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
selector: 'WithStatement',
|
|
70
|
+
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
ignores: [
|
|
75
|
+
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
];
|
package/index.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
const { configs } = require('@eslint/js');
|
|
2
|
-
module.exports = [
|
|
3
|
-
configs.recommended,
|
|
4
|
-
{
|
|
5
|
-
files: ['**/*.js'],
|
|
6
|
-
languageOptions: {
|
|
7
|
-
ecmaVersion: 2020,
|
|
8
|
-
sourceType: 'script',
|
|
9
|
-
globals: {
|
|
10
|
-
// Node.js globals are implied, no need to redefine unless custom ones are used
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
linterOptions: {
|
|
14
|
-
reportUnusedDisableDirectives: true
|
|
15
|
-
},
|
|
16
|
-
rules: {
|
|
17
|
-
// === Project Style Rules ===
|
|
18
|
-
'quotes': ['error', 'single', {
|
|
19
|
-
avoidEscape: true,
|
|
20
|
-
allowTemplateLiterals: true
|
|
21
|
-
}],
|
|
22
|
-
'no-else-return': ['error', { allowElseIf: true }],
|
|
23
|
-
'operator-linebreak': ['error', 'after'],
|
|
24
|
-
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
|
|
25
|
-
'handle-callback-err': ['error', '^(e$|(e|(.*(_e|E)))rr)'],
|
|
26
|
-
'comma-dangle': ['error', {
|
|
27
|
-
arrays: 'always-multiline',
|
|
28
|
-
objects: 'always-multiline',
|
|
29
|
-
imports: 'always-multiline',
|
|
30
|
-
exports: 'always-multiline',
|
|
31
|
-
functions: 'only-multiline'
|
|
32
|
-
}],
|
|
33
|
-
'no-return-await': 'off',
|
|
34
|
-
'no-constant-condition': ['error', { checkLoops: false }],
|
|
35
|
-
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
36
|
-
'no-mixed-operators': ['error', { allowSamePrecedence: true }],
|
|
37
|
-
'strict': ['error', 'global'],
|
|
38
|
-
'indent': ['error', 'tab', { SwitchCase: 1 }],
|
|
39
|
-
'no-tabs': ['error', { allowIndentationTabs: true }],
|
|
40
|
-
'no-eq-null': 'off',
|
|
41
|
-
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
|
42
|
-
'no-use-before-define': ['error', 'nofunc'],
|
|
43
|
-
'object-curly-newline': ['error', { consistent: true, multiline: true }],
|
|
44
|
-
'function-paren-newline': ['error', 'consistent'],
|
|
45
|
-
'prefer-const': ['error', { destructuring: 'all' }],
|
|
46
|
-
'prefer-destructuring': ['error', {
|
|
47
|
-
VariableDeclarator: { array: false, object: true },
|
|
48
|
-
AssignmentExpression: { array: false, object: false }
|
|
49
|
-
}],
|
|
50
|
-
'no-restricted-syntax': [
|
|
51
|
-
'error',
|
|
52
|
-
{
|
|
53
|
-
selector: 'ForInStatement',
|
|
54
|
-
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.'
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
selector: 'LabeledStatement',
|
|
58
|
-
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.'
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
selector: 'WithStatement',
|
|
62
|
-
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.'
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
'max-len': ['error', {
|
|
66
|
-
code: 120,
|
|
67
|
-
tabWidth: 2,
|
|
68
|
-
ignoreUrls: true,
|
|
69
|
-
ignoreStrings: true,
|
|
70
|
-
ignoreTemplateLiterals: true,
|
|
71
|
-
ignoreRegExpLiterals: true
|
|
72
|
-
}],
|
|
73
|
-
|
|
74
|
-
// === Disable Rules ===
|
|
75
|
-
'camelcase': 'off',
|
|
76
|
-
'no-underscore-dangle': 'off',
|
|
77
|
-
'func-names': 'off',
|
|
78
|
-
'no-console': 'off',
|
|
79
|
-
'no-new': 'off',
|
|
80
|
-
'new-cap': 'off',
|
|
81
|
-
'no-shadow': 'off',
|
|
82
|
-
'no-multiple-empty-lines': 'off',
|
|
83
|
-
'object-shorthand': 'off',
|
|
84
|
-
'consistent-return': 'off',
|
|
85
|
-
'no-restricted-globals': 'off',
|
|
86
|
-
'no-prototype-builtins': 'off',
|
|
87
|
-
'global-require': 'off',
|
|
88
|
-
'no-param-reassign': 'off',
|
|
89
|
-
'default-case': 'off'
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
];
|
package/public.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
module.exports = [
|
|
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'
|
|
33
|
-
}],
|
|
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',
|
|
49
|
-
|
|
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
|
-
}
|
|
65
|
-
]
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
];
|