Skip to content

Exporting Typescript enums from components raises a warning #573

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

Closed
bencates opened this issue Sep 25, 2020 · 3 comments
Closed

Exporting Typescript enums from components raises a warning #573

bencates opened this issue Sep 25, 2020 · 3 comments
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.

Comments

@bencates
Copy link

Describe the bug
Exporting a typescript enum or const enum from a <script context="module" lang="ts"> block raises a "svelte(unused-export-let)" warning.

Expected behavior
Exporting enums is allowed without warning.

Screenshots
image

System (please complete the following information):

  • OS: Linux
  • IDE: VSCode
  • Plugin/Package: ?

Additional context
Exporting a type or an interface does not raise this warning.

@bencates bencates added the bug Something isn't working label Sep 25, 2020
@dummdidumm
Copy link
Member

export enum gets transpiled to export var. The Svelte parser picks this up and shows the - in his context - right warning. This is an edge case we need to silence.

dummdidumm pushed a commit to dummdidumm/language-tools that referenced this issue Sep 26, 2020
TypeScript transpiles `export enum A` to `export var A`, which the compiler will warn about. Silence this edge case.
sveltejs#573
dummdidumm added a commit that referenced this issue Sep 26, 2020
TypeScript transpiles `export enum A` to `export var A`, which the compiler will warn about. Silence this edge case.
#573
@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label Sep 26, 2020
@udayrajMT
Copy link

udayrajMT commented Nov 19, 2020

I know this is a bit out of context, but couldn't find the docs and this issue seemed most relevant. I think you guys can help an eslint configuration to convert this warning into error...

I've tried a configuration like this -

  ...
  plugins: ["react", "svelte3"],
  overrides: [
    {
      files: ["**/*.svelte"],
      processor: "svelte3/svelte3",
      rules: {
        "unused-export-let": ["error"]
      }
    },
   ...
]

but it doesn't seem to fail even when running eslint manually.

Any help is appreciated @dummdidumm

@dummdidumm
Copy link
Member

The warning does not come from ESLint, it comes from the Svelte compiler. You'll want to use this setting for VS Code and the --compiler-warnings setting for svelte-check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

No branches or pull requests

3 participants