From c84c87a2565f28a590cce1fd9100d813754b571e Mon Sep 17 00:00:00 2001 From: OM Date: Tue, 12 Mar 2024 21:49:01 +0000 Subject: [PATCH 1/4] wip: add new rule --- README.md | 1 + docs/rules.md | 1 + docs/rules/missing-client-directive-value.md | 60 +++++++++++++++++++ src/configs/recommended.ts | 1 + src/rules/missing-client-directive-value.ts | 45 ++++++++++++++ src/utils/rules.ts | 2 + .../SomeSvelteComponent.svelte | 7 +++ ...missing-client-directive-value-errors.json | 7 +++ ...missing-client-directive-value-input.astro | 5 ++ .../valid/client-only-value.astro | 8 +++ .../rules/missing-client-directive-value.ts | 16 +++++ 11 files changed, 153 insertions(+) create mode 100644 docs/rules/missing-client-directive-value.md create mode 100644 src/rules/missing-client-directive-value.ts create mode 100644 tests/fixtures/rules/missing-client-directive-value/SomeSvelteComponent.svelte create mode 100644 tests/fixtures/rules/missing-client-directive-value/invalid/missing-client-directive-value-errors.json create mode 100644 tests/fixtures/rules/missing-client-directive-value/invalid/missing-client-directive-value-input.astro create mode 100644 tests/fixtures/rules/missing-client-directive-value/valid/client-only-value.astro create mode 100644 tests/src/rules/missing-client-directive-value.ts diff --git a/README.md b/README.md index 2b61c204..783d6802 100644 --- a/README.md +++ b/README.md @@ -377,6 +377,7 @@ These rules relate to possible syntax or logic errors in Astro component code: | Rule ID | Description | | |:--------|:------------|:---| +| [astro/missing-client-directive-value](https://ota-meshi.github.io/eslint-plugin-astro/rules/missing-client-directive-value/) | the client directive is missing the correct component's framework value | ⭐ | | [astro/no-conflict-set-directives](https://ota-meshi.github.io/eslint-plugin-astro/rules/no-conflict-set-directives/) | disallow conflicting set directives and child contents | ⭐ | | [astro/no-deprecated-astro-canonicalurl](https://ota-meshi.github.io/eslint-plugin-astro/rules/no-deprecated-astro-canonicalurl/) | disallow using deprecated `Astro.canonicalURL` | ⭐ | | [astro/no-deprecated-astro-fetchcontent](https://ota-meshi.github.io/eslint-plugin-astro/rules/no-deprecated-astro-fetchcontent/) | disallow using deprecated `Astro.fetchContent()` | ⭐🔧 | diff --git a/docs/rules.md b/docs/rules.md index d3b156bd..2eec727f 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -13,6 +13,7 @@ These rules relate to possible syntax or logic errors in Astro component code: | Rule ID | Description | | |:--------|:------------|:---| +| [astro/missing-client-directive-value](./rules/missing-client-directive-value.md) | the client directive is missing the correct component's framework value | ⭐ | | [astro/no-conflict-set-directives](./rules/no-conflict-set-directives.md) | disallow conflicting set directives and child contents | ⭐ | | [astro/no-deprecated-astro-canonicalurl](./rules/no-deprecated-astro-canonicalurl.md) | disallow using deprecated `Astro.canonicalURL` | ⭐ | | [astro/no-deprecated-astro-fetchcontent](./rules/no-deprecated-astro-fetchcontent.md) | disallow using deprecated `Astro.fetchContent()` | ⭐🔧 | diff --git a/docs/rules/missing-client-directive-value.md b/docs/rules/missing-client-directive-value.md new file mode 100644 index 00000000..79111561 --- /dev/null +++ b/docs/rules/missing-client-directive-value.md @@ -0,0 +1,60 @@ +--- +title: "astro/missing-client-directive-value" +description: "the client directive is missing the correct component's framework value" +since: "v0.31.4" +--- + +# astro/missing-client-directive-value + +> the client directive is missing the correct component's framework value + +- ⚙ This rule is included in `"plugin:astro/recommended"`. + +## 📖 Rule Details + +This rule reports not setting a value for the `client:only` directive. + + + + + +```astro +--- +/* eslint astro/missing-client-directive-value: "error" */ + +--- + +{/* ✓ GOOD */} + + +{/* ✗ BAD */} + +``` + + + +## 🔧 Options + +``` + + + + + + +``` + + +## 📚 Further Reading + +- [Astro Documentation | Template Directives Reference > client:only](https://docs.astro.build/en/reference/directives-reference/#clientonly) + +## 🚀 Version + +This rule was introduced in eslint-plugin-astro v0.31.4 + +## 🔍 Implementation + +- [Rule source](https://github.com/ota-meshi/eslint-plugin-astro/blob/main/src/rules/missing-client-directive-value.ts) +- [Test source](https://github.com/ota-meshi/eslint-plugin-astro/blob/main/tests/src/rules/missing-client-directive-value.ts) +- [Test fixture sources](https://github.com/ota-meshi/eslint-plugin-astro/tree/main/tests/fixtures/rules/missing-client-directive-value) diff --git a/src/configs/recommended.ts b/src/configs/recommended.ts index 87b267f7..106605f6 100644 --- a/src/configs/recommended.ts +++ b/src/configs/recommended.ts @@ -9,6 +9,7 @@ export = { extends: [baseExtend], rules: { // eslint-plugin-astro rules + "astro/missing-client-directive-value": "error", "astro/no-conflict-set-directives": "error", "astro/no-deprecated-astro-canonicalurl": "error", "astro/no-deprecated-astro-fetchcontent": "error", diff --git a/src/rules/missing-client-directive-value.ts b/src/rules/missing-client-directive-value.ts new file mode 100644 index 00000000..0da0e1ea --- /dev/null +++ b/src/rules/missing-client-directive-value.ts @@ -0,0 +1,45 @@ +import type { AST } from "astro-eslint-parser" +import { createRule } from "../utils" +import { getStaticAttributeValue } from "../utils/ast-utils" +import { getSourceCode } from "../utils/compat" + +export default createRule("missing-client-directive-value", { + meta: { + docs: { + description: + "the client directive is missing the correct component's framework value", + category: "Possible Errors", + recommended: true, + }, + schema: [], + messages: { + missingValue: "`client:only` directive is missing a value", + }, + type: "problem", + }, + create(context) { + const sourceCode = getSourceCode(context) + if (!sourceCode.parserServices.isAstro) { + return {} + } + + /** VerifyDirectiveValue */ + function verifyDirectiveValue( + attr: AST.JSXAttribute | AST.AstroTemplateLiteralAttribute, + ) { + if (getStaticAttributeValue(attr) !== null) { + return + } + + context.report({ + node: attr.name, + messageId: "missingValue", + }) + } + + return { + JSXAttribute: verifyDirectiveValue, + AstroTemplateLiteralAttribute: verifyDirectiveValue, + } + }, +}) diff --git a/src/utils/rules.ts b/src/utils/rules.ts index 76b2bb58..2788d59f 100644 --- a/src/utils/rules.ts +++ b/src/utils/rules.ts @@ -2,6 +2,7 @@ // This file has been automatically generated, // in order to update its content execute "npm run update" import type { RuleModule } from "../types" +import missingClientDirectiveValue from "../rules/missing-client-directive-value" import noConflictSetDirectives from "../rules/no-conflict-set-directives" import noDeprecatedAstroCanonicalurl from "../rules/no-deprecated-astro-canonicalurl" import noDeprecatedAstroFetchcontent from "../rules/no-deprecated-astro-fetchcontent" @@ -19,6 +20,7 @@ import validCompile from "../rules/valid-compile" import { buildA11yRules } from "../a11y" export const rules = [ + missingClientDirectiveValue, noConflictSetDirectives, noDeprecatedAstroCanonicalurl, noDeprecatedAstroFetchcontent, diff --git a/tests/fixtures/rules/missing-client-directive-value/SomeSvelteComponent.svelte b/tests/fixtures/rules/missing-client-directive-value/SomeSvelteComponent.svelte new file mode 100644 index 00000000..0af8378d --- /dev/null +++ b/tests/fixtures/rules/missing-client-directive-value/SomeSvelteComponent.svelte @@ -0,0 +1,7 @@ + + +
+

Hello Svelte!

+
\ No newline at end of file diff --git a/tests/fixtures/rules/missing-client-directive-value/invalid/missing-client-directive-value-errors.json b/tests/fixtures/rules/missing-client-directive-value/invalid/missing-client-directive-value-errors.json new file mode 100644 index 00000000..e821bb68 --- /dev/null +++ b/tests/fixtures/rules/missing-client-directive-value/invalid/missing-client-directive-value-errors.json @@ -0,0 +1,7 @@ +[ + { + "message": "`client:only` directive is missing a value", + "line": 5, + "column": 22 + } +] diff --git a/tests/fixtures/rules/missing-client-directive-value/invalid/missing-client-directive-value-input.astro b/tests/fixtures/rules/missing-client-directive-value/invalid/missing-client-directive-value-input.astro new file mode 100644 index 00000000..1808b8bf --- /dev/null +++ b/tests/fixtures/rules/missing-client-directive-value/invalid/missing-client-directive-value-input.astro @@ -0,0 +1,5 @@ +--- +import SomeSvelteComponent from "../SomeSvelteComponent.svelte" +--- + + diff --git a/tests/fixtures/rules/missing-client-directive-value/valid/client-only-value.astro b/tests/fixtures/rules/missing-client-directive-value/valid/client-only-value.astro new file mode 100644 index 00000000..ff90bd69 --- /dev/null +++ b/tests/fixtures/rules/missing-client-directive-value/valid/client-only-value.astro @@ -0,0 +1,8 @@ +--- +import SomeSvelteComponent from "../SomeSvelteComponent.svelte" +let string = "svelte" +--- + + + + diff --git a/tests/src/rules/missing-client-directive-value.ts b/tests/src/rules/missing-client-directive-value.ts new file mode 100644 index 00000000..33e05f50 --- /dev/null +++ b/tests/src/rules/missing-client-directive-value.ts @@ -0,0 +1,16 @@ +import { RuleTester } from "../../utils/eslint-compat" +import rule from "../../../src/rules/missing-client-directive-value" +import { loadTestCases } from "../../utils/utils" + +const tester = new RuleTester({ + languageOptions: { + ecmaVersion: 2020, + sourceType: "module", + }, +}) + +tester.run( + "missing-client-directive-value", + rule as any, + loadTestCases("missing-client-directive-value"), +) From 947f287244ef86aa5e9434ae0d3d5161fd1ada7e Mon Sep 17 00:00:00 2001 From: OM Date: Sat, 23 Mar 2024 12:51:42 +0000 Subject: [PATCH 2/4] feat: add changeset file --- .changeset/slimy-pillows-change.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/slimy-pillows-change.md diff --git a/.changeset/slimy-pillows-change.md b/.changeset/slimy-pillows-change.md new file mode 100644 index 00000000..5b80ec38 --- /dev/null +++ b/.changeset/slimy-pillows-change.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-astro": minor +--- + +feat add `missing-directive-value` rule From 49513f7d2f526a753b9da71d502577807f68d376 Mon Sep 17 00:00:00 2001 From: OM Date: Sun, 24 Mar 2024 09:17:06 +0000 Subject: [PATCH 3/4] fix: add new check for the rule and more tests --- .changeset/slimy-pillows-change.md | 2 +- docs/rules/missing-client-directive-value.md | 10 +--------- src/rules/missing-client-directive-value.ts | 9 +++++++-- .../SomeSvelteComponent.svelte | 5 ++--- .../valid/client-only-value.astro | 1 + 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.changeset/slimy-pillows-change.md b/.changeset/slimy-pillows-change.md index 5b80ec38..31a2e4bf 100644 --- a/.changeset/slimy-pillows-change.md +++ b/.changeset/slimy-pillows-change.md @@ -2,4 +2,4 @@ "eslint-plugin-astro": minor --- -feat add `missing-directive-value` rule +feat add `astro/missing-directive-value` rule diff --git a/docs/rules/missing-client-directive-value.md b/docs/rules/missing-client-directive-value.md index 79111561..5f2a1560 100644 --- a/docs/rules/missing-client-directive-value.md +++ b/docs/rules/missing-client-directive-value.md @@ -1,7 +1,6 @@ --- title: "astro/missing-client-directive-value" description: "the client directive is missing the correct component's framework value" -since: "v0.31.4" --- # astro/missing-client-directive-value @@ -35,14 +34,7 @@ This rule reports not setting a value for the `client:only` directive. ## 🔧 Options -``` - - - - - - -``` +Nothing. ## 📚 Further Reading diff --git a/src/rules/missing-client-directive-value.ts b/src/rules/missing-client-directive-value.ts index 0da0e1ea..8b0bc300 100644 --- a/src/rules/missing-client-directive-value.ts +++ b/src/rules/missing-client-directive-value.ts @@ -1,6 +1,6 @@ import type { AST } from "astro-eslint-parser" import { createRule } from "../utils" -import { getStaticAttributeValue } from "../utils/ast-utils" +import { getAttributeName, getStaticAttributeValue } from "../utils/ast-utils" import { getSourceCode } from "../utils/compat" export default createRule("missing-client-directive-value", { @@ -27,7 +27,12 @@ export default createRule("missing-client-directive-value", { function verifyDirectiveValue( attr: AST.JSXAttribute | AST.AstroTemplateLiteralAttribute, ) { - if (getStaticAttributeValue(attr) !== null) { + const directiveName = getAttributeName(attr) + const directiveValue = getStaticAttributeValue(attr) + + if (directiveName !== "client:only") return + + if (directiveValue !== null) { return } diff --git a/tests/fixtures/rules/missing-client-directive-value/SomeSvelteComponent.svelte b/tests/fixtures/rules/missing-client-directive-value/SomeSvelteComponent.svelte index 0af8378d..8e5d3132 100644 --- a/tests/fixtures/rules/missing-client-directive-value/SomeSvelteComponent.svelte +++ b/tests/fixtures/rules/missing-client-directive-value/SomeSvelteComponent.svelte @@ -1,7 +1,6 @@
-

Hello Svelte!

-
\ No newline at end of file +

Hello Svelte!

+ diff --git a/tests/fixtures/rules/missing-client-directive-value/valid/client-only-value.astro b/tests/fixtures/rules/missing-client-directive-value/valid/client-only-value.astro index ff90bd69..a1aa6a99 100644 --- a/tests/fixtures/rules/missing-client-directive-value/valid/client-only-value.astro +++ b/tests/fixtures/rules/missing-client-directive-value/valid/client-only-value.astro @@ -5,4 +5,5 @@ let string = "svelte" + From f6f48cb544a7c7a0f10fc70a6b7fb2033f19ecd6 Mon Sep 17 00:00:00 2001 From: OM Date: Sun, 24 Mar 2024 17:06:57 +0000 Subject: [PATCH 4/4] fix: rename the rule from missing-client-only-directive-value --- .changeset/slimy-pillows-change.md | 2 +- README.md | 2 +- docs/rules.md | 2 +- ...=> missing-client-only-directive-value.md} | 21 ++++++++----------- src/configs/flat/recommended.ts | 1 + src/configs/recommended.ts | 2 +- ...=> missing-client-only-directive-value.ts} | 4 ++-- src/utils/rules.ts | 4 ++-- .../SomeSvelteComponent.svelte | 0 ...g-client-only-directive-value-errors.json} | 0 ...g-client-only-directive-value-input.astro} | 0 .../valid/client-only-value.astro | 0 ...=> missing-client-only-directive-value.ts} | 6 +++--- 13 files changed, 21 insertions(+), 23 deletions(-) rename docs/rules/{missing-client-directive-value.md => missing-client-only-directive-value.md} (53%) rename src/rules/{missing-client-directive-value.ts => missing-client-only-directive-value.ts} (88%) rename tests/fixtures/rules/{missing-client-directive-value => missing-client-only-directive-value}/SomeSvelteComponent.svelte (100%) rename tests/fixtures/rules/{missing-client-directive-value/invalid/missing-client-directive-value-errors.json => missing-client-only-directive-value/invalid/missing-client-only-directive-value-errors.json} (100%) rename tests/fixtures/rules/{missing-client-directive-value/invalid/missing-client-directive-value-input.astro => missing-client-only-directive-value/invalid/missing-client-only-directive-value-input.astro} (100%) rename tests/fixtures/rules/{missing-client-directive-value => missing-client-only-directive-value}/valid/client-only-value.astro (100%) rename tests/src/rules/{missing-client-directive-value.ts => missing-client-only-directive-value.ts} (58%) diff --git a/.changeset/slimy-pillows-change.md b/.changeset/slimy-pillows-change.md index 31a2e4bf..0c086dce 100644 --- a/.changeset/slimy-pillows-change.md +++ b/.changeset/slimy-pillows-change.md @@ -2,4 +2,4 @@ "eslint-plugin-astro": minor --- -feat add `astro/missing-directive-value` rule +feat add `astro/missing-client-only-directive-value` rule diff --git a/README.md b/README.md index 783d6802..df9ca6f0 100644 --- a/README.md +++ b/README.md @@ -377,7 +377,7 @@ These rules relate to possible syntax or logic errors in Astro component code: | Rule ID | Description | | |:--------|:------------|:---| -| [astro/missing-client-directive-value](https://ota-meshi.github.io/eslint-plugin-astro/rules/missing-client-directive-value/) | the client directive is missing the correct component's framework value | ⭐ | +| [astro/missing-client-only-directive-value](https://ota-meshi.github.io/eslint-plugin-astro/rules/missing-client-only-directive-value/) | the client:only directive is missing the correct component's framework value | ⭐ | | [astro/no-conflict-set-directives](https://ota-meshi.github.io/eslint-plugin-astro/rules/no-conflict-set-directives/) | disallow conflicting set directives and child contents | ⭐ | | [astro/no-deprecated-astro-canonicalurl](https://ota-meshi.github.io/eslint-plugin-astro/rules/no-deprecated-astro-canonicalurl/) | disallow using deprecated `Astro.canonicalURL` | ⭐ | | [astro/no-deprecated-astro-fetchcontent](https://ota-meshi.github.io/eslint-plugin-astro/rules/no-deprecated-astro-fetchcontent/) | disallow using deprecated `Astro.fetchContent()` | ⭐🔧 | diff --git a/docs/rules.md b/docs/rules.md index 2eec727f..7e604bae 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -13,7 +13,7 @@ These rules relate to possible syntax or logic errors in Astro component code: | Rule ID | Description | | |:--------|:------------|:---| -| [astro/missing-client-directive-value](./rules/missing-client-directive-value.md) | the client directive is missing the correct component's framework value | ⭐ | +| [astro/missing-client-only-directive-value](./rules/missing-client-only-directive-value.md) | the client:only directive is missing the correct component's framework value | ⭐ | | [astro/no-conflict-set-directives](./rules/no-conflict-set-directives.md) | disallow conflicting set directives and child contents | ⭐ | | [astro/no-deprecated-astro-canonicalurl](./rules/no-deprecated-astro-canonicalurl.md) | disallow using deprecated `Astro.canonicalURL` | ⭐ | | [astro/no-deprecated-astro-fetchcontent](./rules/no-deprecated-astro-fetchcontent.md) | disallow using deprecated `Astro.fetchContent()` | ⭐🔧 | diff --git a/docs/rules/missing-client-directive-value.md b/docs/rules/missing-client-only-directive-value.md similarity index 53% rename from docs/rules/missing-client-directive-value.md rename to docs/rules/missing-client-only-directive-value.md index 5f2a1560..fe624138 100644 --- a/docs/rules/missing-client-directive-value.md +++ b/docs/rules/missing-client-only-directive-value.md @@ -1,12 +1,13 @@ --- -title: "astro/missing-client-directive-value" -description: "the client directive is missing the correct component's framework value" +title: "astro/missing-client-only-directive-value" +description: "the client:only directive is missing the correct component's framework value" --- -# astro/missing-client-directive-value +# astro/missing-client-only-directive-value -> the client directive is missing the correct component's framework value +> the client:only directive is missing the correct component's framework value +- ❗ **_This rule has not been released yet._** - ⚙ This rule is included in `"plugin:astro/recommended"`. ## 📖 Rule Details @@ -19,7 +20,7 @@ This rule reports not setting a value for the `client:only` directive. ```astro --- -/* eslint astro/missing-client-directive-value: "error" */ +/* eslint astro/missing-client-only-directive-value: "error" */ --- @@ -41,12 +42,8 @@ Nothing. - [Astro Documentation | Template Directives Reference > client:only](https://docs.astro.build/en/reference/directives-reference/#clientonly) -## 🚀 Version - -This rule was introduced in eslint-plugin-astro v0.31.4 - ## 🔍 Implementation -- [Rule source](https://github.com/ota-meshi/eslint-plugin-astro/blob/main/src/rules/missing-client-directive-value.ts) -- [Test source](https://github.com/ota-meshi/eslint-plugin-astro/blob/main/tests/src/rules/missing-client-directive-value.ts) -- [Test fixture sources](https://github.com/ota-meshi/eslint-plugin-astro/tree/main/tests/fixtures/rules/missing-client-directive-value) +- [Rule source](https://github.com/ota-meshi/eslint-plugin-astro/blob/main/src/rules/missing-client-only-directive-value.ts) +- [Test source](https://github.com/ota-meshi/eslint-plugin-astro/blob/main/tests/src/rules/missing-client-only-directive-value.ts) +- [Test fixture sources](https://github.com/ota-meshi/eslint-plugin-astro/tree/main/tests/fixtures/rules/missing-client-only-directive-value) diff --git a/src/configs/flat/recommended.ts b/src/configs/flat/recommended.ts index 6dca72a5..08bd802f 100644 --- a/src/configs/flat/recommended.ts +++ b/src/configs/flat/recommended.ts @@ -7,6 +7,7 @@ export default [ { rules: { // eslint-plugin-astro rules + "astro/missing-client-only-directive-value": "error", "astro/no-conflict-set-directives": "error", "astro/no-deprecated-astro-canonicalurl": "error", "astro/no-deprecated-astro-fetchcontent": "error", diff --git a/src/configs/recommended.ts b/src/configs/recommended.ts index 106605f6..f029a8b5 100644 --- a/src/configs/recommended.ts +++ b/src/configs/recommended.ts @@ -9,7 +9,7 @@ export = { extends: [baseExtend], rules: { // eslint-plugin-astro rules - "astro/missing-client-directive-value": "error", + "astro/missing-client-only-directive-value": "error", "astro/no-conflict-set-directives": "error", "astro/no-deprecated-astro-canonicalurl": "error", "astro/no-deprecated-astro-fetchcontent": "error", diff --git a/src/rules/missing-client-directive-value.ts b/src/rules/missing-client-only-directive-value.ts similarity index 88% rename from src/rules/missing-client-directive-value.ts rename to src/rules/missing-client-only-directive-value.ts index 8b0bc300..4684223c 100644 --- a/src/rules/missing-client-directive-value.ts +++ b/src/rules/missing-client-only-directive-value.ts @@ -3,11 +3,11 @@ import { createRule } from "../utils" import { getAttributeName, getStaticAttributeValue } from "../utils/ast-utils" import { getSourceCode } from "../utils/compat" -export default createRule("missing-client-directive-value", { +export default createRule("missing-client-only-directive-value", { meta: { docs: { description: - "the client directive is missing the correct component's framework value", + "the client:only directive is missing the correct component's framework value", category: "Possible Errors", recommended: true, }, diff --git a/src/utils/rules.ts b/src/utils/rules.ts index 2788d59f..a0aa7e6d 100644 --- a/src/utils/rules.ts +++ b/src/utils/rules.ts @@ -2,7 +2,7 @@ // This file has been automatically generated, // in order to update its content execute "npm run update" import type { RuleModule } from "../types" -import missingClientDirectiveValue from "../rules/missing-client-directive-value" +import missingClientOnlyDirectiveValue from "../rules/missing-client-only-directive-value" import noConflictSetDirectives from "../rules/no-conflict-set-directives" import noDeprecatedAstroCanonicalurl from "../rules/no-deprecated-astro-canonicalurl" import noDeprecatedAstroFetchcontent from "../rules/no-deprecated-astro-fetchcontent" @@ -20,7 +20,7 @@ import validCompile from "../rules/valid-compile" import { buildA11yRules } from "../a11y" export const rules = [ - missingClientDirectiveValue, + missingClientOnlyDirectiveValue, noConflictSetDirectives, noDeprecatedAstroCanonicalurl, noDeprecatedAstroFetchcontent, diff --git a/tests/fixtures/rules/missing-client-directive-value/SomeSvelteComponent.svelte b/tests/fixtures/rules/missing-client-only-directive-value/SomeSvelteComponent.svelte similarity index 100% rename from tests/fixtures/rules/missing-client-directive-value/SomeSvelteComponent.svelte rename to tests/fixtures/rules/missing-client-only-directive-value/SomeSvelteComponent.svelte diff --git a/tests/fixtures/rules/missing-client-directive-value/invalid/missing-client-directive-value-errors.json b/tests/fixtures/rules/missing-client-only-directive-value/invalid/missing-client-only-directive-value-errors.json similarity index 100% rename from tests/fixtures/rules/missing-client-directive-value/invalid/missing-client-directive-value-errors.json rename to tests/fixtures/rules/missing-client-only-directive-value/invalid/missing-client-only-directive-value-errors.json diff --git a/tests/fixtures/rules/missing-client-directive-value/invalid/missing-client-directive-value-input.astro b/tests/fixtures/rules/missing-client-only-directive-value/invalid/missing-client-only-directive-value-input.astro similarity index 100% rename from tests/fixtures/rules/missing-client-directive-value/invalid/missing-client-directive-value-input.astro rename to tests/fixtures/rules/missing-client-only-directive-value/invalid/missing-client-only-directive-value-input.astro diff --git a/tests/fixtures/rules/missing-client-directive-value/valid/client-only-value.astro b/tests/fixtures/rules/missing-client-only-directive-value/valid/client-only-value.astro similarity index 100% rename from tests/fixtures/rules/missing-client-directive-value/valid/client-only-value.astro rename to tests/fixtures/rules/missing-client-only-directive-value/valid/client-only-value.astro diff --git a/tests/src/rules/missing-client-directive-value.ts b/tests/src/rules/missing-client-only-directive-value.ts similarity index 58% rename from tests/src/rules/missing-client-directive-value.ts rename to tests/src/rules/missing-client-only-directive-value.ts index 33e05f50..6563abfa 100644 --- a/tests/src/rules/missing-client-directive-value.ts +++ b/tests/src/rules/missing-client-only-directive-value.ts @@ -1,5 +1,5 @@ import { RuleTester } from "../../utils/eslint-compat" -import rule from "../../../src/rules/missing-client-directive-value" +import rule from "../../../src/rules/missing-client-only-directive-value" import { loadTestCases } from "../../utils/utils" const tester = new RuleTester({ @@ -10,7 +10,7 @@ const tester = new RuleTester({ }) tester.run( - "missing-client-directive-value", + "missing-client-only-directive-value", rule as any, - loadTestCases("missing-client-directive-value"), + loadTestCases("missing-client-only-directive-value"), )