Skip to content

Commit

Permalink
move from unicorn -> eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
baseballyama committed Dec 29, 2024
1 parent 0cdc22e commit 6cd9420
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 173 deletions.
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ mod eslint {
pub mod no_loss_of_precision;
pub mod no_magic_numbers;
pub mod no_multi_str;
pub mod no_negated_condition;
pub mod no_nested_ternary;
pub mod no_new;
pub mod no_new_func;
Expand Down Expand Up @@ -320,7 +321,6 @@ mod unicorn {
pub mod no_length_as_slice_end;
pub mod no_lonely_if;
pub mod no_magic_array_flat_depth;
pub mod no_negated_condition;
pub mod no_negation_in_equality_check;
pub mod no_nested_ternary;
pub mod no_new_array;
Expand Down Expand Up @@ -587,6 +587,7 @@ oxc_macros::declare_all_lint_rules! {
eslint::no_label_var,
eslint::no_loss_of_precision,
eslint::no_magic_numbers,
eslint::no_negated_condition,
eslint::no_multi_str,
eslint::no_new_func,
eslint::no_new_native_nonconstructor,
Expand Down Expand Up @@ -918,7 +919,6 @@ oxc_macros::declare_all_lint_rules! {
unicorn::no_length_as_slice_end,
unicorn::no_lonely_if,
unicorn::no_magic_array_flat_depth,
unicorn::no_negated_condition,
unicorn::no_negation_in_equality_check,
unicorn::no_nested_ternary,
unicorn::no_new_array,
Expand Down
126 changes: 126 additions & 0 deletions crates/oxc_linter/src/snapshots/eslint_no_negated_condition.snap
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,129 @@ snapshot_kind: text
· ───────
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:4]
1 │ (( !a )) ? b : c
· ──
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:1]
1!(( a )) ? b : c
· ────────
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:4]
1if(!(( a ))) b(); else c();
· ────────
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:7]
1if((( !a ))) b(); else c();
· ──
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:21]
1function a() {return!a ? b : c}
· ──
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:21]
1function a() {return!(( a )) ? b : c}
· ────────
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:1]
1!a ? b : c ? d : e
· ──
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:1]
1!a ? b : (( c ? d : e ))
· ──
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:4]
1if(!a) b(); else c()
· ──
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:4]
1if(!a) {b()} else {c()}
· ──
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:4]
1if(!!a) b(); else c();
· ───
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:2]
1 │ (!!a) ? b() : c();
· ───
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:5]
1if (!a) {;} else {;}
· ──
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:5]
1if (a != b) {;} else {;}
· ──────
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:5]
1if (a !== b) {;} else {;}
· ───────
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:1]
1!a ? b : c
· ──
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:1]
1a != b ? c : d
· ──────
╰────
help: Remove the negation operator and switch the consequent and alternate branches.

eslint(no-negated-condition): Unexpected negated condition.
╭─[no_negated_condition.tsx:1:1]
1a !== b ? c : d
· ───────
╰────
help: Remove the negation operator and switch the consequent and alternate branches.
171 changes: 0 additions & 171 deletions crates/oxc_linter/src/snapshots/unicorn_no_negated_condition.snap

This file was deleted.

0 comments on commit 6cd9420

Please sign in to comment.