Skip to content
This repository was archived by the owner on Sep 15, 2020. It is now read-only.

Commit 3bc1ce1

Browse files
committed
Tweak ESLint rules.
1 parent d45d882 commit 3bc1ce1

File tree

8 files changed

+70
-33
lines changed

8 files changed

+70
-33
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/.git/
2+
/_site/
3+
/node_modules/
4+
/source/assets/js/vendor/
5+
/source/assets/js/google-analytics.js

.eslintrc.json

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,22 @@
33
"env": {
44
"node": true
55
},
6-
"parserOptions": {
7-
"sourceType": "module"
8-
},
96
"extends": "eslint:recommended",
107
"rules": {
11-
"array-bracket-spacing": ["error", "never"],
8+
"array-bracket-spacing": [
9+
"error",
10+
"never"
11+
],
1212
"array-callback-return": "error",
13+
"arrow-body-style": [
14+
"error",
15+
"as-needed"
16+
],
17+
"arrow-parens": [
18+
"error",
19+
"always"
20+
],
21+
"arrow-spacing": "error",
1322
"block-scoped-var": "error",
1423
"block-spacing": "error",
1524
"brace-style": [
@@ -35,19 +44,22 @@
3544
"error",
3645
"last"
3746
],
38-
"computed-property-spacing": ["error", "never"],
39-
"consistent-return": "error",
40-
"consistent-this": [
47+
"computed-property-spacing": [
4148
"error",
42-
"this"
49+
"never"
4350
],
51+
"consistent-return": "error",
52+
"consistent-this": "off",
4453
"curly": "error",
4554
"default-case": "error",
4655
"dot-notation": "error",
4756
"eol-last": "error",
4857
"eqeqeq": "error",
4958
"func-call-spacing": "error",
50-
"func-names": "off",
59+
"func-names": [
60+
"error",
61+
"never"
62+
],
5163
"func-style": [
5264
"error",
5365
"declaration"
@@ -59,6 +71,7 @@
5971
"error",
6072
4,
6173
{
74+
"MemberExpression": "off",
6275
"SwitchCase": 1
6376
}
6477
],
@@ -87,8 +100,16 @@
87100
"max": 1
88101
}
89102
],
90-
"multiline-ternary": "off",
91-
"new-cap": "error",
103+
"multiline-ternary": [
104+
"off",
105+
"always-multiline"
106+
],
107+
"new-cap": [
108+
"error",
109+
{
110+
"properties": false
111+
}
112+
],
92113
"newline-after-var": [
93114
"error",
94115
"always"
@@ -117,7 +138,13 @@
117138
"no-eval": "error",
118139
"no-extra-bind": "error",
119140
"no-extra-label": "error",
120-
"no-extra-parens": "error",
141+
"no-extra-parens": [
142+
"error",
143+
"all",
144+
{
145+
"nestedBinaryExpressions": false
146+
}
147+
],
121148
"no-floating-decimal": "error",
122149
"no-global-assign": "error",
123150
"no-implicit-coercion": "error",
@@ -153,12 +180,13 @@
153180
"no-new-object": "error",
154181
"no-octal": "error",
155182
"no-param-reassign": [
156-
"error",
183+
"off",
157184
{
158185
"props": false
159186
}
160187
],
161188
"no-path-concat": "error",
189+
"no-prototype-builtins": "error",
162190
"no-return-assign": "error",
163191
"no-self-compare": "error",
164192
"no-sequences": "error",
@@ -221,6 +249,10 @@
221249
"single"
222250
],
223251
"radix": "error",
252+
"rest-spread-spacing": [
253+
"error",
254+
"never"
255+
],
224256
"semi": [
225257
"error",
226258
"always"
@@ -231,17 +263,20 @@
231263
"error",
232264
"always"
233265
],
234-
"spaced-comment": [
235-
"off",
236-
"always"
266+
"space-before-function-paren": [
267+
"error",
268+
"never"
237269
],
270+
"spaced-comment": "off",
238271
"space-infix-ops": "error",
239272
"space-in-parens": [
240273
"error",
241274
"never"
242275
],
243276
"space-unary-ops": "error",
244277
"strict": "error",
278+
"symbol-description": "error",
279+
"template-curly-spacing": "error",
245280
"unicode-bom": [
246281
"error",
247282
"never"

Gruntfile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
module.exports = function(grunt) {
1+
'use strict';
22

3+
module.exports = function(grunt) {
34
grunt.initConfig({
45
dirs: {
56
dest: '_site',
@@ -227,7 +228,7 @@ module.exports = function(grunt) {
227228
livereload: {
228229
options: {
229230
base: '<%= dirs.dest %>/',
230-
open: true // Automatically open the webpage in the default browser
231+
open: true // Automatically open the webpage in the default browser
231232
}
232233
}
233234
},
@@ -352,5 +353,4 @@ module.exports = function(grunt) {
352353
'connect',
353354
'watch:dev'
354355
]);
355-
356356
};
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
/* global baguetteBox */
22

3-
(function initBaguetteBox () {
3+
(function() {
44
'use strict';
55

66
baguetteBox.run('.gallery', {
77
async: true,
88
buttons: true,
99
noScrollbars: true
1010
});
11-
1211
})();

source/assets/js/detect-os.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(function detectOS () {
1+
(function() {
22
'use strict';
33

44
var arch = window.navigator.userAgent.match(/x86_64|Win64|WOW64/) ||
@@ -36,5 +36,4 @@
3636
href += arches[arch].folder + '/MPC-HC_v' + version + '_' + arch + '/MPC-HC.' + version + '.' + arch + '.exe';
3737

3838
downloadButton.setAttribute('href', encodeURI(href));
39-
4039
})();

source/assets/js/downloads.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ $(function() {
55

66
var $el = $('.toggleLink');
77

8-
if (!$el.length) {
8+
if ($el.length === 0) {
99
return;
1010
}
1111

@@ -40,15 +40,14 @@ $(function() {
4040
});
4141

4242
$('.closeAll').click(function() {
43-
$('.panel-collapse.in').collapse('hide'); // hide any `panel`s
44-
collapsedToggleLinkCount = totalToggleLinkCount; // reset the global count
43+
$('.panel-collapse.in').collapse('hide'); // hide any `panel`s
44+
collapsedToggleLinkCount = totalToggleLinkCount; // reset the global count
4545
checkButtonState();
4646
});
4747

4848
$('.expandAll').click(function() {
49-
$('.panel-collapse:not(".in")').collapse('show'); // show any `panel`s
50-
collapsedToggleLinkCount = 0; // reset the global count
49+
$('.panel-collapse:not(".in")').collapse('show'); // show any `panel`s
50+
collapsedToggleLinkCount = 0; // reset the global count
5151
checkButtonState();
5252
});
53-
5453
});

source/assets/js/no-js-class.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(function nojs (html) {
1+
(function(html) {
22
'use strict';
33

44
html.className = html.className.replace(/\bno-js\b/, '');

source/assets/js/pwa.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/* eslint no-console:off */
22

3-
(function setupSW () {
3+
(function() {
44
'use strict';
55

66
if ('serviceWorker' in navigator) {
77
window.addEventListener('load', function() {
88
navigator.serviceWorker.register('/sw.min.js').then(function(registration) {
99
console.log('ServiceWorker registration successful with scope: ', registration.scope);
10-
}).catch(function(err) {
11-
console.log('ServiceWorker registration failed: ', err);
10+
}).catch(function(error) {
11+
console.log('ServiceWorker registration failed: ', error);
1212
});
1313
});
1414
}

0 commit comments

Comments
 (0)