Skip to content

Commit 21904d6

Browse files
authored
fix: type bug with eslint v10 (#569)
* fix: type bug with eslint v10 * Create old-chefs-add.md
1 parent b5955da commit 21904d6

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

.changeset/old-chefs-add.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-yml": patch
3+
---
4+
5+
fix: type bug with eslint v10

src/language/yaml-source-code.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,9 @@ export class YAMLSourceCode extends TextSourceCodeBase<{
445445
return null;
446446
},
447447
getDeclaredVariables: () => [],
448+
addGlobals: () => {
449+
// noop
450+
},
448451
};
449452
}
450453

src/utils/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint @typescript-eslint/no-explicit-any: off -- util */
2-
import type { RuleModule, PartialRuleModule } from "../types.js";
2+
import type { RuleModule, PartialRuleModule, RuleContext } from "../types.js";
33
import type { Rule } from "eslint";
44
import * as yamlESLintParser from "yaml-eslint-parser";
55
import path from "node:path";
@@ -23,8 +23,8 @@ export function createRule(
2323
ruleName,
2424
},
2525
},
26-
create(context: Rule.RuleContext): any {
27-
const sourceCode = context.sourceCode;
26+
create(context: RuleContext): any {
27+
const sourceCode = (context as unknown as Rule.RuleContext).sourceCode;
2828
if (
2929
typeof sourceCode.parserServices?.defineCustomBlocksVisitor ===
3030
"function" &&
@@ -43,7 +43,7 @@ export function createRule(
4343
},
4444
);
4545
}
46-
return rule.create(context as any, {
46+
return rule.create(context, {
4747
customBlock: false,
4848
});
4949
},

tsconfig.build.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"exclude": ["tests/**/*", "tools/**/*", "typings/**/*", "docs/**/*"],
44
"compilerOptions": {
55
"removeComments": true /* Do not emit comments to output. */,
6-
"noEmit": false,
7-
"allowImportingTsExtensions": false
6+
"noEmit": true
87
}
98
}

0 commit comments

Comments
 (0)