This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 656
refactor(rome_analyze): deserialize options early #4541
Merged
Merged
Conversation
This file contains 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
✅ Deploy Preview for docs-rometools ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
github-actions
bot
added
A-Linter
Area: linter
A-Project
Area: project configuration and loading
A-Tooling
Area: our own build, development, and release tooling
labels
May 29, 2023
ematipico
force-pushed
the
refactor/rule-options
branch
from
May 29, 2023 16:33
a8d7a36
to
1fd6b5f
Compare
Parser conformance results on ubuntu-latestjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
@nikeee you recently changed the CI output, I believe we forgot to add newlines to the output. Would you be available to do a follow-up PR to fix it? |
@ematipico I'll have a look Edit: #4542 |
ematipico
force-pushed
the
refactor/rule-options
branch
from
May 30, 2023 09:17
593a0fa
to
d60c4c0
Compare
ematipico
force-pushed
the
refactor/rule-options
branch
from
May 30, 2023 13:36
d60c4c0
to
a41466b
Compare
3 tasks
denbezrukov
reviewed
Jun 9, 2023
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_exhaustive_dependencies.rs
Show resolved
Hide resolved
denbezrukov
approved these changes
Jun 9, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
This PR refactors how the options of the linter are parsed/deserialized and passed to the actual linter.
Before, the serialization was done only when the rule was called, which caused various problems:
With this PR, we now serialize all the options early when we parse and deserialize the configuration. The options are passed to the analyzer as a
Box<dyn Any>
, and then we do a downcast when needed. This is safe to do because theAnalyzerOptions
are mandatory to pass, and the'static
restriction is always met.In order to achieve this result, I had to add more restrictions to
Rule::Options
, such asDefault
andClone
.Plus, I refactored the shape of the options of
useExhaustiveDependencies
anduseHookAtTopLevel
. The previous version didn't work out very well withBpaf
, and it was difficult to understand the numbers. With this new version, we can also document the value of the fields when we emit the JSON schema of the configuration.Considering that these two rules are still under
nursery
, I'd say we don't need to create a migration for that, although I will create a changelog line with a hint of how to move to the new version of the configuration.Test Plan
rome_js_analyzer
. Now we pass a full-fledgedrome.json
file, so we can use utility functions that we use inrome_service
;Changelog
Documentation