Repository: ota-meshi/eslint-plugin-astro (ts)

Issue:
Parsing error (',' expected) in <script> with typescript
### Before You File a Bug Report Please Confirm You Have Done The Following...

- [X] I have tried restarting my IDE and the issue persists.
- [X] I have updated to the latest version of the packages.

### What version of ESLint are you using?

8.55.0

### What version of `eslint-plugin-astro` are you using?

0.30.0

### What did you do?

<details>
<summary>Configuration</summary>

`.eslintrc.json` contents:
```json
{
    "env": {
        "browser": true,
        "es2021": true,
        "node": true
    },
    "extends": [
        "eslint:recommended",
        "plugin:@typescript-eslint/recommended",
        "plugin:astro/recommended"
    ],
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "ecmaVersion": "latest",
        "sourceType": "module"
    },
    "plugins": [
        "@typescript-eslint"
    ],
    "rules": {
    },
    "overrides": [
        {
            "files": ["*.astro"],
            "parser": "astro-eslint-parser",
            "parserOptions": {
                "parser": "@typescript-eslint/parser",
                "extraFileExtensions": [".astro"]
            },
            "rules": {
            }
        }
    ]
}
```

`package.json` contents:
```json
{
  "name": "radiant-raspberry",
  "type": "module",
  "version": "0.0.1",
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro check && astro build",
    "preview": "astro preview",
    "astro": "astro"
  },
  "dependencies": {
    "@astrojs/check": "^0.3.2",
    "astro": "^4.0.4",
    "typescript": "^5.3.3"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^6.14.0",
    "@typescript-eslint/parser": "^6.14.0",
    "eslint": "^8.55.0",
    "eslint-plugin-astro": "^0.30.0"
  }
}
```
</details>

When running `npx eslint .` on an astro project using typescript and containing a script block like below, eslint reports `Parsing error: ',' expected`. This does **not** happen if the code is instead placed in the component script.

```astro
<script>
	const x = new Map<string, string>();
</script>
```

### What did you expect to happen?

There should be no parsing error, only errors caused by lints.

### What actually happened?

```
❯ npx eslint .

/home/garmelon/tmp/radiant-raspberry/src/pages/index.astro
  19:33  error  Parsing error: ',' expected

✖ 1 problem (1 error, 0 warnings)
```

### Link to Minimal Reproducible Example

https://github.com/Garmelon/astro-eslint-bug-repro

### Additional comments

_No response_

Pull request description:
feat: add `astro/client-side-ts` processor
close #291 

Patch:
diff --git a/.changeset/tender-laws-rule.md b/.changeset/tender-laws-rule.md
new file mode 100644
index 0000000..552e512
--- /dev/null
+++ b/.changeset/tender-laws-rule.md
@@ -0,0 +1,5 @@
+---
+"eslint-plugin-astro": minor
+---
+
+feat: add `astro/client-side-ts` processor
diff --git a/README.md b/README.md
index f15e6c6..6c25dab 100644
--- a/README.md
+++ b/README.md
@@ -26,14 +26,14 @@ At least it works fine with a [withastro/docs](https://github.com/withastro/docs
 - Linting Astro components using ESLint.
 - Find problems with Astro components.
 - Apply a consistent code style to Astro components.
-- Linting targets include [Frontmatter], [HTML Template], [Dynamic JSX Expressions], [Client-Side Scripts], [Directives], and more.
+- Linting targets include [Frontmatter], [HTML Template], [JSX-like Expressions], [Client-Side Scripts], [Directives], and more.
 - Check code in real time with the ESLint editor integrations.
 
-[frontmatter]: https://docs.astro.build/ja/core-concepts/astro-components/#the-component-script
-[html template]: https://docs.astro.build/ja/core-concepts/astro-components/#the-component-template
-[dynamic jsx expressions]: https://docs.astro.build/ja/core-concepts/astro-components/#dynamic-jsx-expressions
-[client-side scripts]: https://docs.astro.build/ja/core-concepts/astro-components/#client-side-scripts
-[directives]: https://docs.astro.build/ja/reference/directives-reference/
+[frontmatter]: https://docs.astro.build/en/core-concepts/astro-components/#the-component-script
+[html template]: https://docs.astro.build/en/core-concepts/astro-components/#the-component-template
+[JSX-like Expressions]: https://docs.astro.build/en/core-concepts/astro-syntax/#jsx-like-expressions
+[client-side scripts]: https://docs.astro.build/en/guides/client-side-scripts/
+[directives]: https://docs.astro.build/en/reference/directives-reference/
 
 <!--DOCS_IGNORE_START-->
 
@@ -170,6 +170,52 @@ module.exports = {
         "prettier/prettier": "off",
       },
     },
