Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions crates/oxc_linter/src/rules/eslint/no_cond_assign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ declare_oxc_lint!(

impl Rule for NoCondAssign {
fn from_configuration(value: serde_json::Value) -> Result<Self, serde_json::error::Error> {
Ok(serde_json::from_value::<DefaultRuleConfig<Self>>(value)
.unwrap_or_default()
.into_inner())
serde_json::from_value::<DefaultRuleConfig<Self>>(value).map(DefaultRuleConfig::into_inner)
}

fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
Expand Down
4 changes: 1 addition & 3 deletions crates/oxc_linter/src/rules/eslint/unicode_bom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ declare_oxc_lint!(

impl Rule for UnicodeBom {
fn from_configuration(value: serde_json::Value) -> Result<Self, serde_json::error::Error> {
Ok(serde_json::from_value::<DefaultRuleConfig<Self>>(value)
.unwrap_or_default()
.into_inner())
serde_json::from_value::<DefaultRuleConfig<Self>>(value).map(DefaultRuleConfig::into_inner)
}

fn run_once(&self, ctx: &LintContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ declare_oxc_lint!(

impl Rule for ConsistentTypeSpecifierStyle {
fn from_configuration(value: Value) -> Result<Self, serde_json::error::Error> {
Ok(serde_json::from_value::<DefaultRuleConfig<Self>>(value)
.unwrap_or_default()
.into_inner())
serde_json::from_value::<DefaultRuleConfig<Self>>(value).map(DefaultRuleConfig::into_inner)
}

fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
Expand Down
4 changes: 1 addition & 3 deletions crates/oxc_linter/src/rules/react/prefer_es6_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ declare_oxc_lint!(

impl Rule for PreferEs6Class {
fn from_configuration(value: serde_json::Value) -> Result<Self, serde_json::error::Error> {
Ok(serde_json::from_value::<DefaultRuleConfig<Self>>(value)
.unwrap_or_default()
.into_inner())
serde_json::from_value::<DefaultRuleConfig<Self>>(value).map(DefaultRuleConfig::into_inner)
}

fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
Expand Down
4 changes: 1 addition & 3 deletions crates/oxc_linter/src/rules/react/state_in_constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ declare_oxc_lint!(

impl Rule for StateInConstructor {
fn from_configuration(value: serde_json::Value) -> Result<Self, serde_json::error::Error> {
Ok(serde_json::from_value::<DefaultRuleConfig<Self>>(value)
.unwrap_or_default()
.into_inner())
serde_json::from_value::<DefaultRuleConfig<Self>>(value).map(DefaultRuleConfig::into_inner)
}

fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ declare_oxc_lint!(

impl Rule for ConsistentIndexedObjectStyle {
fn from_configuration(value: serde_json::Value) -> Result<Self, serde_json::error::Error> {
Ok(serde_json::from_value::<DefaultRuleConfig<Self>>(value)
.unwrap_or_default()
.into_inner())
serde_json::from_value::<DefaultRuleConfig<Self>>(value).map(DefaultRuleConfig::into_inner)
}

fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ declare_oxc_lint!(

impl Rule for ConsistentTypeDefinitions {
fn from_configuration(value: serde_json::Value) -> Result<Self, serde_json::error::Error> {
Ok(serde_json::from_value::<DefaultRuleConfig<Self>>(value)
.unwrap_or_default()
.into_inner())
serde_json::from_value::<DefaultRuleConfig<Self>>(value).map(DefaultRuleConfig::into_inner)
}

fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
Expand Down
4 changes: 1 addition & 3 deletions crates/oxc_linter/src/rules/typescript/return_await.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ declare_oxc_lint!(

impl Rule for ReturnAwait {
fn from_configuration(value: serde_json::Value) -> Result<Self, serde_json::error::Error> {
Ok(serde_json::from_value::<DefaultRuleConfig<Self>>(value)
.unwrap_or_default()
.into_inner())
serde_json::from_value::<DefaultRuleConfig<Self>>(value).map(DefaultRuleConfig::into_inner)
}

fn to_configuration(&self) -> Option<Result<serde_json::Value, serde_json::Error>> {
Expand Down
4 changes: 1 addition & 3 deletions crates/oxc_linter/src/rules/unicorn/switch_case_braces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ declare_oxc_lint!(

impl Rule for SwitchCaseBraces {
fn from_configuration(value: serde_json::Value) -> Result<Self, serde_json::error::Error> {
Ok(serde_json::from_value::<DefaultRuleConfig<Self>>(value)
.unwrap_or_default()
.into_inner())
serde_json::from_value::<DefaultRuleConfig<Self>>(value).map(DefaultRuleConfig::into_inner)
}

fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ declare_oxc_lint!(

impl Rule for DefineEmitsDeclaration {
fn from_configuration(value: serde_json::Value) -> Result<Self, serde_json::error::Error> {
Ok(serde_json::from_value::<DefaultRuleConfig<Self>>(value)
.unwrap_or_default()
.into_inner())
serde_json::from_value::<DefaultRuleConfig<Self>>(value).map(DefaultRuleConfig::into_inner)
}

fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ declare_oxc_lint!(

impl Rule for DefinePropsDeclaration {
fn from_configuration(value: serde_json::Value) -> Result<Self, serde_json::error::Error> {
Ok(serde_json::from_value::<DefaultRuleConfig<Self>>(value)
.unwrap_or_default()
.into_inner())
serde_json::from_value::<DefaultRuleConfig<Self>>(value).map(DefaultRuleConfig::into_inner)
}

fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
Expand Down
Loading