Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components in .astro components trigger no-unused-vars #378

Closed
2 tasks done
yellowled opened this issue May 1, 2024 · 1 comment · Fixed by ota-meshi/astro-eslint-parser#321 or #379
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@yellowled
Copy link

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.1.1

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

1.1.1

What did you do?

Configuration
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintPluginAstro from "eslint-plugin-astro";
import globals from "globals";
import astroParser from "astro-eslint-parser";

export default [
    js.configs.recommended,
    eslintConfigPrettier,
    ...eslintPluginAstro.configs.recommended,
    {
        files: ["**/*.js", "**/*.mjs"],
        ignores: ["dist/*", "node_modules/*", "public/*", ".vscode/*"],
        languageOptions: {
            ecmaVersion: 2020,
            sourceType: "module",
            globals: {
                ...globals.browser,
            },
        },
        rules: {
            indent: ["error", 4],
            "linebreak-style": ["error", "unix"],
            semi: ["error", "always"],
        },
    },
    {
        files: ["*.astro"],
        parser: astroParser,
    },
];
---
// pages/foo.astro
import Default from "../layouts/Default.astro";
---
<Default>Foo</Default>

What did you expect to happen?

There should be no lint errors.

What actually happened?

error  'Default' is defined but never used  no-unused-vars

Link to Minimal Reproducible Example

https://eslint-online-playground.netlify.app/#eNp9VMtu2zAQ/BWBR8Oi7CBFEdcIWjTotT4UvZRpQUtrgY5ECiSVxAj8710+5FBSEl6k5ezMvki+EKPL4odSlBurFdmQPM+ZFG2ntM3u4MD7xmYHrdqMkWgGV0a+MOmdt3H/FmW2xWAwSZZefMTCAFvTKJsVtwiDaYS0tFTyIGp6NIjGyEczBP0anIqj8REjHja/e+JOg7UC9MAIWB5U8y6ic/au6Wshv7m0JtTOI/lrnZFXN2rPm0tq0Uw9PGXHtXlNx2/lg7KHPINJePacKnb5D5MZrqOJDTFUQ6naFmQF1TKAb9UdIUrprK4PlF7Cx62DaMBsMD5ZLIoFzoGRJSbujdZZ95Hjlqil0tG9EsYWi+AtVQX/WlX1qDXsdf2+EeVg0UdTopMzU8GGy7rnNfzsrFAShZPMfMlly3+DNghusqvV1SrhumVUr0v4depgg0FCBhhw7BRHNROPjYsw3Wv1hPOZkM+Jnf5rV+tMUmCTpfX9Aa0VDnuZXacFu8UITgr2GvhDbuzJZTxmMNJL8TzulK8WWjH15M0TP03GNOQ5fN8e93CVU2Y4opv0KCda93hy8eZ2vHzAmeFZURJvrVfH8wCdO2KyFIDpXDoT74DbYeSafqary3ySS+TAv+tPdO1gh4bUnerj3XvC6evgBW7oaiQf8ADeoPZ6hs0fiijkE5k6j58G54maTtVnzOSZnP8DujGm2A==

Alternatively, but this is not minimal: https://github.com/yellowled/yellowled.de

Additional comments

No response

@ota-meshi
Copy link
Owner

Thank you for posting the issue. It seems to be a bug.

@ota-meshi ota-meshi added the bug Something isn't working label May 1, 2024
@yellowled yellowled changed the title Components in .astro components trigger no-unused-vars Components in .astro components trigger no-unused-vars May 1, 2024
ota-meshi added a commit that referenced this issue May 2, 2024
ota-meshi added a commit that referenced this issue May 2, 2024
* fix: update parser

fixes #378

* Create clever-clocks-attend.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants