Skip to content
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

feat: Add a lint for unsupported CSS Module selector #784

Merged
merged 9 commits into from
Aug 2, 2024

Conversation

kdy1
Copy link
Contributor

@kdy1 kdy1 commented Aug 1, 2024

Related: vercel/next.js#64299

I made it a parse error because the specification about it is ambiguous thus it's better to bail out.

selectors/parser.rs Outdated Show resolved Hide resolved
kdy1 and others added 2 commits August 1, 2024 19:45
Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
src/error.rs Outdated Show resolved Hide resolved
src/selector.rs Outdated Show resolved Hide resolved
kdy1 and others added 3 commits August 2, 2024 10:43
Co-authored-by: Devon Govett <devongovett@gmail.com>
Co-authored-by: Devon Govett <devongovett@gmail.com>
@kdy1 kdy1 requested a review from devongovett August 2, 2024 01:45
Copy link
Member

@devongovett devongovett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Will do a release tomorrow.

@devongovett devongovett merged commit be53018 into parcel-bundler:master Aug 2, 2024
3 checks passed
@kdy1 kdy1 deleted the next-64299 branch August 6, 2024 02:38
@kdy1
Copy link
Contributor Author

kdy1 commented Aug 6, 2024

@devongovett Did you do a release?

@devongovett
Copy link
Member

crates are now published. I ran into a CI build issue for the npm binaries that I still need to fix, but crates should be usable.

@kdy1
Copy link
Contributor Author

kdy1 commented Aug 6, 2024

Thank you!

@Baptistemontan
Copy link

Sorry to bother, but this should not have been a patch semver bump but a minor bump, the addition of a new variant to a public enum is breaking some builds. trunk can't be installed at the moment because it tries to make lightningcss alpha 55 works with parcel_selectors v0.26.6, and cause this error:

error[E0004]: non-exhaustive patterns: `&SelectorParseErrorKind::AmbiguousCssModuleClass(_)` not covered
   --> C:\Users\bapti\.cargo\registry\src\index.crates.io-6f17d22bba15001f\lightningcss-1.0.0-alpha.55\src\error.rs:266:11
    |
266 |     match &err {
    |           ^^^^ pattern `&SelectorParseErrorKind::AmbiguousCssModuleClass(_)` not covered
    |
note: `SelectorParseErrorKind<'_>` defined here
   --> C:\Users\bapti\.cargo\registry\src\index.crates.io-6f17d22bba15001f\parcel_selectors-0.26.6\parser.rs:188:1
    |
188 | pub enum SelectorParseErrorKind<'i> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
201 |   AmbiguousCssModuleClass(CowRcStr<'i>),
    |   ----------------------- not covered
    = note: the matched value is of type `&SelectorParseErrorKind<'_>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
299 ~       SelectorParseErrorKind::ClassNeedsIdent(t) => SelectorError::ClassNeedsIdent(t.into()),
300 ~       &SelectorParseErrorKind::AmbiguousCssModuleClass(_) => todo!(),

@devongovett
Copy link
Member

Ah sorry about that, I didn't realize it wasn't pinned. Not sure I can fix it at this point. Will be more careful in the future.

kdy1 added a commit to vercel/next.js that referenced this pull request Aug 7, 2024
### What?

Update `lightningcss` crate of next.js


### Why?

To apply parcel-bundler/lightningcss#784 and parcel-bundler/lightningcss#783

### How?

- Closes PACK-2933
- Closes PACK-3100
- Closes #66191
- Closes #64299
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 16, 2024
### What?

Update `lightningcss` crate of next.js


### Why?

To apply parcel-bundler/lightningcss#784 and parcel-bundler/lightningcss#783

### How?

- Closes PACK-2933
- Closes PACK-3100
- Closes #66191
- Closes #64299
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants