-
-
Notifications
You must be signed in to change notification settings - Fork 989
Add declaration-property-value-keyword-no-deprecated
#8223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: c3a1667 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| ], | ||
| ]); | ||
|
|
||
| export const singleValueColorProperties = new Set([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scrollbar-color accept 2 colors
| ### Deprecated | ||
|
|
||
| Disallow deprecated things with these `no-deprecated` rules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #8208
| const NAME_TO_VALUE = new Map([ | ||
| [ | ||
| 'appearance', | ||
| /** @type {string | string[] | Record<string, string>} */ ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typescript uses the first value to infer the type of the values
i.e. Map<string, string | string[] | Record<string, string>> errors out
| ['min-height', ['intrinsic', 'min-intrinsic']], | ||
| ['min-width', ['intrinsic', 'min-intrinsic']], | ||
| ['max-height', ['intrinsic', 'min-intrinsic']], | ||
| ['max-width', ['intrinsic', 'min-intrinsic']], | ||
| ['height', ['intrinsic', 'min-intrinsic']], | ||
| ['width', ['intrinsic', 'min-intrinsic']], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supporting arrays as keys for the map would be too impractical.
i.e.
[
['min-height', 'min-width', 'max-height', 'max-width', 'height', 'width'],
['intrinsic', 'min-intrinsic']
],
docs/user-guide/rules.md
Outdated
| <!-- prettier-ignore-start --> | ||
| | | | | | ||
| | :-- | :-: | :-: | | ||
| | [`declaration-property-value-no-deprecated`](../../lib/rules/declaration-property-value-no-deprecated/README.md)<br/>Disallow deprecated values for properties within declarations. | | 🔧 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it empty because I can't guarantee that it will part of the next stylelint-config-standard release.
declaration-property-value-no-deprecateddeclaration-property-value-keyword-no-deprecated
7701135 to
6efedb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mouvedia Thank you for working on this rule, especially digging into the mappings between deprecated and new keywords! It's looking good.
lib/rules/declaration-property-value-keyword-no-deprecated/README.md
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/README.md
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/README.md
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/README.md
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/__tests__/index.mjs
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
a043c3b to
08bd6a0
Compare
jeddy3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for making the changes. The rule is shaping up.
I've made another pass and requested some changes.
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.cjs
Outdated
Show resolved
Hide resolved
…perty-value-keyword-no-deprecated`
Co-authored-by: Richard Hallows <[email protected]>
Co-authored-by: Richard Hallows <[email protected]>
jeddy3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you.
Let's wait for a second approval before merging.
ybiquitous
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the pull request. I think there are no more big problems. 👍🏼
I've left some minor refactoring suggestions, so can you please take a look?
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs
Outdated
Show resolved
Hide resolved
| let fix; | ||
| let message; | ||
| let messageArgs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note
I wish eslint-config-stylelint would allow
let fix, message, messageArgs;
ybiquitous
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. The code has now become more readable. LGTM 👍🏼
Co-authored-by: Richard Hallows <[email protected]>
| datasource | package | from | to | | ---------- | --------- | ------- | ------- | | npm | stylelint | 16.12.0 | 16.13.0 | ## [v16.13.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#16130---2025-01-12) It adds 3 rules to help you write error-free at-rules and 2 rules to warn you about deprecated CSS features. We've turned these rules on in our [standard config](https://www.npmjs.com/package/stylelint-config-standard). It also adds new rule options, a feature to display how long rules take, lax autofix and support for `messageArgs` in more rules. It fixes 7 bugs. Lastly, we've made a deprecation that may affect some plugins. We've updated our docs for [plugin authors](docs/developer-guide/plugins.md#quiet-deprecation-warnings) and [end users](docs/user-guide/options.md#quietdeprecationwarnings) on how to silence deprecation warnings. - Deprecated: ambiguous position arguments passed to `utils.report()` ([#8244](stylelint/stylelint#8244)) ([@romainmenke](https://github.com/romainmenke)). - Added: `lax`/`strict` values to the `fix` Node.js API option and CLI flag ([#8106](stylelint/stylelint#8106)) ([@ryo-manba](https://github.com/ryo-manba)). - Added: support for profiling rule performance via the `TIMING` environment variable ([#8108](stylelint/stylelint#8108)) ([@ryo-manba](https://github.com/ryo-manba)). - Added: `at-rule-descriptor-no-unknown` rule ([#8197](stylelint/stylelint#8197)) ([@ryo-manba](https://github.com/ryo-manba)). - Added: `at-rule-descriptor-value-no-unknown` rule ([#8211](stylelint/stylelint#8211)) ([@ryo-manba](https://github.com/ryo-manba)). - Added: `at-rule-no-deprecated` rule ([#8251](stylelint/stylelint#8251)) ([@jeddy3](https://github.com/jeddy3)). - Added: `at-rule-prelude-no-invalid` rule ([#8268](stylelint/stylelint#8268)) ([@ryo-manba](https://github.com/ryo-manba)). - Added: `declaration-property-value-keyword-no-deprecated` rule ([#8223](stylelint/stylelint#8223)) ([@Mouvedia](https://github.com/Mouvedia)). - Added: `"ignore": ["at-rule-preludes", "declaration-values"]` to `string-no-newline` ([#8214](stylelint/stylelint#8214)) ([@ryo-manba](https://github.com/ryo-manba)). - Added: `messageArgs` to `declaration-property-value-no-unknown`, `font-family-name-quotes`, `font-family-no-duplicate-names`, `function-calc-no-unspaced-operator`, `import-notation`, `media-feature-name-unit-allowed-list`, `selector-attribute-quotes` and `selector-pseudo-element-colon-notation` ([#8285](stylelint/stylelint#8285) & [#8252](stylelint/stylelint#8252)) ([@Mouvedia](https://github.com/Mouvedia)). - Fixed: deprecation warnings to only display once per (custom) rule ([#8265](stylelint/stylelint#8265)) ([@romainmenke](https://github.com/romainmenke)). - Fixed: `*-no-vendor-prefix` message ambiguity ([#8239](stylelint/stylelint#8239)) ([@Mouvedia](https://github.com/Mouvedia)). - Fixed: `at-rule-(dis)allowed-list`, `at-rule-no-vendor-prefix`, `at-rule-property-required-list` message argument ([#8277](stylelint/stylelint#8277)) ([@Mouvedia](https://github.com/Mouvedia)). - Fixed: `at-rule-property-required-list` message for inclusion of properties and descriptors ([#8207](stylelint/stylelint#8207)) ([@jeddy3](https://github.com/jeddy3)). - Fixed: `at-rule-*` false positives and negatives for `@charset` rule ([#8215](stylelint/stylelint#8215)) ([@jeddy3](https://github.com/jeddy3)). - Fixed: `declaration-property-value-no-unknown` false positives for descriptors ([#8240](stylelint/stylelint#8240)) ([@jeddy3](https://github.com/jeddy3)). - Fixed: `property-(dis)allowed-list` false negatives for custom properties, use `/^--/` to (dis)allow them ([#8209](stylelint/stylelint#8209)) ([@fbasmaison-lucca](https://github.com/fbasmaison-lucca)). - Fixed: `property-no-unknown` false positives for descriptors ([#8203](stylelint/stylelint#8203)) ([@jeddy3](https://github.com/jeddy3)). - Fixed: `selector-pseudo-class-no-unknown` false positives for deprecated pseudo-classes ([#8264](stylelint/stylelint#8264)) ([@Mouvedia](https://github.com/Mouvedia)). - Fixed: `selector-type-case` false positives for `hatchPath` ([#8264](stylelint/stylelint#8264)) ([@Mouvedia](https://github.com/Mouvedia)). - Fixed: `selector-type-no-unknown` false positives for `shadow`, `hatch` and `hatchpath` ([#8264](stylelint/stylelint#8264)) ([@Mouvedia](https://github.com/Mouvedia)).
Manual changes: - removed `indentation` rule (stylelint/stylelint#6504, stylelint/stylelint#6979) - deprecated property `clip` no autofixed (stylelint/stylelint#8699) - removed deprecated `word-break: break-word` (stylelint/stylelint#8223) Automatic changes: - `import-notation` now uses `"url"` (stylelint/stylelint-config-standard#266) - use `inset` instead of `top` `right` `bottom` `left` (stylelint/stylelint#6699) - use `overflow-wrap` instead of `word-wrap` (stylelint/stylelint#8682) - added `media-feature-range-notation` (stylelint/stylelint-config-standard#284) Configuration now in ESM format (https://stylelint.io/migration-guide/to-16).
Manual changes: - removed `indentation` rule (stylelint/stylelint#6504, stylelint/stylelint#6979) - deprecated property `clip` no autofixed (stylelint/stylelint#8699) - removed deprecated `word-break: break-word` (stylelint/stylelint#8223) Automatic changes: - `import-notation` now uses `"url"` (stylelint/stylelint-config-standard#266) - use `inset` instead of `top` `right` `bottom` `left` (stylelint/stylelint#6699) - use `overflow-wrap` instead of `word-wrap` (stylelint/stylelint#8682) - added `media-feature-range-notation` (stylelint/stylelint-config-standard#284) Configuration now in ESM format (https://stylelint.io/migration-guide/to-16).
Closes #8178
I went for a simple implementation.
i.e.
not trying to fix the
word-break: break-word;caseshorthand properties are not supported
e.g.
background: no-repeat border-box InactiveBorder;intrinsicandmin-intrinsicdon't get a fix because it would require a lot of research to confirm that the standard-compliant keywords are truly equivalent in every aspecti.e. it's unsafe
This PR also remove some duplicated keywords from
systemColorsKeywords.