Skip to content

Commit 5cdecc7

Browse files
committed
fix: types
1 parent df6b971 commit 5cdecc7

5 files changed

Lines changed: 23 additions & 14 deletions

File tree

src/configs/ignores.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import type { Linter } from "eslint";
1+
import type { Config } from "../types.js";
22
import pluginIgnore from "eslint-config-flat-gitignore";
33
import { GLOB_EXCLUDE } from "../globs.js";
44

5-
export const ignores: Linter.Config[] = [
5+
export const ignores: Config[] = [
66
{
77
name: "zotero-plugin/global-ignores",
88
ignores: [

src/configs/javascript.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { Linter } from "eslint";
1+
import type { Config } from "../types";
22
import eslintJs from "@eslint/js";
33

4-
export const javascript: Linter.Config[] = [
4+
export const javascript: Config[] = [
55
{
6-
name: "zotero-plugin/javascript",
76
...eslintJs.configs.recommended,
7+
name: "zotero-plugin/javascript",
88
},
99
];

src/configs/mocha.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import type { Linter } from "eslint";
1+
import type { Config } from "../types.js";
22
import mochaPlugin from "eslint-plugin-mocha";
33
import { GLOB_TEST } from "../globs.js";
44

5-
export const mocha: Linter.Config[] = [
5+
export const mocha: Config[] = [
66
{
7-
files: [GLOB_TEST],
8-
plugins: {
9-
mochaPlugin,
10-
},
7+
...mochaPlugin.configs!.recommended,
8+
files: [GLOB_TEST, "**/*.test.ts"],
9+
name: "zotero-plugin/mocha",
1110
},
1211
];

src/configs/typescript.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { Linter } from "eslint";
21
import type { Config } from "../types.js";
32
import tseslint from "typescript-eslint";
43
import { GLOB_DTS, GLOB_TS, GLOB_TSX } from "../globs.js";
@@ -19,7 +18,7 @@ export const typescriptCore = tseslint.config({
1918
},
2019
}) as Config[];
2120

22-
export const typescript: Linter.Config[] = [
21+
export const typescript: Config[] = [
2322
...typescriptCore,
2423
{
2524
files: [GLOB_DTS],

src/types.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
import type { Linter } from "eslint";
22
import type { Rules } from "./typegen";
33

4-
export type Config = Linter.Config<Linter.RulesRecord & Rules>;
4+
export type Config = Omit<
5+
Linter.Config<Linter.RulesRecord & Rules>,
6+
"plugins"
7+
> & {
8+
// Relax plugins type limitation, as most of the plugins did not have correct type info yet.
9+
/**
10+
* An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
11+
*
12+
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
13+
*/
14+
plugins?: Record<string, any>;
15+
};

0 commit comments

Comments
 (0)