Skip to content

Commit

Permalink
up 77
Browse files Browse the repository at this point in the history
  • Loading branch information
ityuany committed Dec 13, 2024
1 parent 0498356 commit 708fddb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"newable",
"nonconstructor",
"oxlint",
"Oxlintrc",
"pathdiff",
"petgraph",
"ropey",
Expand Down
17 changes: 14 additions & 3 deletions crates/check_oxlint/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use std::{fmt::Display, rc::Rc, sync::Arc};

use napi::JsObject;
use napi_derive::napi;
use oxc_diagnostics::Severity;
use oxc_linter::{AllowWarnDeny, FixKind, LintFilter, LinterBuilder, Oxlintrc};
use oxc_semantic::SemanticBuilder;
use serde::Serialize;
use serde_json::json;
use serde_json::{Value, json};

#[napi(object)]
#[derive(Debug, Clone, Serialize)]
Expand All @@ -32,6 +33,12 @@ pub struct CheckOxlintResponse {
pub labels: Vec<CheckOxlintLabelsResponse>,
}

// #[napi(object, js_name = "CheckOxlintArgs")]
// pub struct CheckOxlintArgs {
// pub globals: Option<JsObject>,
// pub rules: Vec<Value>,
// }

impl Display for CheckOxlintResponse {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", serde_json::to_string_pretty(self).unwrap())
Expand Down Expand Up @@ -147,8 +154,12 @@ pub fn check_oxlint(
// "plugins": ["react", "oxc"],
"rules": rules,
"globals":{
"ROOT_REDUCER": "readonly",
"ROOT_ROUTER": "readonly",
"__webpack_public_path__": "readonly",
"ROOT_PATH": "readonly",
"__ROOT_SAGA__":"readonly",
"__ROOT_REDUCER__":"readonly",
"__ROOT_ROUTE__":"readonly",
"__ROOT_REDUX_DEVTOOLS__":"readonly"
}
}))
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shined/source-code-diagnosis",
"version": "0.0.76",
"version": "0.0.77",
"main": "index.js",
"types": "index.d.ts",
"napi": {
Expand Down

0 comments on commit 708fddb

Please sign in to comment.