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

Default export of an Astro component has a type any #348

Open
2 tasks done
nix6839 opened this issue Apr 8, 2024 · 0 comments
Open
2 tasks done

Default export of an Astro component has a type any #348

nix6839 opened this issue Apr 8, 2024 · 0 comments

Comments

@nix6839
Copy link
Contributor

nix6839 commented Apr 8, 2024

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?

8.57.0

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

0.33.1

What did you do?

Configuration
module.exports = {
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended-type-checked",
    "plugin:astro/recommended"
  ],
  parserOptions: {
    project: "./tsconfig.json",
  },
  overrides: [
    {
      files: ["*.astro"],
      parser: "astro-eslint-parser",
      parserOptions: {
        parser: "@typescript-eslint/parser",
        extraFileExtensions: [".astro"],
      },
    }
  ]
}
<!-- Foo.astro -->
<div></div>
---
// ErrorComponent.astro
import Foo from './Foo.astro';

const Errored = Foo;
---

<Errored />

What did you expect to happen?

const Errored = Foo;

There should be no lint errors.

What actually happened?

Unsafe assignment of an `any` value  @typescript-eslint/no-unsafe-assignment

Link to Minimal Reproducible Example

https://eslint-online-playground.netlify.app/#eNp9UstOwzAQ/BXLFyREHKBUoFAQEo8rH4A5RM62uG3syHaroqr/ztqbtKmacsljd2Z2Z+wt907l785Z92rrxhowQZQ+OMsLnmWZNBqrLrAPa9nU2ZpdiBy/CXPxKI00yhofWNKAij1FKNYTWZpJV8+fpeFXadyejzMmlV4/T/L4TP3gUW6qZ2LurcH+FkWC5LAJYCovecEkT9y8Q/ocf7VCkDS7pCHAL7UJTgk196hR22q1BAGb6MTjhijKWCtZsK/4x1CXaIUDZesae1BJftU1m+Vqpk3xEn4b8MrpJmSEz3v4LHYz9QNqMUSmxY/0I+I74ZrSeXCfTdCYZ0E7YtXZOagQbYu95RROK79LT7sG53QFBzstn7GpXlKZX1LqktPAJJ+G7kNtLWVU3hs4t9yxwkA0Jzopdld+4E7vMX9Perjc6W7kDN8po+5wm1Ityhn07kcMuIImBmqUhnRJ2gVbW3Rt7sRY3NxS5KQdeeu3c9R//ES5e5S77p3xALxLM53+MIsg1HsQ4/uBZsvPelauxWgkbnrIw2wCjMWdGLVWKbndHzgBR2k=

Additional comments

Unlike issue #341, using https://github.com/ota-meshi/typescript-eslint-parser-for-extra-files still results in a lint error.

Maybe related with ota-meshi/astro-eslint-parser#259

@nix6839 nix6839 changed the title Default export of an Astro component has a type of any. Default export of an Astro component has a type of any Apr 8, 2024
@nix6839 nix6839 changed the title Default export of an Astro component has a type of any Default export of an Astro component has a type any Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants