+
Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

chore(rome_analyzer): declare rules with version #2891

Merged
merged 5 commits into from
Jul 19, 2022
Merged

Conversation

ematipico
Copy link
Contributor

@ematipico ematipico commented Jul 18, 2022

Summary

This adds once of the nice to have listed in #2835

Proposed on discord: https://discord.com/channels/678763474494423051/978209399120216076/987343929231941673

The PR changes how the declare_rule is defined. Now the shape is different and it has a struct-like syntax:

declare_rule! {
    ///  Disallow labels that share a name with a variable
    pub(crate) NoLabelVar {
        version: "0.7.0",
        name: "noLabelVar"
    }
}

It also accepts another field, which is a possible deprecation reason. This will be useful in the future, when we want to ditch or change rules. It's not used anywhere yet, other than being part of the metadata:

declare_rule! {
    ///  Disallow labels that share a name with a variable
    pub(crate) NoLabelVar {
        version: "0.7.0",
        name: "noLabelVar",
		deprecated: "This rule wasn't safe, please use `noLalbelInVar`"
    }
}

The small downside of this approach is that the version is hardcoded, so the developer has to make sure to put the correct next version (usually the next minor). But, for now, I think it's a small price to pay compared on setting workflows and branches for multiple websites.

I also tweaked a bit the documentation cargo alias to include also rome_js_formatter, which will be deployed once the PR is merged.

I also moved the codegen of the configuration in another command called cargo codegen configuration. Having it in a separate command fixed an issue on CI, now some rules that were "missed" locally are now correctly added. I plan to add this command in the CI in another PR, to see if actually fixed the issue.

Test Plan

Check the rendered result

@ematipico ematipico requested review from leops and xunilrj as code owners July 18, 2022 15:56
@ematipico ematipico requested a review from a team July 18, 2022 15:56
@ematipico ematipico temporarily deployed to aws July 18, 2022 15:56 Inactive
@ematipico ematipico force-pushed the feature/rule-version branch from 3519cd8 to 442095f Compare July 18, 2022 15:58
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jul 18, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: a485559
Status: ✅  Deploy successful!
Preview URL: https://ac6f4992.tools-8rn.pages.dev
Branch Preview URL: https://feature-rule-version.tools-8rn.pages.dev

View logs

@ematipico ematipico temporarily deployed to aws July 18, 2022 15:58 Inactive
@github-actions
Copy link

github-actions bot commented Jul 18, 2022

@github-actions
Copy link

Parser conformance results on ubuntu-latest

js/262

Test result main count This PR count Difference
Total 45878 45878 0
Passed 44938 44938 0
Failed 940 940 0
Panics 0 0 0
Coverage 97.95% 97.95% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 39 39 0
Passed 36 36 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.31% 92.31% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 5946 5946 0
Passed 388 388 0
Failed 5558 5558 0
Panics 0 0 0
Coverage 6.53% 6.53% 0.00%

ts/babel

Test result main count This PR count Difference
Total 588 588 0
Passed 519 519 0
Failed 69 69 0
Panics 0 0 0
Coverage 88.27% 88.27% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 16257 16257 0
Passed 12393 12393 0
Failed 3864 3864 0
Panics 0 0 0
Coverage 76.23% 76.23% 0.00%

@ematipico ematipico force-pushed the feature/rule-version branch from 442095f to d34326b Compare July 19, 2022 09:32
@ematipico ematipico temporarily deployed to aws July 19, 2022 09:32 Inactive
@ematipico ematipico requested review from leops and MichaReiser July 19, 2022 09:36
@ematipico ematipico temporarily deployed to aws July 19, 2022 09:46 Inactive
@ematipico ematipico temporarily deployed to aws July 19, 2022 10:20 Inactive
@ematipico ematipico merged commit 3c6d893 into main Jul 19, 2022
@ematipico ematipico deleted the feature/rule-version branch July 19, 2022 10:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载