Skip to content

Commit

Permalink
Upgrade eslint 9
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederisk committed Aug 1, 2024
1 parent 6acd846 commit 7ed5602
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 231 deletions.
27 changes: 0 additions & 27 deletions .eslintrc.yml

This file was deleted.

38 changes: 38 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
files: ['**/*.ts'],
ignores: ["**/out", "**/dist", "**/*.d.ts", "**/webpack.config.js", '**/eslint.config.mjs'],
}, ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"), {
plugins: {
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: "module"
},

rules: {
"@typescript-eslint/naming-convention": "warn",
semi: "warn",
curly: "warn",
eqeqeq: "warn",
"no-throw-literal": "warn",
"@typescript-eslint/no-explicit-any" : "warn",
},
}];
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
"vscode:prepublish": "yarn run compile",
"compile": "yarn run convert && webpack --config webpack.config.js --mode production",
"compile-debug": "yarn run convert && webpack --config webpack.config.js --mode development",
"lint": "eslint -c .eslintrc.yml --ext .ts ./src",
"lint": "eslint -c ./eslint.config.mjs ./src",
"watch": "yarn run convert && webpack --config webpack.config.js --mode development --watch",
"pretest": "yarn run compile-debug && yarn run lint",
"test": "yarn run test-node && yarn run test-web",
Expand All @@ -276,12 +276,12 @@
"@types/glob": "^7.2.0",
"@types/luxon": "^2.0.7",
"@types/mocha": "^9.0.0",
"@types/node": "^16.11.10",
"@types/node": "^20.14.13",
"@types/node-fetch": "^2.5.12",
"@types/vscode": "^1.64.0",
"@types/webpack-env": "^1.18.0",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@vscode/test-electron": "^2.2.0",
"@vscode/test-web": "^0.0.56",
"assert": "^2.0.0",
Expand All @@ -291,7 +291,8 @@
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"eslint": "^8.3.0",
"eslint": "^9.8.0",
"tslib": "^2.6.3",
"glob": "^7.2.0",
"https-browserify": "^1.0.0",
"js-yaml": "^4.1.0",
Expand Down
1 change: 1 addition & 0 deletions src/interface_definition/IObjectConverter.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-expressions */
interface IObjectConverter<TargetType> {
toResult(json: unknown): TargetType;
resultToJson(value: TargetType): unknown;
Expand Down
6 changes: 3 additions & 3 deletions src/interface_definition/mwbot.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ declare module 'mwbot' {
* @param {{}} [customOptions] Custom options
* @param {{}} [customRequestOptions] Custom request options
*/
constructor(customOptions?: {}, customRequestOptions?: {});
constructor(customOptions?: object, customRequestOptions?: object);

//////////////////////////////////////////
// GETTER & SETTER //
Expand All @@ -61,15 +61,15 @@ declare module 'mwbot' {
*
* @param {Object} customOptions
*/
public setOptions(customOptions: Object): void;
public setOptions(customOptions: object): void;

/**
* Sets and overwrites the raw request options, used by the "request" library
* See https://www.npmjs.com/package/request
*
* @param {{}} customRequestOptions
*/
setGlobalRequestOptions(customRequestOptions: {}): void;
setGlobalRequestOptions(customRequestOptions: object): void;

/**
* Sets the API URL for MediaWiki requests
Expand Down
1 change: 1 addition & 0 deletions src/test/suite/index-web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

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

export function run(): Promise<void> {
Expand Down
Loading

0 comments on commit 7ed5602

Please sign in to comment.