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: [@typescript-eslint/keyword-spacing] Unexpected space(s) before "{" in import type #6063

Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingformattingRelated to whitespace/bracket formatting. We strongly recommend you use a formatter instead.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@crystalfp

Description

@crystalfp

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.
  • I havesearched for related issues and found none that matched my issue.
  • I haveread the FAQ and my problem is not listed.

Playground Link

none

Repro Code

importtype{SavedQueries}from"./SavedQueries.js";importtypehttp2from"node:http2";importtypehttpfrom"node:http";whereSavedQueries.jscontains only:exportconstSavedQueries;

ESLint Config

parser:'@typescript-eslint/parser'plugins:-'@typescript-eslint'extends:-'eslint:recommended'-'plugin:@typescript-eslint/recommended'-'plugin:@typescript-eslint/recommended-requiring-type-checking'parserOptions:    ecmaVersion:2021    ecmaFeatures:        impliedStrict:true    project:-./server/tsconfig.jsonsettings:import/parsers:{'@typescript-eslint/parser': [.ts, .tsx]}import/resolver:{typescript:{}}import/extensions:[.js,.ts]import/ignore:[node_modules]env:    es2021:true    node:truerules:keyword-spacing:off'@typescript-eslint/keyword-spacing':-warn-before:true          after:false          overrides:            else:{after:true}return:{after:true}try:{after:true}catch:{after:false}            case:{after:true}const:{after:true}throw:{after:true}let:{after:true}do:{after:true}of:{after:true}as:{after:true}finally:{after:true}from:{after:true}import:{after:true}export:{after:true}default:{after:true}

tsconfig

{"compilerOptions": {"target":"esnext","module":"esnext","lib": ["esnext",    ],"removeComments":true,"strict":true,"alwaysStrict":true,"useDefineForClassFields":true,"noUnusedLocals":true,"noUnusedParameters":true,"noImplicitReturns":true,"moduleResolution":"node","types": ["node",    ],"allowSyntheticDefaultImports":true,"esModuleInterop":true,"resolveJsonModule":true,"forceConsistentCasingInFileNames":true,"importsNotUsedAsValues":"remove","strictNullChecks":true  },"include": ["*"  ],"exclude": ["./node_modules","./tests"  ]}

Expected Result

The rule always worked on my codebase with version 5.43.0. The error message appeared as soon as I moved to version 5.44.0

Actual Result

warning: Unexpected space(s) before "{" (@typescript-eslint/keyword-spacing) at server\ServerResources.ts:13:13:> 13 | import type {SavedQueries} from "./SavedQueries.js";     |             ^  14 | import type http2 from "node:http2";  15 | import type http from "node:http";  16 |warning: Unexpected space(s) before "http2" (@typescript-eslint/keyword-spacing) at server\ServerResources.ts:14:13:  13 | import type {SavedQueries} from "./SavedQueries.js";> 14 | import type http2 from "node:http2";     |             ^  15 | import type http from "node:http";  16 |warning: Unexpected space(s) before "http" (@typescript-eslint/keyword-spacing) at server\ServerResources.ts:15:13:  13 | import type {SavedQueries} from "./SavedQueries.js";  14 | import type http2 from "node:http2";> 15 | import type http from "node:http";     |             ^  16 |

Additional Info

Also it is not possible to add asoverrides the linetype: {after: true} that elicits the following error running eslint:

Oops! Something went wrong! :(ESLint: 8.28.0Error: --config:        Configuration for rule "@typescript-eslint/keyword-spacing" is invalid:        Value {"else":{"after":true},"return":{"after":true},"try":{"after":true},"catch":{"after":false},"case":{"after":true},"const":{"after":true},"throw":{"after":true},"let":{"after":true},"do":{"after":true},"of":{"after":true},"as":{"after":true},"finally":{"after":true},"from":{"after":true},"import":{"after":true},"export":{"after":true},"default":{"after":true},"type":{"after":true}} should NOT have additional properties.

Versions

packageversion
@typescript-eslint/eslint-plugin5.44.0
@typescript-eslint/parser5.44.0
TypeScript4.9.3
ESLint8.28.0
node18.12.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingformattingRelated to whitespace/bracket formatting. We strongly recommend you use a formatter instead.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    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