ota-meshi/eslint-plugin-astro

is:raw Parsing error: Invalid character

FDiskas opened this issue · 4 comments

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?

v8.47.0

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

v0.29.0

What did you do?

Configuration
module.exports = {
  extends: [
    'eslint:recommended',
    'plugin:astro/recommended',
    'plugin:jsx-a11y/recommended',
    'plugin:@typescript-eslint/recommended-type-checked',
    'prettier',
  ],
  parser: '@typescript-eslint/parser',
  plugins: ['jsx-a11y', '@typescript-eslint/eslint-plugin', 'prettier'],
  parserOptions: {
    project: './tsconfig.json',
    tsconfigRootDir: __dirname,
    extraFileExtensions: ['.astro'],
  },
  rules: {
    'prettier/prettier': 'error',
    'no-unused-vars': 'off',
  },
  env: {
    node: true,
    es6: true,
  },
  overrides: [
    {
      files: ['*.ts'],
      parser: '@typescript-eslint/parser',
      extends: ['plugin:@typescript-eslint/recommended'],
      parserOptions: {
        project: './tsconfig.json',
      },
    },
    {
      files: ['*.astro'],
      parser: 'astro-eslint-parser',
      parserOptions: {
        parser: '@typescript-eslint/parser',
        extraFileExtensions: ['.astro'],
        sourceType: 'module',
      },
    },
    {
      files: ['*.mjs'],
      parserOptions: {
        sourceType: 'module',
      },
    },
    {
      files: ['*.cjs'],
      env: {
        node: true,
      },
    },
  ],
};
import { defineConfig } from 'astro/config';

// https://astro.build/config
export default defineConfig({});

What did you expect to happen?

It should not throw an error on the following Astro HTML. The build output is ok

<template id="suggest-template" is:raw>
   {{#.}}
      <a href="/">
        <div class="truncate">{{title}}</div>
      </a>
   {{/.}}
</template>

What actually happened?

I would expect that in case attribute on element is is:raw the content of that element would be ignored by a parserthe

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-m9axad-f7c42y?file=src%2Fcomponents%2FCard.astro

Open new terminal and run npm run lint

Additional comments

No response

Thank you for posting the issue. However, please provide a reproduction repo in a GitHub repo.

Thank you. I was able to confirm the bug, but it seems a little difficult, so I will fix it when I have time.

Thank You to for your time and nice work