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

Rule proposal: Type-based naming rule #722

Closed
Labels
enhancement: new plugin ruleNew rule request for eslint-pluginhas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@ark120202

Description

@ark120202

I'd like to have a rule that enforces some strict conventions on identifier names.camelcase also allows PascalCase and withid-match it's impossible to enforce this:

// Validconstfoo=getString();// InvalidconstFoo=getString();// Invalid, also conflicts with new-capconstfoo=createClass();// function createClass(): new (...args: any[]) => any// Invalidconstfoo:React.FC= ...;// Any name is [in]valid?constfoo=Math.random()<0.5 ?createClass() :createString();

It also was a limitation for tslint, so there are few relevant issues:

I'm not really sure what kind of configuration fits this rule (or multiple rules?). For me it would be enough to have a stricter version of camelcase that keeps all classes and functions returningJSX.Element in PascalCase and everything else in camelCase, but for some more complex cases it may be worth to have extensible configuration, similar tonaming-convention from tslint-consistent-codestyle, which also would cover#515.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement: new plugin ruleNew rule request for eslint-pluginhas prthere is a PR raised to close thispackage: 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