feat(css-plugins-to-native-css): better ast-grep usage - #11
Open
AugustinMauroy wants to merge 2 commits into
Open
feat(css-plugins-to-native-css): better ast-grep usage#11AugustinMauroy wants to merge 2 commits into
css-plugins-to-native-css): better ast-grep usage#11AugustinMauroy wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: d02519d 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 |
avivkeller
requested changes
Aug 13, 2026
avivkeller
left a comment
Member
There was a problem hiding this comment.
Don't bump the version, changesets will handle that
avivkeller
reviewed
Aug 13, 2026
| "@webpack/css-plugins-to-native-css": patch | ||
| --- | ||
|
|
||
| remove `unquote` and use `is` methode instead of `kind() ===` |
Member
There was a problem hiding this comment.
Suggested change
| remove `unquote` and use `is` methode instead of `kind() ===` | |
| Updates internal comparisons of `ast-grep` to use built-in operators |
avivkeller
reviewed
Aug 13, 2026
| const manifest = namedChildren(rootNode)[0]; | ||
| if (!manifest || manifest.kind() !== "object") return null; | ||
|
|
||
| if (!manifest || !manifest.is("object")) return null; |
Member
There was a problem hiding this comment.
Suggested change
| if (!manifest || !manifest.is("object")) return null; | |
| if (!(manifest?.is("object"))) return null; |
Does this work?
avivkeller
reviewed
Aug 13, 2026
Comment on lines
+28
to
+32
|
|
||
| editor.finalizeRemovals(); | ||
|
|
||
| if (!editor.hasEdits) return null; | ||
|
|
avivkeller
reviewed
Aug 13, 2026
| const arg = args[0]; | ||
| if (!arg.is("string")) return false; | ||
|
|
||
| return arg.find({ rule: { kind: "string_fragment" } })?.text() === PLUGIN_MODULE; |
Member
There was a problem hiding this comment.
We have { rule: { kind: "string_fragment" } }) eight times, can that be unified?
avivkeller
reviewed
Aug 13, 2026
Comment on lines
+434
to
+435
| // in theroy it's impossible to have "string" wihhout a string_fragment | ||
| // but typescript doesn't know that, so we need to check for null/undefined |
Member
There was a problem hiding this comment.
Can you reword this comment, I'm afraid I don't follow
avivkeller
reviewed
Aug 13, 2026
| ); | ||
|
|
||
| if (!publicPath || !publicPath.is("string")) return false; | ||
|
|
Member
There was a problem hiding this comment.
Can you revert the unrelated newline changes?
avivkeller
reviewed
Aug 13, 2026
Comment on lines
671
to
673
| } | ||
| if (this.pluginNames.size > 0) return true; | ||
| return findConfigObjectFor(usePair) !== null; |
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.
Description
is()instead ofkind() ===unquoteto use nodestring_fragmentgitkeep