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(lint): add JavaScript plugin support #27203

Open
wants to merge 182 commits into
base: main
Choose a base branch
from

Conversation

bartlomieju
Copy link
Member

Nothing to see here yet :))

cli/args/mod.rs Outdated Show resolved Hide resolved
let diagnostic_range = SourceRange::new(start_pos + start, start_pos + end);
if !source_range.contains(&diagnostic_range) {
return Err(LintReportError::DiagnosticIncorrectRange {
// JS uses 1-based indexes
Copy link
Member

@dsherret dsherret Jan 31, 2025

Choose a reason for hiding this comment

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

Why is it 1-based? Can we change this to 0-based?

Copy link
Member Author

Choose a reason for hiding this comment

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

AFAIU we wanted to use 1-based to mimic ESLint API that also uses 1-based offsets

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should just do zero if we're not going for backwards compatibility?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see this is just for the error shown to the user. I misunderstood. Probalby we should show line and column numbers here?

Copy link
Member Author

Choose a reason for hiding this comment

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

How can I show line and column number here if the passed range is not within the SourceRange?

cli/ops/lint.rs Outdated Show resolved Hide resolved
cli/tools/lint/linter.rs Outdated Show resolved Hide resolved
@@ -258,3 +317,87 @@ fn apply_lint_fixes(
deno_ast::apply_text_changes(text_info.text_str(), quick_fixes);
Some(new_text)
}

fn run_plugins(
plugin_runner: Arc<Mutex<PluginHostProxy>>,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should bury this lock instead of passing it around?

cli/tools/lint/linter.rs Outdated Show resolved Hide resolved
cli/tools/lint/linter.rs Outdated Show resolved Hide resolved
runtime/js/99_main.js Outdated Show resolved Hide resolved
let diagnostic_range = SourceRange::new(start_pos + start, start_pos + end);
if !source_range.contains(&diagnostic_range) {
return Err(LintReportError::DiagnosticIncorrectRange {
// JS uses 1-based indexes
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should just do zero if we're not going for backwards compatibility?

cli/tools/lint/plugins.rs Outdated Show resolved Hide resolved
@bartlomieju bartlomieju added this to the 2.2.0 milestone Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants