chore: bump eslint to v9

This commit is contained in:
Northword 2024-05-15 20:00:23 +08:00
parent 3e28d58239
commit cc31172a85
4 changed files with 40 additions and 57 deletions

2
addon/bootstrap.js vendored
View File

@ -1,3 +1,5 @@
/* eslint-disable no-undef */
/** /**
* Most of this code is from Zotero team's official Make It Red example[1] * Most of this code is from Zotero team's official Make It Red example[1]
* or the Zotero 7 documentation[2]. * or the Zotero 7 documentation[2].

32
eslint.config.mjs Normal file
View File

@ -0,0 +1,32 @@
// @ts-check Let TS check this config file
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
export default tseslint.config(
{
ignores: ["build/**", "dist/**", "node_modules/**", "scripts/"],
},
{
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
rules: {
"@typescript-eslint/ban-ts-comment": [
"warn",
{
"ts-expect-error": "allow-with-description",
"ts-ignore": "allow-with-description",
"ts-nocheck": "allow-with-description",
"ts-check": "allow-with-description",
},
],
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": [
"off",
{
ignoreRestArgs: true,
},
],
"@typescript-eslint/no-non-null-assertion": "off",
},
},
);

View File

@ -22,7 +22,7 @@
"scripts": { "scripts": {
"start": "zotero-plugin serve", "start": "zotero-plugin serve",
"build": "tsc --noEmit && zotero-plugin build", "build": "tsc --noEmit && zotero-plugin build",
"lint": "prettier --write . && eslint . --ext .ts --fix", "lint": "prettier --write . && eslint . --fix",
"release": "zotero-plugin release", "release": "zotero-plugin release",
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"update-deps": "npm update --save" "update-deps": "npm update --save"
@ -31,65 +31,14 @@
"zotero-plugin-toolkit": "^2.3.31" "zotero-plugin-toolkit": "^2.3.31"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.2.0",
"@types/node": "^20.12.12", "@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^7.9.0", "eslint": "^9.2.0",
"@typescript-eslint/parser": "^7.9.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.2.5", "prettier": "^3.2.5",
"typescript": "^5.4.5", "typescript": "^5.4.5",
"typescript-eslint": "^7.9.0",
"zotero-plugin-scaffold": "^0.0.22", "zotero-plugin-scaffold": "^0.0.22",
"zotero-types": "^1.3.24" "zotero-types": "^2.0.0"
},
"eslintConfig": {
"env": {
"browser": true,
"es2021": true
},
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/ban-ts-comment": [
"warn",
{
"ts-expect-error": "allow-with-description",
"ts-ignore": "allow-with-description",
"ts-nocheck": "allow-with-description",
"ts-check": "allow-with-description"
}
],
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": [
"off",
{
"ignoreRestArgs": true
}
],
"@typescript-eslint/no-non-null-assertion": "off"
},
"ignorePatterns": [
"**/.vscode/**",
"**/build/**",
"**/logs/**",
"**/dist/**",
"**/node_modules/**",
"**/scripts/**",
"**/*.js",
"**/*.bak"
]
}, },
"prettier": { "prettier": {
"printWidth": 80, "printWidth": 80,

View File

@ -40,7 +40,7 @@ async function onMainWindowLoad(win: Window): Promise<void> {
// Create ztoolkit for every window // Create ztoolkit for every window
addon.data.ztoolkit = createZToolkit(); addon.data.ztoolkit = createZToolkit();
// @ts-ignore // @ts-ignore This is a moz feature
window.MozXULElement.insertFTLIfNeeded(`${config.addonRef}-mainWindow.ftl`); window.MozXULElement.insertFTLIfNeeded(`${config.addonRef}-mainWindow.ftl`);
const popupWin = new ztoolkit.ProgressWindow(config.addonName, { const popupWin = new ztoolkit.ProgressWindow(config.addonName, {