From 124f9fad59a259d74db902169c4a9a6a02e9e182 Mon Sep 17 00:00:00 2001 From: Pixel998 Date: Tue, 13 Jan 2026 15:06:56 +0300 Subject: [PATCH 1/2] refactor: use types from `@eslint/plugin-kit` --- package.json | 2 +- src/types.ts | 20 ++++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index af3412e3..690d6094 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ }, "dependencies": { "@eslint/core": "^0.17.0", - "@eslint/plugin-kit": "^0.4.1", + "@eslint/plugin-kit": "^0.6.0", "github-slugger": "^2.0.0", "mdast-util-from-markdown": "^2.0.2", "mdast-util-frontmatter": "^2.0.1", diff --git a/src/types.ts b/src/types.ts index 3499acf6..7f0e1481 100644 --- a/src/types.ts +++ b/src/types.ts @@ -39,25 +39,17 @@ import type { Yaml, } from "mdast"; import type { - CustomRuleDefinitionType, - CustomRuleTypeDefinitions, LanguageContext, LanguageOptions, RuleVisitor, } from "@eslint/core"; +import type { + CustomRuleDefinitionType, + CustomRuleTypeDefinitions, + CustomRuleVisitorWithExit, +} from "@eslint/plugin-kit"; import type { MarkdownSourceCode } from "./index.js"; -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** Adds matching `:exit` selectors for all properties of a `RuleVisitor`. */ -type WithExit = { - [Key in keyof RuleVisitorType as - | Key - | `${Key & string}:exit`]: RuleVisitorType[Key]; -}; - //------------------------------------------------------------------------------ // Exports //------------------------------------------------------------------------------ @@ -132,7 +124,7 @@ export type MarkdownLanguageContext = LanguageContext; export interface MarkdownRuleVisitor extends RuleVisitor, - WithExit< + CustomRuleVisitorWithExit< { root?(node: Root): void; } & { From 5543b6e1fe8c1fa699e098812c0943e952ee6f00 Mon Sep 17 00:00:00 2001 From: Pixel998 Date: Sun, 15 Feb 2026 12:54:56 +0300 Subject: [PATCH 2/2] update @eslint/core --- package.json | 2 +- src/index.js | 2 +- tests/types/types.test.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 28372acb..d09dbcab 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "yorkie": "^2.0.0" }, "dependencies": { - "@eslint/core": "^0.17.0", + "@eslint/core": "^1.1.0", "@eslint/plugin-kit": "^0.6.0", "github-slugger": "^2.0.0", "mdast-util-from-markdown": "^2.0.2", diff --git a/src/index.js b/src/index.js index fcfe99d2..f33e1fdf 100644 --- a/src/index.js +++ b/src/index.js @@ -25,7 +25,7 @@ import rules from "./build/rules.js"; // Exports //----------------------------------------------------------------------------- -/** @type {Linter.RulesRecord} */ +/** @satisfies {Linter.RulesRecord} */ const processorRulesConfig = { // The Markdown parser automatically trims trailing // newlines from code blocks. diff --git a/tests/types/types.test.ts b/tests/types/types.test.ts index f7aa43dd..6f423470 100644 --- a/tests/types/types.test.ts +++ b/tests/types/types.test.ts @@ -8,8 +8,8 @@ import type { RangeMap, Block, } from "@eslint/markdown"; -import type { SourceLocation, SourceRange } from "@eslint/core"; -import type { ESLint, Linter } from "eslint"; +import type { Plugin, SourceLocation, SourceRange } from "@eslint/core"; +import type { Linter } from "eslint"; import type { Position } from "unist"; import type { // Nodes (abstract) @@ -89,7 +89,7 @@ const invalidBlock: Block = { value: "code", }; -markdown satisfies ESLint.Plugin; +markdown satisfies Plugin; markdown.meta.name satisfies string; markdown.meta.version satisfies string;