Skip to content

Parsing error, if the script tag is placed between frontmatter and html code #414

@fullstackjunior

Description

@fullstackjunior

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

9.9.0

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

1.2.3

What did you do?

Configuration
import eslintPluginAstro from 'eslint-plugin-astro';
export default [
  ...eslintPluginAstro.configs.recommended
  {
    rules: {
        "astro/no-unused-css-selector": 1
    }
  }
];
---
---
<script></script>

<!doctype html>

What did you expect to happen?

I expect no errors because the doctype directive is valid.

What actually happened?

Linter shows error:

Parsing error: Unknown token at 233, expected: "<!--", actual: "<!doctype "

Link to Minimal Reproducible Example

https://eslint-online-playground.netlify.app/#eNp9UstO6zAQ/RVfb9iQadPeK10KQiCxZMEeg2TsaXFx7Mh2Cgj13/GrUSoeWdjxnDNnZo7mg3onZrf83Q4BuA/O0hVtmoaZfDBz4YVTfbi8mNWfHPwjrQjvPZLn0OlLekrRa2UCCGvWagNbH1VU11sXSEHu9LBR5joVIGtnO3JS4k2fgSaXPjlnBt9ylsQ1H3Qg98wQAgBfVGopDw6F7To0EuVpIn+kgxA3aPSrwyt9jOYiM2ObwQweZSO8bzxqFME6RlekzQKE7NMVj4fzOFnPxQvfYJzJmjhVFmTU8A5TShTlnNGcyGiypEQ7K2MDI7BD55U1BZvDHNoRKrb6BNVmGZW4q+LZsPysvcWEwF34GX4alJZTuAZGQu9wp/B1ShlDIynHJxRGsye1Z4l9MtwIhceNX2Xy1keTZXXi8T8sYfG99ONfaBcJPBbf3fyoX/ZgVi4nqswSWphPShxo25wdCWdwdkQo+K/g0WZWZgsLWE6YG22fuD4Uaf8Vobo9e7r/BMJsD2U=

Additional comments

If I replace the script tag and put it after html code, the error disappears

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions