Skip to content

Rule Change: Restrict allowProperties and allowUnits options to known values #303

@thecalamiity

Description

@thecalamiity

What rule do you want to change?

prefer-logical-properties

What change do you want to make?

Other

How do you think the change should be implemented?

Other

Example code

/* eslint css/prefer-logical-properties: ["error", { allowUnits: ["vww"] }] */

a {
  margin: 10vw;
}

What does the rule currently do for this code?

Currently, the rule does not validate the allowUnits option against known units. Since "vww" is not a valid key in unitReplacements, it is silently ignored.

What will the rule do after it's changed?

After the schema change, the rule’s configuration will be strictly validated:

  • "vww" is not a valid unit according to unitReplacements.keys().
  • ESLint will report a configuration error when parsing the rule options.
  • Only recognized units like "vw", "vh", "vi", etc., will be allowed in allowUnits.

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 inclusionenhancementNew feature or request

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions