Skip to content

Commit 8f172be

Browse files
authored
fix: error when used with @eslint/json (#529)
* fix: error when used with @eslint/json * Create slow-phones-look.md * Update slow-phones-look.md * fix * fix * fix * revert
1 parent 1199a0a commit 8f172be

25 files changed

+115
-28
lines changed

.changeset/slow-phones-look.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-astro": patch
3+
---
4+
5+
fix: error when used with `@eslint/json`

.github/workflows/NodeCI.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,27 @@ jobs:
5454
run: npm test
5555
- name: Type Test
5656
run: npm run test:type
57+
# test-for-eslint-v10:
58+
# runs-on: ubuntu-latest
59+
# strategy:
60+
# matrix:
61+
# node-version: [20.x, 22.x, 24.x]
62+
# steps:
63+
# - uses: actions/checkout@v6
64+
# - name: Use Node.js ${{ matrix.node-version }}
65+
# uses: actions/setup-node@v6
66+
# with:
67+
# node-version: ${{ matrix.node-version }}
68+
# - name: Install eslint v10
69+
# run: |+
70+
# npm i -D eslint@10 -f
71+
# npx rimraf node_modules
72+
# - name: Install Packages
73+
# run: npm install -f
74+
# - name: Test
75+
# run: npm test
76+
# - name: Type Test
77+
# run: npm run test:type
5778
test-for-eslint-v8:
5879
runs-on: ubuntu-latest
5980
steps:

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
"test:type": "tsc --noEmit",
2929
"cover": "nyc --reporter=lcov npm run test",
3030
"debug": "npm run mocha -- \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
31-
"lint": "eslint .",
31+
"lint": "npm run lint:js && npm run lint:ts",
32+
"lint:js": "eslint .",
33+
"lint:ts": "tsc --noEmit",
3234
"eslint-fix": "eslint . --fix",
3335
"update": "npm run ts -- ./tools/update.ts",
3436
"new": "npm run ts -- ./tools/new-rule.ts",
@@ -85,6 +87,7 @@
8587
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
8688
"@eslint/eslintrc": "^3.0.0",
8789
"@eslint/js": "^9.0.0",
90+
"@eslint/json": "^1.0.1",
8891
"@ota-meshi/eslint-plugin": "^0.18.0",
8992
"@types/eslint-scope": "^8.0.0",
9093
"@types/eslint-utils": "^3.0.1",

src/a11y/rules.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function defineWrapperListener(
9696
context: RuleContext,
9797
): RuleListener {
9898
const sourceCode = getSourceCode(context)
99-
if (!sourceCode.parserServices.isAstro) {
99+
if (!sourceCode.parserServices?.isAstro) {
100100
return {}
101101
}
102102
const listener = coreRule.create(context)
@@ -114,7 +114,7 @@ function defineWrapperListener(
114114
node: never,
115115
...args: never[]
116116
) {
117-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, no-invalid-this -- ignore
117+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ignore
118118
;(original as any).call(this, getProxyNode(node), ...args)
119119
}
120120

src/rules/missing-client-only-directive-value.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default createRule("missing-client-only-directive-value", {
2121
},
2222
create(context) {
2323
const sourceCode = getSourceCode(context)
24-
if (!sourceCode.parserServices.isAstro) {
24+
if (!sourceCode.parserServices?.isAstro) {
2525
return {}
2626
}
2727

src/rules/no-conflict-set-directives.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default createRule("no-conflict-set-directives", {
2020
},
2121
create(context) {
2222
const sourceCode = getSourceCode(context)
23-
if (!sourceCode.parserServices.isAstro) {
23+
if (!sourceCode.parserServices?.isAstro) {
2424
return {}
2525
}
2626

src/rules/no-deprecated-astro-canonicalurl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default createRule("no-deprecated-astro-canonicalurl", {
2020
},
2121
create(context) {
2222
const sourceCode = getSourceCode(context)
23-
if (!sourceCode.parserServices.isAstro) {
23+
if (!sourceCode.parserServices?.isAstro) {
2424
return {}
2525
}
2626

src/rules/no-deprecated-astro-fetchcontent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default createRule("no-deprecated-astro-fetchcontent", {
2121
},
2222
create(context) {
2323
const sourceCode = getSourceCode(context)
24-
if (!sourceCode.parserServices.isAstro) {
24+
if (!sourceCode.parserServices?.isAstro) {
2525
return {}
2626
}
2727

src/rules/no-deprecated-astro-resolve.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default createRule("no-deprecated-astro-resolve", {
1919
},
2020
create(context) {
2121
const sourceCode = getSourceCode(context)
22-
if (!sourceCode.parserServices.isAstro) {
22+
if (!sourceCode.parserServices?.isAstro) {
2323
return {}
2424
}
2525

src/rules/no-deprecated-getentrybyslug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default createRule("no-deprecated-getentrybyslug", {
1919
},
2020
create(context) {
2121
const sourceCode = getSourceCode(context)
22-
if (!sourceCode.parserServices.isAstro) {
22+
if (!sourceCode.parserServices?.isAstro) {
2323
return {}
2424
}
2525

0 commit comments

Comments
 (0)