Skip to content

Commit

Permalink
Merge branch 'main' into import/max-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
DonIsaac authored Jun 25, 2024
2 parents 61e20a5 + 2e026e1 commit 2f5711a
Show file tree
Hide file tree
Showing 80 changed files with 4,566 additions and 1,495 deletions.
81 changes: 40 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ oxc_macros = { path = "crates/oxc_macros" }
oxc_linter = { path = "crates/oxc_linter" }
oxc_prettier = { path = "crates/oxc_prettier" }
oxc_tasks_common = { path = "tasks/common" }
oxc_ast_codegen = { path = "tasks/oxc_ast_codegen" }

napi = "2.16.6"
napi-derive = "2.16.5"
Expand Down Expand Up @@ -142,7 +143,7 @@ tower-lsp = "0.20.0"
trybuild = "1.0.96"
unicode-id-start = "1.*" # Relaxed version so the user can decide which unicode version to use.
ureq = { version = "2.9.6", default-features = false }
url = "=2.5.2"
url = "2.5.2"
walkdir = "2.5.0"
indexmap = "2.2.6"
static_assertions = "1.1.0"
Expand All @@ -168,7 +169,7 @@ memchr = "2.7.2"
once_cell = "1.19.0"
ouroboros = "0.18.4"
owo-colors = "4.0.0"
oxc_resolver = "1.8.1"
oxc_resolver = "1.8.2"
petgraph = "0.6.5"
rust-lapper = "1.1.0"
similar = "2.5.0"
Expand All @@ -178,12 +179,13 @@ saphyr = "0.0.1"
base64-simd = "0.8"
cfg-if = "1.0.0"
schemars = "0.8.21"
oxc-browserslist = "1.0.0"
oxc-browserslist = "1.0.1"
prettyplease = "0.2.20"
criterion2 = { version = "0.11.0", default-features = false }
daachorse = { version = "1.0.0" }

[workspace.metadata.cargo-shear]
ignored = ["napi", "oxc_traverse"]
ignored = ["napi", "oxc_traverse", "oxc_ast_codegen", "prettyplease"]

[profile.dev]
# Disabling debug info speeds up local and CI builds,
Expand Down
5 changes: 5 additions & 0 deletions apps/oxlint/fixtures/eslintrc_vitest_replace/eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"vitest/no-disabled-tests": "error"
}
}
3 changes: 3 additions & 0 deletions apps/oxlint/fixtures/eslintrc_vitest_replace/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test.skip('foo', () => {
// ...
})
4 changes: 4 additions & 0 deletions apps/oxlint/src/command/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ pub struct EnablePlugins {
#[bpaf(switch, hide_usage)]
pub jest_plugin: bool,

/// Enable the Vitest plugin and detect test problems
#[bpaf(switch, hide_usage)]
pub vitest_plugin: bool,

/// Enable the JSX-a11y plugin and detect accessibility problems
#[bpaf(switch, hide_usage)]
pub jsx_a11y_plugin: bool,
Expand Down
25 changes: 24 additions & 1 deletion apps/oxlint/src/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl Runner for LintRunner {
.with_import_plugin(enable_plugins.import_plugin)
.with_jsdoc_plugin(enable_plugins.jsdoc_plugin)
.with_jest_plugin(enable_plugins.jest_plugin)
.with_vitest_plugin(enable_plugins.vitest_plugin)
.with_jsx_a11y_plugin(enable_plugins.jsx_a11y_plugin)
.with_nextjs_plugin(enable_plugins.nextjs_plugin)
.with_react_perf_plugin(enable_plugins.react_perf_plugin);
Expand All @@ -112,7 +113,7 @@ impl Runner for LintRunner {
let mut err = String::new();
handler.render_report(&mut err, diagnostic.as_ref()).unwrap();
return CliRunResult::InvalidOptions {
message: "Failed to parse configuration file.\n{err}".to_string(),
message: format!("Failed to parse configuration file.\n{err}"),
};
}
};
Expand Down Expand Up @@ -488,4 +489,26 @@ mod test {
assert!(test_invalid_options(&["--tsconfig", "oxc/tsconfig.json"])
.contains("oxc/tsconfig.json\" does not exist, Please provide a valid tsconfig file."));
}

#[test]
fn test_enable_vitest_plugin() {
let args = &[
"-c",
"fixtures/eslintrc_vitest_replace/eslintrc.json",
"fixtures/eslintrc_vitest_replace/foo.js",
];
let result = test(args);
assert_eq!(result.number_of_files, 1);
assert_eq!(result.number_of_errors, 0);

let args = &[
"--vitest-plugin",
"-c",
"fixtures/eslintrc_vitest_replace/eslintrc.json",
"fixtures/eslintrc_vitest_replace/foo.js",
];
let result = test(args);
assert_eq!(result.number_of_files, 1);
assert_eq!(result.number_of_errors, 1);
}
}
Loading

0 comments on commit 2f5711a

Please sign in to comment.