Skip to content

Commit a8675f4

Browse files
feat(linter): add eslint/class-methods-use-this rule (#12977)
Adds the [`class-methods-use-this`](https://eslint.org/docs/latest/rules/class-methods-use-this) rule. Added a bunch of tests from the eslint repo and the typescript eslint repo, without the ones that rely on particular option configurations. Works towards #479 --------- Co-authored-by: Cameron Clark <cameron.clark@hey.com>
1 parent ca4a081 commit a8675f4

File tree

4 files changed

+1079
-0
lines changed

4 files changed

+1079
-0
lines changed

crates/oxc_linter/src/generated/rule_runner_impls.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ impl RuleRunner for crate::rules::eslint::block_scoped_var::BlockScopedVar {
2222
Some(&AstTypesBitset::from_types(&[AstType::VariableDeclaration]));
2323
}
2424

25+
impl RuleRunner for crate::rules::eslint::class_methods_use_this::ClassMethodsUseThis {
26+
const NODE_TYPES: Option<&AstTypesBitset> = None;
27+
}
28+
2529
impl RuleRunner for crate::rules::eslint::curly::Curly {
2630
const NODE_TYPES: Option<&AstTypesBitset> = None;
2731
}

crates/oxc_linter/src/rules.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub(crate) mod eslint {
4242
pub mod array_callback_return;
4343
pub mod arrow_body_style;
4444
pub mod block_scoped_var;
45+
pub mod class_methods_use_this;
4546
pub mod curly;
4647
pub mod default_case;
4748
pub mod default_case_last;
@@ -636,6 +637,7 @@ oxc_macros::declare_all_lint_rules! {
636637
eslint::array_callback_return,
637638
eslint::arrow_body_style,
638639
eslint::block_scoped_var,
640+
eslint::class_methods_use_this,
639641
eslint::curly,
640642
eslint::default_case,
641643
eslint::default_case_last,

0 commit comments

Comments
 (0)