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

Enhancement: [ban-types] Split into default-less no-restricted-types and more targeted type ban rule(s) #8978

Closed
Assignees
JoshuaKGoldberg
Labels
breaking changeThis change will require a new major version to be releasedlocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginteam assignedA member of the typescript-eslint team should work on this.
Milestone
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Overview

Splitting out of#8700:ban-types has long been a kind of mirror to the core ESLint ruleno-restricted-syntax. But,ban-typesalso comes with some default settings. That means the rule really has two areas of responsibility:

  • Banning confusing built-in types
  • Giving users the ability to ban types of their choosing

That dual-responsibility has led to the rule being more convoluted to configure than average. It's the only rule of ours right now that has to include anextendDefaults option.

/**
* Rules that do funky things with their defaults and require special code
* rather than just JSON.stringify-ing their defaults blob
*/
constSPECIAL_CASE_DEFAULTS=newMap([
['ban-types','[{ /* See below for default options */ }]'],
]);

Once#8977 is in, the defaults forban-types will exclusively target the uppercase aliases of primitive types (Boolean,Number, ...) and the generalFunction andObject types. I think the v8 breaking changes are a good opportunity to further simplify the rule. Proposal: let's...

  • Remove the remaining default options forban-types, rename it tono-restricted-types (to mirrorno-restricted-syntax), and remove it fromrecommended
  • Add 1-3 new rule(s) inrecommended that ban those previous default types
    • Starting proposal: a singleno-uppercase-alias-types rule?

This would be a breaking change in that it would change the defaults forban-types. Note that the stuff linted against by default inban-types would still be linted against - just by different rule(s).

Metadata

Metadata

Labels

breaking changeThis change will require a new major version to be releasedlocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginteam assignedA member of the typescript-eslint team should work on this.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp