Skip to content

Commit e2d57dd

Browse files
committed
Chore: ESLint 9 config, ES2017 compatibility, remove JSHint; rename lint script
1 parent df00d74 commit e2d57dd

File tree

10 files changed

+61
-121
lines changed

10 files changed

+61
-121
lines changed

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default [
22
{
33
languageOptions: {
4-
ecmaVersion: 2018,
4+
ecmaVersion: 2017,
55
sourceType: "module",
66
globals: {
77
Atomics: "readonly",

package-lock.json

Lines changed: 44 additions & 100 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
"browser": "index.js",
88
"scripts": {
99
"test": "echo \"Error: no test specified\" && exit 1",
10-
"lint:es5": "jshint index.js",
11-
"lint:es6": "eslint index.js \"rater-src/**\"",
10+
"lint:eslint": "eslint index.js \"rater-src/**\"",
1211
"lint:fix": "eslint index.js \"rater-src/**\" --fix",
13-
"lint": "npm run lint:es6 && npm run lint:es5",
12+
"lint": "npm run lint:eslint",
1413
"build:bundle": "browserify rater-src/App.js --debug -t babelify --outfile dist/rater.js",
1514
"build:minify": "uglifyjs dist/rater.js --compress -b ascii_only=true,beautify=false --output dist/rater.min.js",
1615
"build:concat": "concat-cli -f \"comment-top.js\" dist/rater.min.js \"comment-bottom.js\" -o dist/rater.min.js",

rater-src/Template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Template.prototype.getTitle = function() {
9191
* rather than just top-level templates.
9292
* @return {Template[]} templates
9393
*/
94-
var parseTemplates = function(wikitext, recursive) { /* eslint-disable no-control-regex */
94+
var parseTemplates = function(wikitext, recursive) {
9595
if (!wikitext) {
9696
return [];
9797
}
@@ -227,7 +227,7 @@ var parseTemplates = function(wikitext, recursive) { /* eslint-disable no-contro
227227
}
228228

229229
return result;
230-
}; /* eslint-enable no-control-regex */
230+
};
231231

232232
/**
233233
* @param {Template|Template[]} templates

rater-src/Windows/Components/BannerWidget.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,9 @@ function BannerWidget( template, config ) {
243243
allowSuggestionsWhenEmpty: true,
244244
$overlay: this.$overlay
245245
});
246-
this.addParameterButton = new OO.ui.ButtonWidget({
247-
...BannerWidget.staticElements.addButton,
248-
icon: "add",
249-
flags: "progressive"
250-
}).setDisabled(true);
246+
this.addParameterButton = new OO.ui.ButtonWidget(
247+
Object.assign({}, BannerWidget.staticElements.addButton, { icon: "add", flags: "progressive" })
248+
).setDisabled(true);
251249
this.addParameterControls = new HorizontalLayoutWidget( {
252250
items: [
253251
this.addParameterNameInput,

rater-src/Windows/Components/HorizontalLayoutWidget.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ function HorizontalLayoutWidget( config ) {
1313
// Call parent constructor
1414
HorizontalLayoutWidget.super.call( this, {} );
1515

16-
this.layout = new OO.ui.HorizontalLayout( {
17-
...config,
18-
$element: this.$element
19-
});
16+
var cfg = Object.assign({}, config, { $element: this.$element });
17+
this.layout = new OO.ui.HorizontalLayout( cfg );
2018

2119
}
2220
OO.inheritClass( HorizontalLayoutWidget, OO.ui.Widget );

rater-src/Windows/Components/ParameterWidget.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function ParameterWidget( parameter, paramData, config ) {
1919
this.isSuggested = this.paramData.suggested;
2020

2121
// Make a checkbox if only 1 or 2 allowed values
22-
switch(this.allowedValues.length) { /* eslint-disable no-fallthrough */
22+
switch(this.allowedValues.length) {
2323
case 1:
2424
this.allowedValues[1] = null;
2525
/* fall-through */
@@ -41,7 +41,7 @@ function ParameterWidget( parameter, paramData, config ) {
4141
break;
4242
default:
4343
// No checkbox
44-
} /* eslint-enable no-fallthrough */
44+
}
4545

4646
/* --- EDIT PARAMETER LAYOUT --- */
4747

rater-src/Windows/MainWindow.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,6 @@ MainWindow.prototype.onSearchSelect = function(data) {
602602
"{{" + mw.html.escape(name) + "}} is not a recognised WikiProject banner.<br/>Do you want to continue?"
603603
);
604604
} else if (name === "WikiProject Disambiguation" && $("#ca-talk.new").length !== 0 && this.bannerList.items.length === 0) {
605-
// eslint-disable-next-line no-useless-escape
606605
confirmText = "New talk pages shouldn't be created if they will only contain the \{\{WikiProject Disambiguation\}\} banner. Continue?";
607606
}
608607
$.when( confirmText ? OO.ui.confirm(confirmText) : true)
@@ -670,7 +669,7 @@ MainWindow.prototype.transformTalkWikitext = function(talkWikitext) {
670669
// replace insertion point (first control character) with a different control character
671670
talkWikitext = talkWikitext.replace("\x01", "\x02");
672671
// remove other control characters
673-
/* eslint-disable-next-line no-control-regex */
672+
674673
talkWikitext = talkWikitext.replace(/(?:\s|\n)*\x01(?:\s|\n)*/g,"");
675674
// split into wikitext before/after the remaining control character (and trim each section)
676675
var talkWikitextSections = talkWikitext.split("\x02").map(t => t.trim());

rater-src/cache.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ const write = function(key, val, staleDays, expiryDays) {
2323
expiryDate: new Date(Date.now() + expiryDuration).toISOString()
2424
});
2525
localStorage.setItem("Rater-"+key, stringVal);
26-
} catch(e) {} // eslint-disable-line no-empty
26+
} catch (e) {
27+
// Ignore storage errors (e.g., quota exceeded or unavailable)
28+
}
2729
};
2830
/** read
2931
* @param {String} key

rater-src/setup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ var setupRater = function(clickEvent) {
223223
isArticle: subjectIsArticle
224224
};
225225
if (subjectPageCheck) {
226-
result = { ...result, ...subjectPageCheck };
226+
result = Object.assign({}, result, subjectPageCheck);
227227
}
228228
if (oresPredicition && subjectPageCheck && !subjectPageCheck.isGA && !subjectPageCheck.isFA && !subjectPageCheck.isFL) {
229229
result.ores = oresPredicition;

0 commit comments

Comments
 (0)