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] Does not validate shape of config #6892

Closed as not planned
Closed as not planned
Labels
bugSomething isn't workingduplicateThis issue or pull request already existspackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@domdomegg

Description

@domdomegg

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.3&sourceType=module&code=MYewdgzgLgBAtgTwMpQE4EswHMIC4bQbYDaAujALwxkDcAUKJLCFABYCmqKRO+AgqlQBDBAB5CmLAD5K1UvSA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6AQ2mncNqNPRgA2pERcA9tEgAaKJ26FIAXXBgAviDVA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

Repro Code

constmyStrings:string[]=[];constotherStrings:Array<string>=[];
### ESLint Config```javascriptmodule.exports = {  parser: "@typescript-eslint/parser",  rules: {    "@typescript-eslint/array-type": ["error", "array"]  },};

tsconfig

No response

Expected Result

I initially expected that I'd enforce array types (e.g.string[] rather thanArray<string> everywhere), becuase I skimmedhttps://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/docs/rules/array-type.md and didn't realise this should be an options object.

This is a user error, and should instead be configured:

    "@typescript-eslint/array-type": ["error", { default: "array" }]

That said, I then expected the rule would give me some kind of warning or error that my eslint config was invalid, so I could debug this quickly.

Actual Result

The rule doesn't complain about its configuration, but instead highlights every array type it sees as an error - and tries to convert them to the other type in a loop.

Additional Info

There is also#6852, which relates to other config not being validated by this rule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already existspackage: 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