diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json new file mode 100644 index 0000000..b1a13f3 --- /dev/null +++ b/packages/eslint-config/package.json @@ -0,0 +1,56 @@ +{ + "name": "@zotero-plugin/eslint-config", + "type": "module", + "version": "0.2.0-beta.19", + "packageManager": "pnpm@9.15.2", + "description": "ESLint config for zotero plugin.", + "license": "AGPL-3.0-or-later", + "homepage": "https://github.com/northword/zotero-plugin-scaffold#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/northword/zotero-plugin-scaffold.git" + }, + "bugs": { + "url": "https://github.com/northword/zotero-plugin-scaffold/issues" + }, + "exports": { + ".": "./dist/index.js" + }, + "main": "./dist/index.js", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "publishConfig": { + "access": "public" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "scripts": { + "dev": "eslint-config-inspector --config eslint-inspector.config.ts", + "build": "pnpm run build:typegen && tsup", + "build:typegen": "tsx scripts/typegen.ts", + "build:inspector": "eslint-config-inspector build --config eslint-inspector.config.ts", + "lint": "eslint --flag unstable_ts_config .", + "lint:fix": "pnpm run lint --fix", + "typecheck": "tsc --noEmit", + "prepublishOnly": "pnpm run build" + }, + "peerDependencies": { + "eslint": "^9.5.0" + }, + "dependencies": { + "@eslint/js": "^9.17.0", + "eslint-config-flat-gitignore": "^0.3.0", + "typescript-eslint": "^8.18.2" + }, + "devDependencies": { + "@eslint/config-inspector": "^0.6.0", + "eslint-typegen": "^0.3.2", + "importx": "^0.5.1", + "tsup": "^8.3.5", + "tsx": "^4.19.2" + } +} diff --git a/packages/eslint-config/src/configs/ignores.ts b/packages/eslint-config/src/configs/ignores.ts new file mode 100644 index 0000000..379b6a3 --- /dev/null +++ b/packages/eslint-config/src/configs/ignores.ts @@ -0,0 +1,13 @@ +import type { Linter } from "eslint"; +import pluginIgnore from "eslint-config-flat-gitignore"; + +export const ignores: Linter.Config[] = [ + { + name: "zotero-plugin/global-ignores", + ignores: ["**/node_modules/**", "**/dist/**", "**/build/**", "**/.scaffold/**"], + }, + { + ...pluginIgnore({ strict: false }), + name: "sxzz/gitignore", + }, +]; diff --git a/packages/eslint-config/src/configs/javascript.ts b/packages/eslint-config/src/configs/javascript.ts new file mode 100644 index 0000000..e69de29 diff --git a/packages/eslint-config/src/configs/zotero-plugin.ts b/packages/eslint-config/src/configs/zotero-plugin.ts new file mode 100644 index 0000000..c71e4cc --- /dev/null +++ b/packages/eslint-config/src/configs/zotero-plugin.ts @@ -0,0 +1,18 @@ +import type { Config } from "../types"; + +export const specialCases: Config[] = [ + { + files: ["**/prefs.js"], + name: "zotero-plugin/special/prefs", + rules: { + "no-undef": "off", + }, + }, + { + files: ["**/bootstrap.{js,ts}"], + name: "zotero-plugin/special/bootstrap", + rules: { + "no-undef": "off", + }, + }, +]; diff --git a/packages/eslint-config/src/index.ts b/packages/eslint-config/src/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/packages/eslint-config/src/presets.ts b/packages/eslint-config/src/presets.ts new file mode 100644 index 0000000..e69de29 diff --git a/packages/eslint-config/src/types.ts b/packages/eslint-config/src/types.ts new file mode 100644 index 0000000..f63c097 --- /dev/null +++ b/packages/eslint-config/src/types.ts @@ -0,0 +1,4 @@ +import type { Linter } from "eslint"; +import type { Rules } from "./typegen"; + +export type Config = Linter.Config; diff --git a/packages/eslint-config/tsconfig.json b/packages/eslint-config/tsconfig.json new file mode 100644 index 0000000..2713066 --- /dev/null +++ b/packages/eslint-config/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "esnext", + "lib": ["es2022"], + "module": "esnext", + "moduleResolution": "bundler", + "types": ["node"], + "strict": true, + "noUnusedLocals": true, + "declaration": true, + "noEmit": true, + "esModuleInterop": true, + "skipLibCheck": true + }, + "include": ["src"] +}