Skip to content

Commit 5948835

Browse files
committed
feat: add @zotero-plugin/eslint-config
1 parent cba7cb3 commit 5948835

File tree

5 files changed

+160
-37
lines changed

5 files changed

+160
-37
lines changed

addon/bootstrap.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable no-undef */
2-
31
/**
42
* Most of this code is from Zotero team's official Make It Red example[1]
53
* or the Zotero 7 documentation[2].
@@ -33,9 +31,7 @@ async function startup({ id, version, resourceURI, rootURI }, reason) {
3331
* and all child variables assigned to it is globally accessible.
3432
* See `src/index.ts` for details.
3533
*/
36-
const ctx = {
37-
rootURI,
38-
};
34+
const ctx = { rootURI };
3935
ctx._globalThis = ctx;
4036

4137
Services.scriptloader.loadSubScript(

addon/prefs.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
/* eslint-disable no-undef */
21
pref("enable", true);
32
pref("input", "This is input");

eslint.config.mjs

+5-25
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
// @ts-check Let TS check this config file
22

3-
import eslint from "@eslint/js";
4-
import tseslint from "typescript-eslint";
3+
import zotero from "@zotero-plugin/eslint-config";
54

6-
export default tseslint.config(
5+
export default [
6+
...zotero(),
77
{
8-
ignores: ["build/**", ".scaffold/**", "node_modules/**", "scripts/"],
9-
},
10-
{
11-
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
8+
files: ["**/*.ts"],
129
rules: {
1310
"no-restricted-globals": [
1411
"error",
@@ -23,24 +20,7 @@ export default tseslint.config(
2320
},
2421
"Zotero_Tabs",
2522
],
26-
27-
"@typescript-eslint/ban-ts-comment": [
28-
"warn",
29-
{
30-
"ts-expect-error": "allow-with-description",
31-
"ts-ignore": "allow-with-description",
32-
"ts-nocheck": "allow-with-description",
33-
"ts-check": "allow-with-description",
34-
},
35-
],
3623
"@typescript-eslint/no-unused-vars": "off",
37-
"@typescript-eslint/no-explicit-any": [
38-
"off",
39-
{
40-
ignoreRestArgs: true,
41-
},
42-
],
43-
"@typescript-eslint/no-non-null-assertion": "off",
4424
},
4525
},
46-
);
26+
];

package-lock.json

+152-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@
3333
"zotero-plugin-toolkit": "^4.1.1"
3434
},
3535
"devDependencies": {
36-
"@eslint/js": "^9.21.0",
3736
"@types/node": "^22.13.5",
38-
"eslint": "^9.21.0",
3937
"prettier": "^3.5.2",
38+
"@zotero-plugin/eslint-config": "^0.2.6",
39+
"eslint": "^9.20.1",
4040
"typescript": "^5.7.3",
41-
"typescript-eslint": "^8.25.0",
4241
"zotero-plugin-scaffold": "^0.2.4",
4342
"zotero-types": "^3.1.7"
4443
},

0 commit comments

Comments
 (0)