Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]await on non-async function does not throw an error #2997

Closed
Labels
package: parserIssues related to @typescript-eslint/parserworking as intendedIssues that are closed as they are working as intended
@AbdelrahmanHafez

Description

@AbdelrahmanHafez
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I haveread the FAQ and my problem is not listed.

Repro

{"parser":"@typescript-eslint/parser","plugins": ["@typescript-eslint"]}
run();functionrun(){await'anything';// SyntaxError: await is only valid in async function}

Expected Result

Expected ESLint to throw an error, I am usingawait without declaring the function asasync.

  4:9  error  Parsing error: Unexpected token 'anything'   ✖ 1 problem (1 error, 0 warnings)

Actual Result
ESLint falsely passes, when removing theparser property in.eslintrc, it correctly gives me the error in the expected result.

Additional Info

Debug output:

  eslint:cli CLI args: [ '--debug', './test.js' ] +0ms  eslint:cli Running on files +5ms  eslintrc:config-array-factory Loading .eslintignore file: my-directory\.eslintignore +0ms  eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: 'my-directory', loose: false } ] +0ms  eslintrc:ignore-pattern   processed: { basePath: 'my-directory', patterns: [ '/**/node_modules/*' ] } +5ms  eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: 'my-directory', loose: false } ] +2ms  eslintrc:ignore-pattern   processed: { basePath: 'my-directory', patterns: [ '/**/node_modules/*' ] } +2ms  eslint:file-enumerator Start to iterate files: [ './test.js' ] +0ms  eslint:file-enumerator File: my-directory\test.js +1ms  eslintrc:cascading-config-array-factory Load config files for my-directory. +0ms  eslintrc:cascading-config-array-factory No cache found: my-directory. +2ms  eslintrc:config-array-factory Loading legacy config file: my-directory\.eslintrc +18ms  eslintrc:config-array-factory Config file found: my-directory\.eslintrc +24ms  eslintrc:config-array-factory Loading parser "@typescript-eslint/parser" from my-directory\.eslintrc +1ms  eslintrc:config-array-factory Loaded: @typescript-eslint/parser@4.14.1 (my-directory\node_modules\@typescript-eslint\parser\dist\index.js) +3ms  eslintrc:config-array-factory Loading plugin "@typescript-eslint" from my-directory\.eslintrc +286ms  eslintrc:config-array-factory Loaded: @typescript-eslint/eslint-plugin@4.14.1 (my-directory\node_modules\@typescript-eslint\eslint-plugin\dist\index.js) +2ms  eslintrc:config-array-factory Plugin my-directory\node_modules\@typescript-eslint\eslint-plugin\dist\index.js loaded in: 291ms +292ms  eslintrc:cascading-config-array-factory No cache found: E:\Info\localhost\Web Development\NodeJS. +610ms  eslintrc:config-array-factory Config file not found on E:\Info\localhost\Web Development\NodeJS +3ms  eslintrc:cascading-config-array-factory No cache found: E:\Info\localhost\Web Development. +2ms  eslintrc:config-array-factory Config file not found on E:\Info\localhost\Web Development +4ms  eslintrc:cascading-config-array-factory No cache found: E:\Info\localhost. +4ms  eslintrc:config-array-factory Config file not found on E:\Info\localhost +2ms  eslintrc:cascading-config-array-factory No cache found: E:\Info. +2ms  eslintrc:config-array-factory Config file not found on E:\Info +1ms  eslintrc:cascading-config-array-factory No cache found: E:\. +2ms  eslintrc:config-array-factory Config file not found on E:\ +3ms  eslintrc:cascading-config-array-factory Configuration was determined: ConfigArray(3) [ { type: 'config', name: 'DefaultIgnorePattern', filePath: '', criteria: null, env: undefined, globals: undefined, ignorePattern: IgnorePattern { patterns: [Array], basePath: 'my-directory', loose: false }, noInlineConfig: undefined, parser: undefined, parserOptions: undefined, plugins: undefined, processor: undefined, reportUnusedDisableDirectives: undefined, root: undefined, rules: undefined, settings: undefined }, { type: 'config', name: '.eslintrc', filePath: 'my-directory\\.eslintrc', criteria: null, env: undefined, globals: undefined, ignorePattern: undefined, noInlineConfig: undefined, parser: { error: null, filePath: 'my-directory\\node_modules\\@typescript-eslint\\parser\\dist\\index.js', id: '@typescript-eslint/parser', importerName: '.eslintrc', importerPath: 'my-directory\\.eslintrc' }, parserOptions: undefined, plugins: { '@typescript-eslint': [Object] }, processor: undefined, reportUnusedDisableDirectives: undefined, root: undefined, rules: undefined, settings: undefined }, { type: 'ignore', name: '.eslintignore', filePath: 'my-directory\\.eslintignore', criteria: null, env: undefined, globals: undefined, ignorePattern: IgnorePattern { patterns: [Array], basePath: 'my-directory', loose: true }, noInlineConfig: undefined, parser: undefined, parserOptions: undefined, plugins: undefined, processor: undefined, reportUnusedDisableDirectives: undefined, root: undefined, rules: undefined, settings: undefined } ] on my-directory +4ms  eslintrc:ignore-pattern Create with: [ IgnorePattern { patterns: [ '/**/node_modules/*' ], basePath: 'my-directory', loose: false }, IgnorePattern { patterns: [ '/node_modules/*' ], basePath: 'my-directory', loose: true } ] +652ms  eslintrc:ignore-pattern   processed: { basePath: 'my-directory', patterns: [ '/**/node_modules/*', '/node_modules/*' ] } +4ms  eslintrc:ignore-pattern Check {  filePath: 'my-directory\\test.js',  dot: false,  relativePath: 'test.js',  result: false} +2ms  eslint:cli-engine Lint my-directory\test.js +0ms  eslint:linter Linting code for my-directory\test.js (pass 1) +0ms  eslint:linter Verify +1ms  eslint:linter With ConfigArray: my-directory\test.js +0ms  eslint:linter Generating fixed text for my-directory\test.js (pass 1) +24ms  eslint:source-code-fixer Applying fixes +0ms  eslint:source-code-fixer shouldFix parameter was false, not attempting fixes +1ms  eslint:file-enumerator Complete iterating files: ["./test.js"] +688ms  eslint:cli-engine Linting complete in: 691ms +31ms

Versions

packageversion
@typescript-eslint/parser4.14.1
TypeScript4.1.3
ESLint7.19.0
node14.15.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: parserIssues related to @typescript-eslint/parserworking as intendedIssues that are closed as they are working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp