Skip to content

Commit 7ed5602

Browse files
committed
Upgrade eslint 9
1 parent 6acd846 commit 7ed5602

File tree

7 files changed

+216
-231
lines changed

7 files changed

+216
-231
lines changed

.eslintrc.yml

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

eslint.config.mjs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
2+
import tsParser from "@typescript-eslint/parser";
3+
import path from "node:path";
4+
import { fileURLToPath } from "node:url";
5+
import js from "@eslint/js";
6+
import { FlatCompat } from "@eslint/eslintrc";
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const compat = new FlatCompat({
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all
14+
});
15+
16+
export default [{
17+
files: ['**/*.ts'],
18+
ignores: ["**/out", "**/dist", "**/*.d.ts", "**/webpack.config.js", '**/eslint.config.mjs'],
19+
}, ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"), {
20+
plugins: {
21+
"@typescript-eslint": typescriptEslint,
22+
},
23+
24+
languageOptions: {
25+
parser: tsParser,
26+
ecmaVersion: 5,
27+
sourceType: "module"
28+
},
29+
30+
rules: {
31+
"@typescript-eslint/naming-convention": "warn",
32+
semi: "warn",
33+
curly: "warn",
34+
eqeqeq: "warn",
35+
"no-throw-literal": "warn",
36+
"@typescript-eslint/no-explicit-any" : "warn",
37+
},
38+
}];

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
"vscode:prepublish": "yarn run compile",
263263
"compile": "yarn run convert && webpack --config webpack.config.js --mode production",
264264
"compile-debug": "yarn run convert && webpack --config webpack.config.js --mode development",
265-
"lint": "eslint -c .eslintrc.yml --ext .ts ./src",
265+
"lint": "eslint -c ./eslint.config.mjs ./src",
266266
"watch": "yarn run convert && webpack --config webpack.config.js --mode development --watch",
267267
"pretest": "yarn run compile-debug && yarn run lint",
268268
"test": "yarn run test-node && yarn run test-web",
@@ -276,12 +276,12 @@
276276
"@types/glob": "^7.2.0",
277277
"@types/luxon": "^2.0.7",
278278
"@types/mocha": "^9.0.0",
279-
"@types/node": "^16.11.10",
279+
"@types/node": "^20.14.13",
280280
"@types/node-fetch": "^2.5.12",
281281
"@types/vscode": "^1.64.0",
282282
"@types/webpack-env": "^1.18.0",
283-
"@typescript-eslint/eslint-plugin": "^5.4.0",
284-
"@typescript-eslint/parser": "^5.4.0",
283+
"@typescript-eslint/eslint-plugin": "^8.0.0",
284+
"@typescript-eslint/parser": "^8.0.0",
285285
"@vscode/test-electron": "^2.2.0",
286286
"@vscode/test-web": "^0.0.56",
287287
"assert": "^2.0.0",
@@ -291,7 +291,8 @@
291291
"browserify-zlib": "^0.2.0",
292292
"buffer": "^6.0.3",
293293
"crypto-browserify": "^3.12.0",
294-
"eslint": "^8.3.0",
294+
"eslint": "^9.8.0",
295+
"tslib": "^2.6.3",
295296
"glob": "^7.2.0",
296297
"https-browserify": "^1.0.0",
297298
"js-yaml": "^4.1.0",

src/interface_definition/IObjectConverter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-unused-expressions */
12
interface IObjectConverter<TargetType> {
23
toResult(json: unknown): TargetType;
34
resultToJson(value: TargetType): unknown;

src/interface_definition/mwbot.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ declare module 'mwbot' {
4343
* @param {{}} [customOptions] Custom options
4444
* @param {{}} [customRequestOptions] Custom request options
4545
*/
46-
constructor(customOptions?: {}, customRequestOptions?: {});
46+
constructor(customOptions?: object, customRequestOptions?: object);
4747

4848
//////////////////////////////////////////
4949
// GETTER & SETTER //
@@ -61,15 +61,15 @@ declare module 'mwbot' {
6161
*
6262
* @param {Object} customOptions
6363
*/
64-
public setOptions(customOptions: Object): void;
64+
public setOptions(customOptions: object): void;
6565

6666
/**
6767
* Sets and overwrites the raw request options, used by the "request" library
6868
* See https://www.npmjs.com/package/request
6969
*
7070
* @param {{}} customRequestOptions
7171
*/
72-
setGlobalRequestOptions(customRequestOptions: {}): void;
72+
setGlobalRequestOptions(customRequestOptions: object): void;
7373

7474
/**
7575
* Sets the API URL for MediaWiki requests

src/test/suite/index-web.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
// eslint-disable-next-line @typescript-eslint/no-require-imports
67
require('mocha/mocha'); // import the mocha web build
78

89
export function run(): Promise<void> {

0 commit comments

Comments
 (0)