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: [array-type] the configsimple-array should be disallowed by the schema #6852

Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinggood first issueGood for newcomerspackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@Gotos

Description

@Gotos

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

https://typescript-eslint.io/play/#ts=5.0.2&sourceType=module&code=MYewdgzgLgBAhgLhgCmgJwJZgOYwD4xgCuAtgEYCmaAlANoC6MAvDAwNwBQoksZSx5Kg2at6nbtBjAkAQTRo4ATwA86LLgIDKaAHwj2XcJIAms+UuVaqeluyA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6AQ2mncNqNPRgA2pERcA9tEgAaTJAAmiAGbsE+QZGSUAtsSS1O3QpAC+AXXBgTIE0A

Repro Code

consta:(string|number)[]=[];constb:number[]=[];constc:Array<string|number>=[];constd:Array<number>=[];

ESLint Config

module.exports={parser:"@typescript-eslint/parser","rules":{"@typescript-eslint/array-type":["error",{"default":"simple-array"}]}};

tsconfig

No response

Expected Result

The constants a and d should fail the 'array-simple' rule and thus cause the following errors:

a:Array type using 'T[]' is forbidden for non-simple types. Use 'Array<T>'
d:Array type using 'Array<number>' is forbidden for simple types. Use 'number[]' instead.

Actual Result

All four constants fail the rule and cause errors. This means for example that neithernumber[] norArray<number> is allowed, making it impossible to annotate array types without causing eslint error, if the "array-type" rule is configured with "simple-array".

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinggood first issueGood for newcomerspackage: 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