Skip to content

Commit 03f9fd9

Browse files
committed
chore: update eslint config
1 parent cd0a882 commit 03f9fd9

File tree

2 files changed

+3
-195
lines changed

2 files changed

+3
-195
lines changed

.eslintrc

+1-114
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,3 @@
11
{
2-
"extends": "airbnb-base",
3-
"ignorePatterns": ["**/vendor/*.js"],
4-
"parserOptions": {
5-
"sourceType": "script"
6-
},
7-
8-
"rules": {
9-
// === Configure rules for our style ===
10-
// imports must be resolvable
11-
"import/no-unresolved": "error",
12-
// use single quotes,
13-
// unless a different style allows avoiding escapes
14-
"quotes": ["error", "single", {
15-
"avoidEscape": true,
16-
"allowTemplateLiterals": true
17-
}],
18-
// allow else-if return
19-
"no-else-return": [ "error", { "allowElseIf": true } ],
20-
// expressions split over multiple lines
21-
// should break after the operator
22-
"operator-linebreak": [ "error", "after" ],
23-
// require arrow parens only when needed
24-
// and whenever the body is a block
25-
"arrow-parens": ["error", "as-needed", { "requireForBlockBody": true }],
26-
// what variables are errors in callbacks
27-
"handle-callback-err": [ "error","^(e$|(e|(.*(_e|E)))rr)" ],
28-
// allow dangling commas in functions
29-
// require them everywhere else
30-
"comma-dangle": ["error", {
31-
"arrays": "always-multiline",
32-
"objects": "always-multiline",
33-
"imports": "always-multiline",
34-
"exports": "always-multiline",
35-
"functions": "only-multiline"
36-
}],
37-
// we actually encourage `return await`
38-
"no-return-await": "off",
39-
// allow `while (true)`
40-
"no-constant-condition": ["error", { "checkLoops": false }],
41-
// allow ignoring an error with `catch`
42-
"no-empty": ["error", { "allowEmptyCatch": true }],
43-
// allow `3 + 5 - 1`, but not `3 * 5 - 1`
44-
"no-mixed-operators": ["error", { "allowSamePrecedence": true }],
45-
// require `'use strict';`
46-
"strict": ["error", "global"],
47-
// we actually use tabs for indentation
48-
"indent": ["error", "tab", { "SwitchCase": 1 }],
49-
"no-tabs": "off",
50-
// we want `== null` to also handle undefined
51-
"no-eq-null": "off",
52-
// allow `for (..; i++)`
53-
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
54-
// allow using functions defined later
55-
"no-use-before-define": ["error", "nofunc"],
56-
// require consistent newlines before and after braces
57-
// if contents are multiline
58-
"object-curly-newline": ["error", { "consistent": true, "multiline": true }],
59-
// require consistent linebreaks inline function parenthesis (arguments or params)
60-
"function-paren-newline": ["error", "consistent"],
61-
// only require const if all parts of destructuring can be const
62-
"prefer-const": ["error", { "destructuring": "all" }],
63-
// don't require destructuring for arrays or assignment
64-
"prefer-destructuring": ["error", {
65-
"VariableDeclarator": { "array": false, "object": true },
66-
"AssignmentExpression": { "array": false, "object": false }
67-
}],
68-
// identical to airbnb rule, except for allowing for..of, because we want to use it
69-
"no-restricted-syntax": [
70-
"error",
71-
{
72-
"selector": "ForInStatement",
73-
"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."
74-
},
75-
{
76-
"selector": "LabeledStatement",
77-
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
78-
},
79-
{
80-
"selector": "WithStatement",
81-
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
82-
}
83-
],
84-
// allow lines of up to 120 characters
85-
"max-len": ["error", { "code": 120, "tabWidth": 2, "ignoreUrls": true, "ignoreStrings": true, "ignoreTemplateLiterals": true, "ignoreRegExpLiterals": true }],
86-
87-
// === Disable rules ===
88-
// more liberal naming
89-
"camelcase": "off",
90-
"no-underscore-dangle": "off",
91-
// don't require anonymous function names
92-
"func-names": "off",
93-
// allow console
94-
"no-console": "off",
95-
// allow new for side effects
96-
// allow new with non-capitalized
97-
"no-new": "off",
98-
"new-cap": "off",
99-
// allow shadowing variables (usually callbacks)
100-
"no-shadow": "off",
101-
// allow multiple empty lines in a row
102-
"no-multiple-empty-lines": "off",
103-
// allow not using object shorthand
104-
"object-shorthand": "off",
105-
106-
// TODO
107-
"consistent-return": "off",
108-
"no-restricted-globals": "off",
109-
"no-prototype-builtins": "off",
110-
"import/no-extraneous-dependencies": "off",
111-
"import/no-dynamic-require": "off",
112-
"global-require": "off",
113-
"no-param-reassign": "off",
114-
"default-case": "off"
115-
}
2+
"extends": "nodebb"
1163
}

public/js/.eslintrc

+2-81
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,3 @@
11
{
2-
"globals": {
3-
"app": true,
4-
"io": true,
5-
"socket": true,
6-
"ajaxify": true,
7-
"config": true,
8-
"utils": true,
9-
"overrides": true,
10-
"componentHandler": true,
11-
"bootbox": true,
12-
"Visibility": true,
13-
"Tinycon": true,
14-
"Promise": true
15-
},
16-
"env": {
17-
"jquery": true,
18-
"amd": true,
19-
"browser": true,
20-
"es6": true
21-
},
22-
"rules": {
23-
"comma-dangle": ["error", {
24-
"arrays": "always-multiline",
25-
"objects": "always-multiline",
26-
"imports": "always-multiline",
27-
"exports": "always-multiline",
28-
"functions": "never"
29-
}],
30-
"block-scoped-var": "off",
31-
"no-dupe-class-members": "off",
32-
"prefer-object-spread": "off",
33-
"prefer-reflect": "off",
34-
35-
// ES6
36-
"prefer-rest-params": "off",
37-
"prefer-spread": "off",
38-
"prefer-arrow-callback": "off",
39-
"prefer-template": "off",
40-
"no-var": "off",
41-
"object-shorthand": "off",
42-
"vars-on-top": "off",
43-
"prefer-destructuring": "off",
44-
// identical to airbnb rule
45-
// except for allowing for..in, because for..of is unavailable on some clients
46-
"no-restricted-syntax": [
47-
"error",
48-
{
49-
"selector": "ForOfStatement",
50-
"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."
51-
},
52-
{
53-
"selector": "LabeledStatement",
54-
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
55-
},
56-
{
57-
"selector": "WithStatement",
58-
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
59-
}
60-
]
61-
},
62-
"parserOptions": {
63-
"ecmaVersion": 2018,
64-
"ecmaFeatures": {
65-
"classes": false,
66-
"defaultParams": false,
67-
"blockBindings": false,
68-
"forOf": false,
69-
"generators": false,
70-
"globalReturn": false,
71-
"jsx": false,
72-
"modules": false,
73-
"objectLiteralComputedProperties": false,
74-
"objectLiteralDuplicateProperties": false,
75-
"objectLiteralShorthandMethods": false,
76-
"objectLiteralShorthandProperties": false,
77-
"impliedStrict": false,
78-
"restParams": false,
79-
"superInFunctions": false
80-
}
81-
}
82-
}
2+
"extends": "nodebb/public"
3+
}

0 commit comments

Comments
 (0)