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 666
feat(rome_service): parse configuration via JSON parser #4043
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. |
MichaReiser
reviewed
Dec 12, 2022
Parser conformance results on ubuntu-latestjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
ematipico
force-pushed
the
feat/config-json-parse
branch
from
December 12, 2022 12:07
4b433fd
to
7ce8c37
Compare
xunilrj
reviewed
Dec 12, 2022
crates/rome_service/tests/invalid/formatter_line_width_too_high.json.snap
Show resolved
Hide resolved
Israel-Laguan
approved these changes
Dec 25, 2022
ematipico
force-pushed
the
feat/config-json-parse
branch
from
December 30, 2022 19:39
3ac4605
to
77de9a4
Compare
ematipico
force-pushed
the
feat/config-json-parse
branch
from
January 1, 2023 19:13
508a4b3
to
041be09
Compare
Israel-Laguan
approved these changes
Jan 1, 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
Part of #4042
This PR implements the following:
A new trait called
VisitConfigurationNode
has been created, which is generic against aL: Language
. This will allow us to implement the parsing ofConfiguration
against multiple languages. So far, I have created only three functions:visit_member_name
visit_member_value
visit_map
Initially, I had created more functions - like
visit_string_node
- but I ended up not using them, so I decided to keep only the ones I used. We can add new functions if the need arises.A new trait called
VisitConfigurationNodeAsJson
adds functions and patterns I used throughout the implementors.ConfigurationError
has been renamedConfigurationErrorKind
, and a new struct calledConfigurationDiagnostic
has been created, which is in charge of creating dedicated diagnostics based on the situation encountered.ConfigurationErrorKind
is now part ofConfigurationDiagnostic
.This PR doesn't implement the parsing and validation of the various groups we have inside
linter.rules.<group>
. There's a lot of generated code there, and I thought I should stop there and make another PR just for this.This PR doesn't handle bogus nodes and partially valid documents.
Test Plan
I created a new test suite that reads JSON files as input and prints the diagnostics encountered. The test suite, for now, is meant only for invalid cases. I have tried to cover the majority of "special" cases we have inside our configuration.
Open questions
For now, I left out on purpose all cases where we could find
Bogus
nodes. I suppose the question is what we should do with partially invalid configuration and how diagnostics should be collected.