Include misc improvements - #6
Conversation
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Introduce `--ignore-path`/`-p` flag and `ignorePaths` config option to exclude files by path, matched relative to the working directory. Enhance `--fix` to warn if source maps are referenced but not regenerated, and implement concurrent file read prefetching for optimized multi-file processing. Add tests to validate these new functionalities and update documentation accordingly. (This commit message was AI-generated.) Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Add support for canonicalizing `<time>` values (e.g., `s` to `ms`) and sorting `min()`/`max()` arguments for consistency. Enable `<angle>` value normalization in aggressive mode, including exact and rounded conversions. Update tests, documentation, and changelog to reflect these improvements. (This commit message was AI-generated.) Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
|
Warning Review limit reached
Next review available in: 23 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughVersion 1.3.0 adds CSS normalization rules, CLI ignore-path filtering, concurrent file prefetching, source-map warnings, MIT licensing, updated documentation, and aligned warning terminology. ChangesCLI and normalization release
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant FileSystem
participant Analyzer
User->>CLI: provide targets and options
CLI->>FileSystem: prefetch target contents
FileSystem-->>CLI: contents or read errors
CLI->>Analyzer: process each target in order
Analyzer-->>CLI: report and optional fixed CSS
CLI-->>User: ordered reports and warnings
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Update ignore path pattern matching to normalize paths to use `/` separators, ensuring consistent behavior across operating systems. This improves compatibility and prevents potential mismatches due to platform differences. (This commit message was AI-generated.) Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bin/css-dedup.js`:
- Around line 14-37: Replace the hardcoded LONG_OPTION_NAMES list with a shared
OPTIONS_CONFIG object containing the parseArgs option definitions, derive the
single-dash validation names from its keys, and pass OPTIONS_CONFIG to parseArgs
so the guard and parser remain synchronized.
- Around line 465-474: Update the file-discovery flow around ignorePathPatterns
and expandTargets so it distinguishes between no CSS files existing under the
positionals and all discovered CSS files being excluded by --ignore-path.
Preserve the existing error for targets with no CSS files, and report that files
were excluded when the ignore patterns remove every discovered file.
In `@bin/css-dedup.test.js`:
- Around line 1850-1953: Hoist the two regex literals used in the source-map
warning assertion and prefetch-ordering assertion to module scope to satisfy
e18e/prefer-static-regex. Define reusable module-level regex constants and
update the relevant tests, “Warns when `--fix` rewrites a file that references a
source map” and “Processes multiple files correctly when reads are prefetched
concurrently,” to use them without changing their matching behavior.
In `@src/normalization.js`:
- Around line 151-170: Hoist the zero-check regular expression used by
scaleDecimalExact to module scope as a shared constant, then update the
negative-zero condition in scaleDecimalExact to reuse that constant instead of
recreating the literal on each call. Leave the exact BigInt scaling logic
unchanged.
- Around line 211-286: Hoist the /^(min|max)\(/i pattern used by
sortMinMaxArguments into a module-level constant, then replace the inline regex
construction inside its scan loop with that constant while preserving the
existing boundary and matching behavior.
In `@src/plugin.test.js`:
- Line 50: Define the consolidation warning pattern as a module-scope regular
expression constant, then update the assertion in the relevant test to reuse
that constant instead of creating the regex inline.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: c3b2b3aa-291d-4aca-b02e-c3faf040f593
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (10)
CHANGELOG.mdLICENSE.txtREADME.mdbin/css-dedup.jsbin/css-dedup.test.jspackage.jsonsrc/index.jssrc/normalization.jssrc/plugin.jssrc/plugin.test.js
There was a problem hiding this comment.
Pull request overview
This PR bundles several CLI, normalization, docs, and release-related updates for css-dedup, including new path-based ignore support, improved equivalence detection (time/angle/min/max), and a 1.3.0 release with MIT licensing.
Changes:
- Added
--ignore-path/-pandignorePathsconfig support to exclude files by relative path. - Improved duplicate detection by canonicalizing
<time>(always), canonicalizing<angle>(aggressive-only), and sortingmin()/max()arguments. - Updated CLI behavior (single-dash long option rejection, source map staleness warning, concurrent file prefetch) and updated docs/tests for the above plus release metadata (MIT + 1.3.0).
Reviewed changes
Copilot reviewed 5 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/plugin.test.js | Updates expected warning text to match new “style sheet” wording. |
| src/plugin.js | Updates savingsOnly withheld warning text (“style sheet”). |
| src/normalization.js | Adds exact unit scaling for time/angle normalization and canonical min()/max() arg sorting. |
| src/index.js | Comment-only wording updates (“style sheet”). |
| README.md | Documents new flags/options and expanded behavior explanations (incl. ignore-path, unit equivalences, source map warning). |
| package.json | Adds MIT license metadata and bumps version to 1.3.0. |
| package-lock.json | Updates lock metadata for 1.3.0 and license. |
| LICENSE.txt | Adds MIT license text. |
| CHANGELOG.md | Adds 1.3.0 entry and minor text/typography tweaks. |
| bin/css-dedup.test.js | Adds test coverage for new normalization and CLI behaviors; updates wording in existing tests. |
| bin/css-dedup.js | Implements ignore-path filtering, rejects -fix-style typos, warns on stale source maps, and prefetches reads concurrently. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Refactor option definitions into a single shared configuration to avoid drift between long and short option handling. Update `expandTargets` to differentiate between no files found and all files excluded, improving error messaging clarity. (This commit message was AI-generated.) Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Summary by CodeRabbit
New Features
--ignore-path/-pandignorePathsconfiguration support for excluding files by relative path.min()/max()arguments.Bug Fixes
--fixwarns when source maps may become outdated.Performance
Documentation