Repository navigation
Conversation
|
@0Miles is attempting to deploy a commit to the Aoyue Team on Vercel. A member of the Team first needs to authorize it. |
0Miles
added a commit
to 0Miles/css
that referenced
this pull request
Apr 30, 2026
The validator's existing TODO-marked workaround for math functions only checked the error fragment (error.css) for min(/max(/clamp( substrings. Some mismatches surface only a sub-token (e.g. right: max(0px, 1rem) reports the bare 0px arg), so the suppression missed valid usages and users saw false positives. - validate-css.ts: check FULL value text in addition to error.css - Extended math-fn list to all CSS Values 4 functions: calc, min, max, clamp, sin, cos, tan, asin, acos, atan, atan2, exp, log, pow, sqrt, hypot, abs, sign, round, mod, rem - 16 validator test cases (min/max/clamp/calc/oklch/rotate/ aspect-ratio/contain/container-type valid; truly invalid still errors) + 7 eslint-plugin RuleTester cases including right:max(), font-size:clamp(calc()), aspect:16/9 Scope: master-co#338 was originally tagged in the same umbrella but it's a separate feature (recommended-syntax warnings, new lint rules) — see PR master-co#428. Closes master-co#405 Closes master-co#323 Closes master-co#331
Adds a 4th rule to @master/eslint-plugin-css: warns (with auto-fix) when a set of long-hand utilities can be collapsed to the equivalent shorthand. Initial recommendation set: - mt mr mb ml → m - mt mb → my - ml mr → mx - pt pr pb pl → p - pt pb → py - pl pr → px - top right bottom left → inset - top bottom → inset-y - left right → inset-x Strict matching: same value, same conditional-query suffix (@sm, :hover), same ! flag. 4-side runs before 2-side so a fully-bracketed group is collapsed once. Auto-fix uses a single replaceTextRange over the whole span, avoiding ESLint's "overlapped fix" guard. Wired into the recommended config at warn severity. Easy to extend — the RECOMMENDATIONS table accepts more entries. Bonus fix in resolve-class-node: the LAST class node of a className attribute had range[0] set to the className value's start instead of the individual class's start; any rule that sorts class nodes by source position would mis-order. Same PR. - 13 RuleTester cases covering valid (already-shorthand, different values, different conditions) and invalid (4-side, 2-side, 3-side, conditions, important, mixed) - 14 plugin test files still pass; pnpm lint + pnpm type-check clean Closes master-co#338
0Miles
force-pushed
the
feat/338-eslint-recommended-syntax
branch
from
April 30, 2026 19:05
59805be to
2ab4279
Compare
Contributor
Author
|
Retracting. Implementation is technically sound (13 RuleTester cases pass, auto-fix works, bonus pre-existing range[0] bug fixed in resolve-class-node), but the choice of which 9 RECOMMENDATIONS to ship is a policy call for the maintainer:
The framework is ready and easy to extend. Will re-submit after maintainer signs off on the recommendation list. Branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #338.
Summary
Adds a 4th rule to `@master/eslint-plugin-css`: warns (with auto-fix) when a set of long-hand utilities can be collapsed to the equivalent shorthand.
Initial recommendation set
Strict matching: same value, same conditional-query suffix (`@sm`, `:hover`), same `!` flag. 4-side recommendation runs before 2-side so a fully-bracketed group is collapsed once. Auto-fix uses a single `replaceTextRange` over the whole span, avoiding ESLint's "overlapped fix" guard.
Wired into the `recommended` config at `warn` severity. Easy to extend — the `RECOMMENDATIONS` table accepts more entries.
Bonus fix in resolve-class-node
Building the auto-fix surfaced a pre-existing bug: the LAST class node of a className attribute had `range[0]` set to the className value's start instead of the individual class's start. Any rule that sorts class nodes by source position would mis-order. Fixed in the same PR; all 14 existing eslint-plugin test files still pass.
Testing