+    {
+      // Define the configuration for `<script>` tag when using `client-side-ts` processor.
+      // Script in `<script>` is assigned a virtual file name with the `.js` extension.
+      files: ["**/*.astro/*.ts", "*.astro/*.ts"],
+      env: {
+        browser: true,
+        es2020: true,
+      },
+      parser: "@typescript-eslint/parser",
+      parserOptions: {
+        sourceType: "module",
+        project: null,
+      },
+      rules: {
+        // override/add rules settings here, such as:
+        // "no-unused-vars": "error"
+
+        // If you are using "prettier/prettier" rule,
+        // you don't need to format inside <script> as it will be formatted as a `.astro` file.
+        "prettier/prettier": "off",
+      },
+    },
+    // ...
+  ],
+}
+```
+
+If you are writing client-side scripts in TypeScript and want to use `@typescript-eslint/parser` as the TypeScript parser, you will need to use `client-side-ts` processor and configure it as follows.
+
+```js
+module.exports = {
+  // ...
+  extends: [
+    // ...
+    "plugin:astro/recommended",
+  ],
+  // ...
+  overrides: [
+    {
+      files: ["*.astro"],
+      // ...
+      processor: "astro/client-side-ts", // <- Uses the "client-side-ts" processor.
+      rules: {
+        // ...
+      },
+    },
     // ...
   ],
 }
diff --git a/docs-build/src/components/eslint/scripts/linter.mjs b/docs-build/src/components/eslint/scripts/linter.mjs
index 377fc29..8bbf519 100644
--- a/docs-build/src/components/eslint/scripts/linter.mjs
+++ b/docs-build/src/components/eslint/scripts/linter.mjs
@@ -3,8 +3,8 @@ import { rules as pluginRules } from "../../../../../src/utils/rules"
 import { Linter } from "eslint"
 import * as astroEslintParser from "astro-eslint-parser"
 // eslint-disable-next-line n/no-missing-import -- Demo
-import { processor } from "../../../../../src/processor/index"
-export const { preprocess, postprocess } = processor
+import { astroProcessor } from "../../../../../src/processor/index"
+export const { preprocess, postprocess } = astroProcessor
 const linter = new Linter()
 
 export const categories = [
diff --git a/docs/README.md b/docs/README.md
index b4ba669..ab30df1 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -30,14 +30,14 @@ At least it works fine with a [withastro/docs](https://github.com/withastro/docs
 - Linting Astro components using ESLint.
 - Find problems with Astro components.
 - Apply a consistent code style to Astro components.
-- Linting targets include [Frontmatter], [HTML Template], [Dynamic JSX Expressions], [Client-Side Scripts], [Directives], and more.
+- Linting targets include [Frontmatter], [HTML Template], [JSX-like Expressions], [Client-Side Scripts], [Directives], and more.
 - Check code in real time with the ESLint editor integrations.
 
-[frontmatter]: https://docs.astro.build/ja/core-concepts/astro-components/#the-component-script
-[html template]: https://docs.astro.build/ja/core-concepts/astro-components/#the-component-template
-[dynamic jsx expressions]: https://docs.astro.build/ja/core-concepts/astro-components/#dynamic-jsx-expressions
-[client-side scripts]: https://docs.astro.build/ja/core-concepts/astro-components/#client-side-scripts
-[directives]: https://docs.astro.build/ja/reference/directives-reference/
+[frontmatter]: https://docs.astro.build/en/core-concepts/astro-components/#the-component-script
+[html template]: https://docs.astro.build/en/core-concepts/astro-components/#the-component-template
+[JSX-like Expressions]: https://docs.astro.build/en/core-concepts/astro-syntax/#jsx-like-expressions
+[client-side scripts]: https://docs.astro.build/en/guides/client-side-scripts/
+[directives]: https://docs.astro.build/en/reference/directives-reference/
 
 ## 📖 Usage
 
diff --git a/docs/user-guide.md b/docs/user-guide.md
index c5ea524..84089ea 100644
--- a/docs/user-guide.md
+++ b/docs/user-guide.md
@@ -126,6 +126,52 @@ module.exports = {
         "prettier/prettier": "off",
       },
     },
+    {
+      // Define the configuration for `<script>` tag when using `client-side-ts` processor.
+      // Script in `<script>` is assigned a virtual file name with the `.js` extension.
+      files: ["**/*.astro/*.ts", "*.astro/*.ts"],
+      env: {
+        browser: true,
+        es2020: true,
+      },
+      parser: "@typescript-eslint/parser",
+      parserOptions: {
+        sourceType: "module",
+        project: null,
+      },
+      rules: {
+        // override/add rules settings here, such as:
+        // "no-unused-vars": "error"
+
+        // If you are using "prettier/prettier" rule,
+        // you don't need to format inside <script> as it will be formatted as a `.astro` file.
+        "prettier/prettier": "off",
+      },
+    },
+    // ...
+  ],
+}
+```
+
+If you are writing client-side scripts in TypeScript and want to use `@typescript-eslint/parser` as the TypeScript parser, you will need to use `client-side-ts` processor and configure it as follows.
+
+```js
+module.exports = {
+  // ...
+  extends: [
+    // ...
+    "plugin:astro/recommended",
+  ],
+  // ...
+  overrides: [
+    {
+      files: ["*.astro"],
+      // ...
+      processor: "astro/client-side-ts", // <- Uses the "client-side-ts" processor.
+      rules: {
+        // ...
+      },
+    },
     // ...
   ],
 }
@@ -188,5 +234,3 @@ Example **.vscode/settings.json**:
 ### Parsing the `.astro` file fails
 
 You should check the [parser configuration](#parser-configuration).
-
-[eslint-plugin-astro3]: https://github.com/astrojs/eslint-plugin-astro3
diff --git a/src/configs/base.ts b/src/configs/base.ts
index 10fcea1..8c26153 100644
--- a/src/configs/base.ts
+++ b/src/configs/base.ts
@@ -50,5 +50,26 @@ export = {
         "prettier/prettier": "off",
       },
     },
+    {
+      // Define the configuration for `<script>` tag when using `client-side-ts` processor.
+      // Script in `<script>` is assigned a virtual file name with the `.ts` extension.
+      files: ["**/*.astro/*.ts", "*.astro/*.ts"],
+      env: {
+        browser: true,
+        es2020: true,
+      },
+      parser: hasTypescriptEslintParser
+        ? "@typescript-eslint/parser"
+        : undefined,
+      parserOptions: {
+        sourceType: "module",
+        project: null,
+      },
+      rules: {
+        // If you are using "prettier/prettier" rule,
+        // you don't need to format inside <script> as it will be formatted as a `.astro` file.
+        "prettier/prettier": "off",
+      },
+    },
   ],
 }
diff --git a/src/configs/has-typescript-eslint-parser.ts b/src/configs/has-typescript-eslint-parser.ts
index 0e4e59a..dc177cc 100644
--- a/src/configs/has-typescript-eslint-parser.ts
+++ b/src/configs/has-typescript-eslint-parser.ts
@@ -6,8 +6,8 @@ export let hasTypescriptEslintParser = false
 try {
   const cwd = process.cwd()
   const relativeTo = path.join(cwd, "__placeholder__.js")
-  createRequire(relativeTo)("@typescript-eslint/parser")
-  hasTypescriptEslintParser = true
+  if (createRequire(relativeTo)("@typescript-eslint/parser"))
+    hasTypescriptEslintParser = true
 } catch {
   // noop
 }
diff --git a/src/index.ts b/src/index.ts
index 486b712..7fa1173 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,6 +1,6 @@
 import type { RuleModule } from "./types"
 import { rules as ruleList } from "./utils/rules"
-import { processor } from "./processor"
+import * as processors from "./processor"
 import { environments } from "./environments"
 import base from "./configs/base"
 import recommended from "./configs/recommended"
@@ -38,8 +38,9 @@ export = {
   configs,
   rules,
   processors: {
-    ".astro": processor,
-    astro: processor,
+    ".astro": processors.astroProcessor,
+    astro: processors.astroProcessor,
+    "client-side-ts": processors.clientSideTsProcessor,
   },
   environments,
 }
diff --git a/src/processor/index.ts b/src/processor/index.ts
index 438d849..6b94ef6 100644
--- a/src/processor/index.ts
+++ b/src/processor/index.ts
@@ -4,51 +4,73 @@ import type { Linter } from "eslint"
 import { beginShared, terminateShared } from "../shared"
 import * as meta from "../meta"
 
-export const processor: Linter.Processor = {
+export const astroProcessor: Linter.Processor = {
   preprocess(code: string, filename: string) {
-    if (filename) {
-      const shared = beginShared(filename)
-      let parsed: ParseTemplateResult
-      try {
-        parsed = parseTemplate(code)
-      } catch {
-        // ignore
-        return [code]
-      }
-
-      parsed.walk(parsed.result.ast, (node) => {
-        if (
-          node.type === "element" &&
-          node.name === "script" &&
-          node.children.length &&
-          !node.attributes.some(
-            ({ name, value }) =>
-              name === "type" && /json$|importmap/i.test(value),
-          )
-        ) {
-          shared.addClientScript(code, node, parsed)
-        }
-      })
-      return [code, ...shared.clientScripts.map((cs) => cs.getProcessorFile())]
-    }
-
-    return [code]
+    return preprocess(code, filename, ".js")
   },
-  postprocess(
-    [messages, ...blockMessages]: Linter.LintMessage[][],
-    filename: string,
-  ): Linter.LintMessage[] {
-    const shared = terminateShared(filename)
-    if (shared) {
-      return messages.concat(
-        ...blockMessages.map((m, i) =>
-          shared.clientScripts[i].remapMessages(m),
-        ),
-      )
-    }
+  postprocess,
+  supportsAutofix: true,
+  meta,
+}
 
-    return messages
+export const clientSideTsProcessor: Linter.Processor = {
+  preprocess(code: string, filename: string) {
+    return preprocess(code, filename, ".ts")
   },
+  postprocess,
   supportsAutofix: true,
-  meta,
+  meta: { ...meta, name: "astro/client-side-ts" },
+}
+
+/** preprocess */
+function preprocess(
+  code: string,
+  filename: string,
+  vartualFileExt: string,
+): ReturnType<NonNullable<Linter.Processor["preprocess"]>> {
+  if (filename) {
+    const shared = beginShared(filename)
+    let parsed: ParseTemplateResult
+    try {
+      parsed = parseTemplate(code)
+    } catch {
+      // ignore
+      return [code]
+    }
+
+    parsed.walk(parsed.result.ast, (node) => {
+      if (
+        node.type === "element" &&
+        node.name === "script" &&
+        node.children.length &&
+        !node.attributes.some(
+          ({ name, value }) =>
+            name === "type" && /json$|importmap/i.test(value),
+        )
+      ) {
+        shared.addClientScript(code, node, parsed)
+      }
+    })
+    return [
+      code,
+      ...shared.clientScripts.map((cs) => cs.getProcessorFile(vartualFileExt)),
+    ]
+  }
+
+  return [code]
+}
+
+/** postprocess */
+function postprocess(
+  [messages, ...blockMessages]: Linter.LintMessage[][],
+  filename: string,
+): Linter.LintMessage[] {
+  const shared = terminateShared(filename)
+  if (shared) {
+    return messages.concat(
+      ...blockMessages.map((m, i) => shared.clientScripts[i].remapMessages(m)),
+    )
+  }
+
+  return messages
 }
diff --git a/src/shared/client-script/index.ts b/src/shared/client-script/index.ts
index aab8d85..9f7accf 100644
--- a/src/shared/client-script/index.ts
+++ b/src/shared/client-script/index.ts
@@ -244,10 +244,10 @@ export class ClientScript {
       })
   }
 
-  public getProcessorFile(): Linter.ProcessorFile {
+  public getProcessorFile(ext: string): Linter.ProcessorFile {
     return {
       text: this.block.text,
-      filename: `${this.id}.js`,
+      filename: `${this.id}${ext}`,
     }
   }
 
diff --git a/tools/update-rulesets.ts b/tools/update-rulesets.ts
index 06f5e04..9555844 100644
--- a/tools/update-rulesets.ts
+++ b/tools/update-rulesets.ts
@@ -67,6 +67,27 @@ export = {
         "prettier/prettier": "off",
       },
     },
+    {
+      // Define the configuration for \`<script>\` tag when using \`client-side-ts\` processor.
+      // Script in \`<script>\` is assigned a virtual file name with the \`.ts\` extension.
+      files: ["**/*.astro/*.ts", "*.astro/*.ts"],
+      env: {
+        browser: true,
+        es2020: true,
+      },
+      parser: hasTypescriptEslintParser
+        ? "@typescript-eslint/parser"
+        : undefined,
+      parserOptions: {
+        sourceType: "module",
+        project: null,
+      },
+      rules: {
+        // If you are using "prettier/prettier" rule,
+        // you don't need to format inside <script> as it will be formatted as a \`.astro\` file.
+        "prettier/prettier": "off",
+      },
+    },
   ],
 }
 `,


Test patch:
diff --git a/tests/src/integration/client-typescript.ts b/tests/src/integration/client-typescript.ts
new file mode 100644
index 0000000..c220a5f
--- /dev/null
+++ b/tests/src/integration/client-typescript.ts
@@ -0,0 +1,69 @@
+import { ESLint } from "eslint"
+import astroPlugin from "../../../src/index"
+import assert from "assert"
+import Module from "module"
+
+describe("Integration test for client-side ts", () => {
+  // @ts-expect-error -- ignore
+  const originalLoad = Module._load
+  before(() => {
+    // @ts-expect-error -- ignore
+    Module._load = function (name, ...args) {
+      if (name === "eslint-plugin-astro") {
+        return astroPlugin
+      }
+      return originalLoad(name, ...args)
+    }
+  })
+  after(() => {
+    // @ts-expect-error -- ignore
+    Module._load = originalLoad
+  })
+  it("should work with client-side-ts processor", async () => {
+    const eslint = new ESLint({
+      plugins: {
+        astro: astroPlugin as any,
+      },
+      useEslintrc: false,
+      overrideConfig: {
+        extends: ["plugin:astro/base"],
+        parser: "@typescript-eslint/parser",
+        rules: {
+          "no-restricted-syntax": ["error", "TSTypeAnnotation"],
+        },
+        overrides: [
+          {
+            files: ["*.astro"],
+            parser: "astro-eslint-parser",
+            parserOptions: {
+              parser: "@typescript-eslint/parser",
+              extraFileExtensions: [".astro"],
+            },
+            processor: "astro/client-side-ts",
+          },
+        ],
+      },
+    })
+
+    const result = await eslint.lintText(
+      `
+      <script>
+      const map: Map<string, string> = new Map<string, string>()
+      </script>
+      `,
+      { filePath: "path/to/test.astro" },
+    )
+
+    assert.deepStrictEqual(
+      result
+        .flatMap((r) => r.messages)
+        .map((m) => ({ ruleId: m.ruleId, message: m.message })),
+      [
+        {
+          message: "Using 'TSTypeAnnotation' is not allowed.",
+          ruleId: "no-restricted-syntax",
+        },
+      ],
+    )
+  })
+})
diff --git a/tests/src/integration/eol-last.ts b/tests/src/integration/eol-last.ts
index 3b1fd26..9293020 100644
--- a/tests/src/integration/eol-last.ts
+++ b/tests/src/integration/eol-last.ts
@@ -1,5 +1,5 @@
 import { RuleTester, Linter } from "eslint"
-import { processor } from "../../../src/processor"
+import { astroProcessor } from "../../../src/processor"
 
 describe("Integration test for eol-last", () => {
   const eolLast = new Linter().getRules().get("eol-last")!
@@ -16,7 +16,7 @@ describe("Integration test for eol-last", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `
         <script define:vars={{ foo: 42 }}>
@@ -27,7 +27,7 @@ describe("Integration test for eol-last", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `
         <script define:vars={{ foo: 42 }}>
@@ -39,7 +39,7 @@ describe("Integration test for eol-last", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `
         <script define:vars={{ foo: 42 }}>
@@ -52,7 +52,7 @@ describe("Integration test for eol-last", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `
         <script define:vars={{ foo: 42 }}>
diff --git a/tests/src/integration/linebreak-style.ts b/tests/src/integration/linebreak-style.ts
index 6ef84b5..da96ec5 100644
--- a/tests/src/integration/linebreak-style.ts
+++ b/tests/src/integration/linebreak-style.ts
@@ -1,5 +1,5 @@
 import { RuleTester, Linter } from "eslint"
-import { processor } from "../../../src/processor"
+import { astroProcessor } from "../../../src/processor"
 
 describe("Integration test for linebreak-style", () => {
   const ruleNoUnusedVars = new Linter().getRules().get("linebreak-style")!
@@ -19,7 +19,7 @@ describe("Integration test for linebreak-style", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `
         <script define:vars={{ foo: 42, bar: 42 }}>
@@ -31,7 +31,7 @@ describe("Integration test for linebreak-style", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `
 <script define:vars={{ bar: 42 }}>
@@ -48,7 +48,7 @@ describe("Integration test for linebreak-style", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `{/*eslint linebreak-style:0*/}
         <script define:vars={{ bar: 42 }}>
@@ -66,7 +66,7 @@ describe("Integration test for linebreak-style", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `{/*eslint linebreak-style:0*/}
 <script define:vars={{ bar: 42 }}>\r
diff --git a/tests/src/integration/no-undef.ts b/tests/src/integration/no-undef.ts
index 9cfc595..c0268be 100644
--- a/tests/src/integration/no-undef.ts
+++ b/tests/src/integration/no-undef.ts
@@ -1,5 +1,5 @@
 import { RuleTester, Linter } from "eslint"
-import { processor } from "../../../src/processor"
+import { astroProcessor } from "../../../src/processor"
 
 describe("Integration test for no-undef", () => {
   const ruleNoUnusedVars = new Linter().getRules().get("no-undef")!
@@ -19,7 +19,7 @@ describe("Integration test for no-undef", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `
         <script define:vars={{ foo: 42, bar: 42 }}>
@@ -33,7 +33,7 @@ describe("Integration test for no-undef", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `
         <script define:vars={{ bar: 42 }}>
@@ -52,7 +52,7 @@ describe("Integration test for no-undef", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `
 <script define:vars={{ bar: 42 }}>
@@ -74,7 +74,7 @@ describe("Integration test for no-undef", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `
 <script define:vars={{ bar: 42 }}>
diff --git a/tests/src/integration/no-unused-vars.ts b/tests/src/integration/no-unused-vars.ts
index 7ada3e0..edc2808 100644
--- a/tests/src/integration/no-unused-vars.ts
+++ b/tests/src/integration/no-unused-vars.ts
@@ -1,5 +1,5 @@
 import { RuleTester, Linter } from "eslint"
-import { processor } from "../../../src/processor"
+import { astroProcessor } from "../../../src/processor"
 
 describe("Integration test for no-unused-vars", () => {
   const ruleNoUnusedVars = new Linter().getRules().get("no-unused-vars")!
@@ -16,7 +16,7 @@ describe("Integration test for no-unused-vars", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `
         <script define:vars={{ foo: 42 }}>
@@ -30,7 +30,7 @@ describe("Integration test for no-unused-vars", () => {
         // @ts-expect-error -- fine name with processor
         filename: {
           filename: "foo.astro",
-          ...processor,
+          ...astroProcessor,
         },
         code: `
         <script define:vars={{ foo: 42, bar: 42 }}>
diff --git a/tests/src/meta.ts b/tests/src/meta.ts
index fa7b017..f1110e3 100644
--- a/tests/src/meta.ts
+++ b/tests/src/meta.ts
@@ -15,7 +15,7 @@ describe("Test for meta object", () => {
   for (const [name, processor] of Object.entries(plugin.processors)) {
     it(`"${name}" processor should have a meta object.`, () => {
       // @ts-expect-error -- missing type
-      assert.strictEqual(processor.meta.name, expectedMeta.name)
+      assert.strictEqual(typeof processor.meta.name, "string")
       // @ts-expect-error -- missing type
       assert.strictEqual(typeof processor.meta.version, "string")
     })