Skip to content

Commit d3604f9

Browse files
committed
chore(rulegen): add new-vue-rule just command (#12543)
1 parent 1a710e3 commit d3604f9

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ new-vitest-rule name:
206206
new-regexp-rule name:
207207
cargo run -p rulegen {{name}} regexp
208208

209+
new-vue-rule name:
210+
cargo run -p rulegen {{name}} vue
211+
209212
[unix]
210213
clone-submodule dir url sha:
211214
cd {{dir}} || git init {{dir}}

tasks/rulegen/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ const VITEST_TEST_PATH: &str =
6161

6262
const REGEXP_TEST_PATH: &str = "https://raw.githubusercontent.com/ota-meshi/eslint-plugin-regexp/refs/heads/master/tests/lib/rules";
6363

64+
const VUE_TEST_PATH: &str =
65+
"https://raw.githubusercontent.com/vuejs/eslint-plugin-vue/master/tests/lib/rules/";
66+
6467
struct TestCase {
6568
source_text: String,
6669
code: Option<String>,
@@ -600,6 +603,7 @@ pub enum RuleKind {
600603
Promise,
601604
Vitest,
602605
Regexp,
606+
Vue,
603607
}
604608

605609
impl RuleKind {
@@ -619,6 +623,7 @@ impl RuleKind {
619623
"promise" => Self::Promise,
620624
"vitest" => Self::Vitest,
621625
"regexp" => Self::Regexp,
626+
"vue" => Self::Vue,
622627
_ => Self::ESLint,
623628
}
624629
}
@@ -642,6 +647,7 @@ impl Display for RuleKind {
642647
Self::Promise => "eslint-plugin-promise",
643648
Self::Vitest => "eslint-plugin-vitest",
644649
Self::Regexp => "eslint-plugin-regexp",
650+
Self::Vue => "eslint-plugin-vue",
645651
};
646652
f.write_str(kind_name)
647653
}
@@ -671,6 +677,7 @@ fn main() {
671677
RuleKind::Promise => format!("{PROMISE_TEST_PATH}/{kebab_rule_name}.js"),
672678
RuleKind::Vitest => format!("{VITEST_TEST_PATH}/{kebab_rule_name}.test.ts"),
673679
RuleKind::Regexp => format!("{REGEXP_TEST_PATH}/{kebab_rule_name}.ts"),
680+
RuleKind::Vue => format!("{VUE_TEST_PATH}/{kebab_rule_name}.js"),
674681
RuleKind::Oxc => String::new(),
675682
};
676683
let language = match rule_kind {
@@ -794,6 +801,7 @@ fn get_mod_name(rule_kind: RuleKind) -> String {
794801
RuleKind::Vitest => "vitest".into(),
795802
RuleKind::Node => "node".into(),
796803
RuleKind::Regexp => "regexp".into(),
804+
RuleKind::Vue => "vue".into(),
797805
}
798806
}
799807

tasks/rulegen/src/template.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ impl<'a> Template<'a> {
4545
RuleKind::Promise => Path::new("crates/oxc_linter/src/rules/promise"),
4646
RuleKind::Vitest => Path::new("crates/oxc_linter/src/rules/vitest"),
4747
RuleKind::Regexp => Path::new("crates/oxc_linter/src/rules/regexp"),
48+
RuleKind::Vue => Path::new("crates/oxc_linter/src/rules/vue"),
4849
};
4950

5051
std::fs::create_dir_all(path)?;

0 commit comments

Comments
 (0)