Skip to content

Commit a46a29a

Browse files
authored
refactor: add missing type annotations to variables (#472)
1 parent dec9ece commit a46a29a

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

src/language/markdown-source-code.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ export class MarkdownSourceCode extends TextSourceCodeBase {
205205
* that ESLint needs to further process the directives.
206206
*/
207207
getDisableDirectives() {
208+
/** @type {Array<FileProblem>} */
208209
const problems = [];
210+
/** @type {Array<Directive>} */
209211
const directives = [];
210212

211213
this.getInlineConfigNodes().forEach(comment => {
@@ -263,7 +265,9 @@ export class MarkdownSourceCode extends TextSourceCodeBase {
263265
* that ESLint needs to further process the rule configurations.
264266
*/
265267
applyInlineConfig() {
268+
/** @type {Array<FileProblem>} */
266269
const problems = [];
270+
/** @type {Array<{config:{rules:RulesConfig},loc:SourceLocation}>} */
267271
const configs = [];
268272

269273
this.getInlineConfigNodes().forEach(comment => {

src/rules/no-missing-label-refs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ export default {
125125

126126
create(context) {
127127
const { sourceCode } = context;
128+
129+
/** @type {Array<{label:string,position:Position}>} */
128130
let allMissingReferences = [];
129131

130132
return {

src/rules/no-missing-link-fragments.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import GithubSlugger from "github-slugger";
1414
//-----------------------------------------------------------------------------
1515

1616
/**
17-
* @import { Node } from "mdast";
17+
* @import { Node, Link } from "mdast";
1818
* @import { MarkdownRuleDefinition } from "../types.js";
1919
* @typedef {"invalidFragment"} NoMissingLinkFragmentsMessageIds
2020
* @typedef {[{ ignoreCase?: boolean; allowPattern?: string }]} NoMissingLinkFragmentsOptions
@@ -110,6 +110,8 @@ export default {
110110

111111
const fragmentIds = new Set(["top"]);
112112
const slugger = new GithubSlugger();
113+
114+
/** @type {Array<{node: Link, fragment: string}>} */
113115
const linkNodes = [];
114116

115117
return {

src/rules/no-reversed-media-syntax.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function isInCodeSpan(matchIndex, codeSpans) {
4747
* @returns {Array<{startOffset: number, endOffset: number}>} Array of code span positions
4848
*/
4949
function findCodeSpans(node) {
50+
/** @type {Array<{startOffset: number, endOffset: number}>} */
5051
const codeSpans = [];
5152

5253
/**

0 commit comments

Comments
 (0)