Skip to content

Rule Change: Treat class / instance fields as named constants in no-magic-numbers #16228

@terrablue

Description

@terrablue

What rule do you want to change?

no-magic-numbers

What change to do you want to make?

Generate fewer warnings

How do you think the change should be implemented?

A new default behavior

Example code

class Foo {
  static bar = 1;
  baz = 2;
}

What does the rule currently do for this code?

Shows these two errors:
No magic number: 1
No magic number: 2

What will the rule do after it's changed?

Show no errors.

Participation

  • I am willing to submit a pull request to implement this change.

Additional comments

No response

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionenhancementThis change enhances an existing feature of ESLintruleRelates to ESLint's core rules

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions