Skip to content

Commit 96237a2

Browse files
committed
Update to a modern linter, and conform to it
1 parent 51a4058 commit 96237a2

File tree

6 files changed

+1473
-27
lines changed

6 files changed

+1473
-27
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
charset = utf-8
8+
indent_style = space
9+
indent_size = 4

.eslintrc.json

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"node": true,
5+
"es6": false
6+
},
7+
"parserOptions": {
8+
"ecmaVersion": 5
9+
},
10+
"rules": {
11+
// Possible errors
12+
"for-direction": "error",
13+
"getter-return": "error",
14+
"no-await-in-loop": "error",
15+
"no-compare-neg-zero": "error",
16+
"no-cond-assign": ["error", "except-parens"],
17+
"no-console": "error",
18+
"no-constant-condition": ["error", { "checkLoops": false }],
19+
"no-control-regex": "off",
20+
"no-debugger": "error",
21+
"no-dupe-args": "error",
22+
"no-dupe-keys": "error",
23+
"no-duplicate-case": "error",
24+
"no-empty": "error",
25+
"no-empty-character-class": "error",
26+
"no-ex-assign": "error",
27+
"no-extra-boolean-cast": "error",
28+
"no-extra-parens": ["error", "all", { "conditionalAssign": false, "nestedBinaryExpressions": false, "returnAssign": false }],
29+
"no-extra-semi": "error",
30+
"no-func-assign": "error",
31+
"no-inner-declarations": "off",
32+
"no-invalid-regexp": "error",
33+
"no-irregular-whitespace": "error",
34+
"no-obj-calls": "error",
35+
"no-prototype-builtins": "error",
36+
"no-regex-spaces": "error",
37+
"no-sparse-arrays": "error",
38+
"no-template-curly-in-string": "error",
39+
"no-unexpected-multiline": "error",
40+
"no-unreachable": "error",
41+
"no-unsafe-finally": "off",
42+
"no-unsafe-negation": "error",
43+
"use-isnan": "error",
44+
"valid-jsdoc": "off",
45+
"valid-typeof": "error",
46+
47+
// Best practices
48+
"accessor-pairs": "error",
49+
"array-callback-return": "error",
50+
"block-scoped-var": "off",
51+
"class-methods-use-this": "off",
52+
"complexity": "off",
53+
"consistent-return": "error",
54+
"curly": ["error", "all"],
55+
"default-case": "off",
56+
"dot-location": ["error", "property"],
57+
"dot-notation": "error",
58+
"eqeqeq": "error",
59+
"guard-for-in": "off",
60+
"no-alert": "error",
61+
"no-caller": "error",
62+
"no-case-declarations": "error",
63+
"no-div-regex": "off",
64+
"no-else-return": "error",
65+
"no-empty-function": "off",
66+
"no-empty-pattern": "error",
67+
"no-eq-null": "error",
68+
"no-eval": "error",
69+
"no-extend-native": "error",
70+
"no-extra-bind": "error",
71+
"no-extra-label": "error",
72+
"no-fallthrough": "error",
73+
"no-floating-decimal": "error",
74+
"no-global-assign": "error",
75+
"no-implicit-coercion": "error",
76+
"no-implicit-globals": "error",
77+
"no-implied-eval": "off",
78+
"no-invalid-this": "off", // meh
79+
"no-iterator": "error",
80+
"no-labels": ["error", { "allowLoop": true }],
81+
"no-lone-blocks": "error",
82+
"no-loop-func": "off",
83+
"no-magic-numbers": "off",
84+
"no-multi-spaces": "error",
85+
"no-multi-str": "error",
86+
"no-new": "error",
87+
"no-new-func": "error",
88+
"no-new-wrappers": "error",
89+
"no-octal": "error",
90+
"no-octal-escape": "error",
91+
"no-param-reassign": "off",
92+
"no-process-env": "error",
93+
"no-proto": "error",
94+
"no-redeclare": "error",
95+
"no-restricted-properties": "off",
96+
"no-return-assign": ["error", "except-parens"],
97+
"no-return-await": "error",
98+
"no-script-url": "off",
99+
"no-self-assign": "error",
100+
"no-self-compare": "error",
101+
"no-sequences": "error",
102+
"no-throw-literal": "error",
103+
"no-unmodified-loop-condition": "error",
104+
"no-unused-expressions": "error",
105+
"no-unused-labels": "error",
106+
"no-useless-call": "error",
107+
"no-useless-concat": "error",
108+
"no-useless-escape": "error",
109+
"no-useless-return": "error",
110+
"no-void": "error",
111+
"no-warning-comments": "off",
112+
"no-with": "error",
113+
"prefer-promise-reject-errors": "error",
114+
"radix": ["error", "as-needed"],
115+
"require-await": "error",
116+
"vars-on-top": "off",
117+
"wrap-iife": ["error", "outside"],
118+
"yoda": ["error", "never"],
119+
120+
// Strict Mode
121+
"strict": ["error", "global"],
122+
123+
// Variables
124+
"init-declarations": "off",
125+
"no-catch-shadow": "error",
126+
"no-delete-var": "error",
127+
"no-label-var": "error",
128+
"no-restricted-globals": "off",
129+
"no-shadow": "error",
130+
"no-shadow-restricted-names": "error",
131+
"no-undef": "error",
132+
"no-undef-init": "error",
133+
"no-undefined": "off",
134+
"no-unused-vars": "error",
135+
"no-use-before-define": ["error", "nofunc"],
136+
137+
// Node.js and CommonJS
138+
"callback-return": "off",
139+
"global-require": "error",
140+
"handle-callback-err": "error",
141+
"no-buffer-constructor": "error",
142+
"no-mixed-requires": ["error", true],
143+
"no-new-require": "error",
144+
"no-path-concat": "error",
145+
"no-process-exit": "error",
146+
"no-restricted-modules": "off",
147+
"no-sync": "off",
148+
149+
// Stylistic Issues
150+
"array-bracket-newline": ["error", { "multiline": true }],
151+
"array-bracket-spacing": ["error", "never"],
152+
"array-element-newline": ["off"],
153+
"block-spacing": ["error", "always"],
154+
"brace-style": ["error", "1tbs", { "allowSingleLine": false }],
155+
"camelcase": ["error", { "properties": "always" }],
156+
"capitalized-comments": "off",
157+
"comma-dangle": ["error", "never"],
158+
"comma-spacing": ["error", { "before": false, "after": true }],
159+
"comma-style": ["error", "last"],
160+
"computed-property-spacing": ["error", "never"],
161+
"consistent-this": "off",
162+
"eol-last": "error",
163+
"func-call-spacing": ["error", "never"],
164+
"func-name-matching": ["error"],
165+
"func-names": "off",
166+
"func-style": ["error", "declaration"],
167+
"function-paren-newline": ["error", "multiline"],
168+
"id-blacklist": "off",
169+
"id-length": "off",
170+
"id-match": "off",
171+
"indent": ["error", 4, { "SwitchCase": 1, "CallExpression": {"arguments": "first"}, "FunctionExpression": {"parameters": "first"}, "ignoredNodes": ["ConditionalExpression"] }],
172+
"jsx-quotes": "off",
173+
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "strict" }],
174+
"keyword-spacing": ["error", { "before": true, "after": true }],
175+
"line-comment-position": "off",
176+
"linebreak-style": ["error", "unix"],
177+
"lines-around-comment": "off",
178+
"max-depth": "off",
179+
"max-len": ["error", 120, { "ignoreUrls": true }],
180+
"max-lines": "off",
181+
"max-nested-callbacks": "off",
182+
"max-params": "off",
183+
"max-statements": "off",
184+
"max-statements-per-line": ["error", { "max": 1 }],
185+
"multiline-ternary": ["error", "always-multiline"],
186+
"new-cap": ["error", { "capIsNewExceptions": ["ByteString", "USVString", "DOMString"] }],
187+
"new-parens": "error",
188+
"newline-per-chained-call": "off",
189+
"no-array-constructor": "error",
190+
"no-bitwise": "off",
191+
"no-continue": "off",
192+
"no-inline-comments": "off",
193+
"no-lonely-if": "error",
194+
"no-mixed-operators": [
195+
"error",
196+
{
197+
"groups": [
198+
["&", "|", "^", "~", "<<", ">>", ">>>"],
199+
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
200+
["&&", "||"],
201+
["in", "instanceof"]
202+
]
203+
}
204+
],
205+
"no-mixed-spaces-and-tabs": "error",
206+
"no-multi-assign": "off",
207+
"no-multiple-empty-lines": "error",
208+
"no-negated-condition": "off",
209+
"no-nested-ternary": "error",
210+
"no-new-object": "error",
211+
"no-plusplus": "off",
212+
"no-restricted-syntax": "off",
213+
"no-tabs": "error",
214+
"no-ternary": "off",
215+
"no-trailing-spaces": "error",
216+
"no-underscore-dangle": "off",
217+
"no-unneeded-ternary": "error",
218+
"no-whitespace-before-property": "error",
219+
"nonblock-statement-body-position": "error",
220+
"object-curly-newline": ["error", { "consistent": true }],
221+
"object-curly-spacing": ["error", "always"],
222+
"object-property-newline": "off",
223+
"one-var": ["error", "never"],
224+
"one-var-declaration-per-line": ["error", "initializations"],
225+
"operator-assignment": ["error", "always"],
226+
"operator-linebreak": ["error", "after"],
227+
"padded-blocks": ["error", "never"],
228+
"padding-line-between-statements": "off",
229+
"quote-props": ["error", "as-needed"],
230+
"quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }],
231+
"require-jsdoc": "off",
232+
"semi": ["error", "always"],
233+
"semi-spacing": "error",
234+
"semi-style": "error",
235+
"sort-keys": "off",
236+
"sort-vars": "off",
237+
"space-before-blocks": ["error", "always"],
238+
"space-before-function-paren": ["error", { "anonymous": "always", "named": "never" }],
239+
"space-in-parens": ["error", "never"],
240+
"space-infix-ops": "error",
241+
"space-unary-ops": ["error", { "words": true, "nonwords": false }],
242+
"spaced-comment": ["error", "always", { "markers": ["///"] }],
243+
"switch-colon-spacing": "error",
244+
"template-tag-spacing": "error",
245+
"unicode-bom": "error",
246+
"wrap-regex": "off"
247+
}
248+
}

.jshintrc

Lines changed: 0 additions & 19 deletions
This file was deleted.

opener.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,21 @@ var childProcess = require("child_process");
66

77
function opener(args, options, callback) {
88
// http://stackoverflow.com/q/1480971/3191, but see below for Windows.
9-
var command = process.platform === "win32" ? "cmd" :
10-
process.platform === "darwin" ? "open" :
11-
"xdg-open";
9+
var command;
10+
switch (process.platform) {
11+
case "win32": {
12+
command = "cmd";
13+
break;
14+
}
15+
case "darwin": {
16+
command = "open";
17+
break;
18+
}
19+
default: {
20+
command = "xdg-open";
21+
break;
22+
}
23+
}
1224

1325
if (typeof args === "string") {
1426
args = [args];
@@ -37,10 +49,10 @@ function opener(args, options, callback) {
3749
// so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191
3850
//
3951
// Additionally, on Windows ampersand needs to be escaped when passed to "start"
40-
args = args.map(function(value) {
41-
return value.replace(/&/g, '^&');
52+
args = args.map(function (value) {
53+
return value.replace(/&/g, "^&");
4254
});
43-
args = ["/c", "start", '""'].concat(args);
55+
args = ["/c", "start", "\"\""].concat(args);
4456
}
4557

4658
return childProcess.execFile(command, args, options, callback);

0 commit comments

Comments
 (0)