Skip to content

Commit bb0cc40

Browse files
chore: add JSONC AST node types to RuleListener nodes (#269)
1 parent 247c013 commit bb0cc40

21 files changed

+44
-41
lines changed

lib/rules/key-name-casing.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { AST } from "jsonc-eslint-parser";
21
import { createRule } from "../utils";
32
import type { CasingKind } from "../utils/casing";
43
import { getChecker, allowedCaseOptions } from "../utils/casing";
@@ -91,7 +90,7 @@ export default createRule("key-name-casing", {
9190
}
9291

9392
return {
94-
JSONProperty(node: AST.JSONProperty) {
93+
JSONProperty(node) {
9594
const name =
9695
node.key.type === "JSONLiteral" && typeof node.key.value === "string"
9796
? node.key.value

lib/rules/no-bigint-literals.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { AST } from "jsonc-eslint-parser";
21
import { createRule } from "../utils";
32
import { getSourceCode } from "eslint-compat-utils";
43

@@ -22,7 +21,7 @@ export default createRule("no-bigint-literals", {
2221
return {};
2322
}
2423
return {
25-
JSONLiteral(node: AST.JSONLiteral) {
24+
JSONLiteral(node) {
2625
if (node.bigint != null) {
2726
context.report({
2827
loc: node.loc,

lib/rules/no-binary-expression.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { AST } from "jsonc-eslint-parser";
21
import { getStaticJSONValue } from "jsonc-eslint-parser";
32
import { createRule } from "../utils";
43
import { getSourceCode } from "eslint-compat-utils";
@@ -26,7 +25,7 @@ export default createRule("no-binary-expression", {
2625
}
2726

2827
return {
29-
JSONBinaryExpression(node: AST.JSONBinaryExpression) {
28+
JSONBinaryExpression(node) {
3029
context.report({
3130
loc: node.loc,
3231
messageId: "disallow",

lib/rules/no-binary-numeric-literals.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { AST } from "jsonc-eslint-parser";
21
import { createRule } from "../utils";
32
import { getSourceCode } from "eslint-compat-utils";
43

@@ -25,7 +24,7 @@ export default createRule("no-binary-numeric-literals", {
2524
return {};
2625
}
2726
return {
28-
JSONLiteral(node: AST.JSONLiteral) {
27+
JSONLiteral(node) {
2928
if (
3029
typeof node.value === "number" &&
3130
binaryNumericLiteralPattern.test(node.raw)

lib/rules/no-escape-sequence-in-identifier.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ export default createRule("no-escape-sequence-in-identifier", {
2424
return {};
2525
}
2626
return {
27-
JSONIdentifier(node: AST.JSONIdentifier) {
27+
JSONIdentifier(node) {
2828
verify(node);
2929
},
3030
};
3131

3232
/**
3333
* verify
3434
*/
35-
function verify(node: AST.JSONNode) {
35+
function verify(node: AST.JSONIdentifier) {
3636
const escapeMatcher = new PatternMatcher(/\\u\{[\dA-Fa-f]+\}|\\u\d{4}/gu);
3737
const text = sourceCode.text.slice(...node.range);
3838
for (const match of escapeMatcher.execAll(text)) {

lib/rules/no-hexadecimal-numeric-literals.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { AST } from "jsonc-eslint-parser";
21
import { createRule } from "../utils";
32
import { getSourceCode } from "eslint-compat-utils";
43

@@ -25,7 +24,7 @@ export default createRule("no-hexadecimal-numeric-literals", {
2524
return {};
2625
}
2726
return {
28-
JSONLiteral(node: AST.JSONLiteral) {
27+
JSONLiteral(node) {
2928
if (
3029
typeof node.value === "number" &&
3130
hexadecimalNumericLiteralPattern.test(node.raw)

lib/rules/no-infinity.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { AST } from "jsonc-eslint-parser";
21
import { isNumberIdentifier } from "jsonc-eslint-parser";
32
import { createRule } from "../utils";
43
import { getSourceCode } from "eslint-compat-utils";
@@ -23,7 +22,7 @@ export default createRule("no-infinity", {
2322
return {};
2423
}
2524
return {
26-
JSONIdentifier(node: AST.JSONIdentifier) {
25+
JSONIdentifier(node) {
2726
if (!isNumberIdentifier(node)) {
2827
return;
2928
}

lib/rules/no-nan.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { AST } from "jsonc-eslint-parser";
21
import { isNumberIdentifier } from "jsonc-eslint-parser";
32
import { createRule } from "../utils";
43
import { getSourceCode } from "eslint-compat-utils";
@@ -23,7 +22,7 @@ export default createRule("no-nan", {
2322
return {};
2423
}
2524
return {
26-
JSONIdentifier(node: AST.JSONIdentifier) {
25+
JSONIdentifier(node) {
2726
if (!isNumberIdentifier(node)) {
2827
return;
2928
}

lib/rules/no-number-props.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { AST } from "jsonc-eslint-parser";
21
import { createRule } from "../utils";
32
import { getSourceCode } from "eslint-compat-utils";
43

@@ -23,7 +22,7 @@ export default createRule("no-number-props", {
2322
return {};
2423
}
2524
return {
26-
JSONProperty(node: AST.JSONProperty) {
25+
JSONProperty(node) {
2726
if (node.key.type !== "JSONLiteral") {
2827
return;
2928
}

lib/rules/no-numeric-separators.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { AST } from "jsonc-eslint-parser";
21
import { createRule } from "../utils";
32
import { getSourceCode } from "eslint-compat-utils";
43

@@ -23,7 +22,7 @@ export default createRule("no-numeric-separators", {
2322
return {};
2423
}
2524
return {
26-
JSONLiteral(node: AST.JSONLiteral) {
25+
JSONLiteral(node) {
2726
if (typeof node.value !== "number") {
2827
return;
2928
}

0 commit comments

Comments
 (0)