Skip to content

Rule Change: Normalize definition identifiers in no-*-definition #474

@TKDev7

Description

@TKDev7

What rule do you want to change?

no-*-definition

What change do you want to make?

Generate fewer warnings

How do you think the change should be implemented?

A new default behavior

Example code

<!-- eslint markdown/no-unused-definitions: ["error", { allowDefinitions: ["MERCURY"] }] -->

[MERCURY]: https://example.com/mercury/

What does the rule currently do for this code?

It reports a false positive, flagging the definition as unused, because the identifier in the allow list ("MERCURY") does not match the normalized identifier used by mdast.

What will the rule do after it's changed?

It will correctly recognize that "MERCURY" (regardless of case or whitespace differences) matches the normalized identifier, and will not report the definition as unused.

Participation

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

Additional comments

We can use mdast-util-normalize-identifier, which is used by Mdast internally. This normalization issue affects no-empty-definitions, no-duplicate-definitions, and no-unused-definitions.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions