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(linter): analyzer plugin #4396

Merged
merged 1 commit into from
Oct 29, 2024
Merged

Conversation

arendjr
Copy link
Contributor

@arendjr arendjr commented Oct 27, 2024

Summary

This is the first iteration of the JS analyzer plugin with Grit. I added the following plugin as a showcase in the tests:

`Object.assign($args)` where {
    register_diagnostic(
        span = $args,
        message = "Prefer object spread instead of `Object.assign()`"
    )
}

There are additional arguments to the register_diagnostic() function as well, but they are intended for the fixer, which is currently unsupported. Before being able to implement fixers, I'll have to get rewriting in GritQL working as well, so that'll take a bunch of some extra effort.

This also required an upgrade to the GritQL engine again, since I had to get built-in functions (like register_diagnostic()) working in predicate position first: getgrit/gritql#557

Test Plan

Test added.

@arendjr arendjr requested review from a team October 27, 2024 10:32
@github-actions github-actions bot added A-Project Area: project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Diagnostic Area: diagnostocis L-Grit Language: GritQL labels Oct 27, 2024
@arendjr arendjr changed the title Analyzer plugin feat(linter): analyzer plugin Oct 27, 2024
@github-actions github-actions bot added the A-Tooling Area: internal tools label Oct 27, 2024
Copy link

codspeed-hq bot commented Oct 27, 2024

CodSpeed Performance Report

Merging #4396 will degrade performances by 7.79%

Comparing arendjr:analyzer-plugin (5a6408b) with next (70542df)

Summary

⚡ 1 improvements
❌ 1 regressions
✅ 97 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark next arendjr:analyzer-plugin Change
pure_9395922602181450299.css[uncached] 4.4 ms 4.1 ms +8.1%
react.production.min_3378072959512366797.js[uncached] 2.1 ms 2.3 ms -7.79%

@@ -11,7 +11,8 @@ impl WithinCompiler {
context: &mut NodeCompilationContext,
) -> Result<Within<GritQueryContext>, CompileError> {
let pattern = PatternCompiler::from_maybe_curly_node(&node.pattern()?, context)?;
let until = None; // TODO: Update syntax.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created a separate PR for this one: #4399

@arendjr arendjr merged commit ef9cd31 into biomejs:next Oct 29, 2024
11 of 12 checks passed
ematipico pushed a commit that referenced this pull request Oct 31, 2024
ematipico pushed a commit that referenced this pull request Nov 7, 2024
ematipico pushed a commit that referenced this pull request Nov 27, 2024
ematipico pushed a commit that referenced this pull request Nov 27, 2024
ematipico pushed a commit that referenced this pull request Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Diagnostic Area: diagnostocis A-Linter Area: linter A-Project Area: project A-Tooling Area: internal tools L-Grit Language: GritQL L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant