Skip to content

Commit 0bfc8f6

Browse files
authored
refactor: switch MarkdownSourceCode to extend TextSourceCodeBase (#356)
* refactor: switch MarkdownSourceCode to extend TextSourceCodeBase * upgrade packages * remove unused ts-expect-error
1 parent a83a2d1 commit 0bfc8f6

File tree

4 files changed

+3
-19
lines changed

4 files changed

+3
-19
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
"yorkie": "^2.0.0"
8888
},
8989
"dependencies": {
90-
"@eslint/core": "^0.13.0",
91-
"@eslint/plugin-kit": "^0.2.8",
90+
"@eslint/core": "^0.14.0",
91+
"@eslint/plugin-kit": "^0.3.1",
9292
"mdast-util-from-markdown": "^2.0.2",
9393
"mdast-util-frontmatter": "^2.0.1",
9494
"mdast-util-gfm": "^3.0.0",

src/language/markdown-source-code.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@ import { findOffsets } from "../util.js";
3232
/** @typedef {import("@eslint/core").FileProblem} FileProblem */
3333
/** @typedef {import("@eslint/core").DirectiveType} DirectiveType */
3434
/** @typedef {import("@eslint/core").RulesConfig} RulesConfig */
35-
/**
36-
* @typedef {import("@eslint/core").TextSourceCode<Options>} TextSourceCode<Options>
37-
* @template {SourceCodeBaseTypeOptions} [Options=SourceCodeBaseTypeOptions]
38-
*/
3935
/** @typedef {import("../types.ts").MarkdownLanguageOptions} MarkdownLanguageOptions */
40-
/** @typedef {import("../types.ts").SourceCodeBaseTypeOptions} SourceCodeBaseTypeOptions */
4136

4237
//-----------------------------------------------------------------------------
4338
// Helpers
@@ -141,7 +136,7 @@ function extractInlineConfigCommentsFromHTML(node) {
141136

142137
/**
143138
* Markdown Source Code Object
144-
* @implements {TextSourceCode<{LangOptions: MarkdownLanguageOptions, RootNode: RootNode, SyntaxElementWithLoc: MarkdownNode, ConfigNode: { value: string; position: SourceLocation }}>}
139+
* @extends {TextSourceCodeBase<{LangOptions: MarkdownLanguageOptions, RootNode: RootNode, SyntaxElementWithLoc: MarkdownNode, ConfigNode: { value: string; position: SourceLocation }}>}
145140
*/
146141
export class MarkdownSourceCode extends TextSourceCodeBase {
147142
/**

src/types.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,6 @@ export interface MarkdownLanguageOptions extends LanguageOptions {
116116
*/
117117
export type MarkdownLanguageContext = LanguageContext<MarkdownLanguageOptions>;
118118

119-
/**
120-
* Generic options for the `SourceCodeBase` type.
121-
*/
122-
export interface SourceCodeBaseTypeOptions {
123-
LangOptions: LanguageOptions;
124-
RootNode: unknown;
125-
SyntaxElementWithLoc: unknown;
126-
ConfigNode: unknown;
127-
}
128-
129119
export interface MarkdownRuleVisitor
130120
extends RuleVisitor,
131121
WithExit<

tests/types/types.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ typeof processorPlugins satisfies {};
9393
sourceCode.getLoc(node) satisfies SourceLocation;
9494
sourceCode.getRange(node) satisfies SourceRange;
9595
sourceCode.getParent(node) satisfies Node | undefined;
96-
// @ts-expect-error It should be fixed in https://github.com/eslint/markdown/issues/341
9796
sourceCode.getAncestors(node) satisfies Node[];
9897
sourceCode.getText(node) satisfies string;
9998
}

0 commit comments

Comments
 (0)