添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.
  • Repro

    Linting a TypeScript file that contains only the following line

    export enum Asefsadfasdf { X }
    

    flags the error "'Asefsadfasdf' is already declared in the upper scope".
    (You can even remove the export and the error remains, but of course you will also get an additional "unused" error.)

    And yes, nothing else in my codebase uses this name...

    "rules": { "no-shadow": [ "error", "hoist": "all"
    export enum Asefsadfasdf { X }

    Expected Result

    No error on a unique enum.

    Actual Result

    The unique enum is flagged with "is already declared in the upper scope".

    Versions

    package version

    https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#i-am-using-a-rule-from-eslint-core-and-it-doesnt-work-correctly-with-typescript-code

    You ticked the box saying you read the FAQ...

    If everyone has to make this change to allow exporting of enums

    The issue is not with the code at all. Nothing to do with enums being exported.

    The issue is with the eslint config.
    Read the FAQ article - it explains how to correctly configure your code.

    why is it not in the default config?

    no-shadow is not a recommended rule in the eslint set, so we do not recommend it in our configs either.

    If a user decides to manually turns on no-shadow, there's nothing we can do to stop them
    A user has to manually configure our extension rule which understands TS.