Skip to content

[no-shadow] False positive when declaring any TypeScript enum #2466

Closed
@Kenadia

Description

@Kenadia
  • 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

export enum SimpleEnum {
  SIMPLE_ENUM_VALUE,
}

Full minimal repro here: https://github.com/Kenadia/no-shadow-eslint-enum-test.

Expected Result

No error.

Actual Result

  1:13  error  'SimpleEnum' is already declared in the upper scope  no-shadow

Additional Info

  eslint:cli CLI args: [ 'src/index.ts', '--debug' ] +0ms
  eslint:cli Running on files +3ms
  eslint:config-array-factory Loading JSON config file: /dir/no-shadow-eslint-enum-test/package.json +0ms
  eslint:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/dir/no-shadow-eslint-enum-test', loose: false } ] +0ms
  eslint:ignore-pattern   processed: { basePath: '/dir/no-shadow-eslint-enum-test', patterns: [ '/**/node_modules/*' ] } +1ms
  eslint:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/dir/no-shadow-eslint-enum-test', loose: false } ] +1ms
  eslint:ignore-pattern   processed: { basePath: '/dir/no-shadow-eslint-enum-test', patterns: [ '/**/node_modules/*' ] } +0ms
  eslint:file-enumerator Start to iterate files: [ 'src/index.ts' ] +0ms
  eslint:file-enumerator File: /dir/no-shadow-eslint-enum-test/src/index.ts +1ms
  eslint:cascading-config-array-factory Load config files for /dir/no-shadow-eslint-enum-test/src. +0ms
  eslint:cascading-config-array-factory No cache found: /dir/no-shadow-eslint-enum-test/src. +0ms
  eslint:config-array-factory Config file not found on /dir/no-shadow-eslint-enum-test/src +3ms
  eslint:cascading-config-array-factory No cache found: /dir/no-shadow-eslint-enum-test. +0ms
  eslint:config-array-factory Loading JS config file: /dir/no-shadow-eslint-enum-test/.eslintrc.js +1ms
  eslint:config-array-factory Config file found: /dir/no-shadow-eslint-enum-test/.eslintrc.js +0ms
  eslint:config-array-factory Loading parser "@typescript-eslint/parser" from /dir/no-shadow-eslint-enum-test/.eslintrc.js +0ms
  eslint:config-array-factory Loaded: @typescript-eslint/parser@4.0.1 (/dir/no-shadow-eslint-enum-test/node_modules/@typescript-eslint/parser/dist/index.js) +1ms
  eslint:config-array-factory Loading plugin "@typescript-eslint" from /dir/no-shadow-eslint-enum-test/.eslintrc.js +215ms
  eslint:config-array-factory Loaded: @typescript-eslint/eslint-plugin@4.0.1 (/dir/no-shadow-eslint-enum-test/node_modules/@typescript-eslint/eslint-plugin/dist/index.js) +1ms
  eslint:config-array-factory Plugin /dir/no-shadow-eslint-enum-test/node_modules/@typescript-eslint/eslint-plugin/dist/index.js loaded in: 122ms +122ms
  eslint:cascading-config-array-factory No cache found: /dir. +340ms
  eslint:config-array-factory Config file not found on /dir +0ms
  eslint:cascading-config-array-factory Stop traversing because of considered root. +0ms
  eslint:rules Loading rule 'no-shadow' (remaining=281) +0ms
  eslint:cascading-config-array-factory Configuration was determined: ConfigArray(2) [ { type: 'config', name: 'DefaultIgnorePattern', filePath: '', criteria: null, env: undefined, globals: undefined, ignorePattern: IgnorePattern { patterns: [Array], basePath: '/dir/no-shadow-eslint-enum-test', loose: false }, noInlineConfig: undefined, parser: undefined, parserOptions: undefined, plugins: undefined, processor: undefined, reportUnusedDisableDirectives: undefined, root: undefined, rules: undefined, settings: undefined }, { type: 'config', name: '.eslintrc.js', filePath: '/dir/no-shadow-eslint-enum-test/.eslintrc.js', criteria: null, env: { node: true }, globals: undefined, ignorePattern: undefined, noInlineConfig: undefined, parser: { error: null, filePath: '/dir/no-shadow-eslint-enum-test/node_modules/@typescript-eslint/parser/dist/index.js', id: '@typescript-eslint/parser', importerName: '.eslintrc.js', importerPath: '/dir/no-shadow-eslint-enum-test/.eslintrc.js' }, parserOptions: { ecmaVersion: 2018, sourceType: 'module' }, plugins: { '@typescript-eslint': [Object] }, processor: undefined, reportUnusedDisableDirectives: undefined, root: undefined, rules: { 'no-shadow': 'error' }, settings: undefined } ] on /dir/no-shadow-eslint-enum-test/src +3ms
  eslint:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: '/dir/no-shadow-eslint-enum-test', loose: false } ] +346ms
  eslint:ignore-pattern   processed: { basePath: '/dir/no-shadow-eslint-enum-test', patterns: [ '/**/node_modules/*' ] } +0ms
  eslint:ignore-pattern Check {
  filePath: '/dir/no-shadow-eslint-enum-test/src/index.ts',
  dot: false,
  relativePath: 'src/index.ts',
  result: false
} +0ms
  eslint:cli-engine Lint /dir/no-shadow-eslint-enum-test/src/index.ts +0ms
  eslint:linter Linting code for /dir/no-shadow-eslint-enum-test/src/index.ts (pass 1) +0ms
  eslint:linter Verify +0ms
  eslint:linter With ConfigArray: /dir/no-shadow-eslint-enum-test/src/index.ts +0ms
  eslint:linter Generating fixed text for /dir/no-shadow-eslint-enum-test/src/index.ts (pass 1) +22ms
  eslint:source-code-fixer Applying fixes +0ms
  eslint:source-code-fixer shouldFix parameter was false, not attempting fixes +0ms
  eslint:file-enumerator Complete iterating files: ["src/index.ts"] +368ms
  eslint:cli-engine Linting complete in: 369ms +22ms

Versions

package version
@typescript-eslint/parser 4.0.1
TypeScript 4.0.2
ESLint 7.8.0
node 12.18.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    fix: user errorissue was fixed by correcting the configuration / correcting the codepackage: parserIssues related to @typescript-eslint/parser

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions