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
26 changes: 4 additions & 22 deletions crates/oxc_formatter/src/service/oxfmtrc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use serde::{Deserialize, Deserializer, Serialize};
use crate::{
ArrowParentheses, AttributePosition, BracketSameLine, BracketSpacing,
EmbeddedLanguageFormatting, Expand, FormatOptions, IndentStyle, IndentWidth, LineEnding,
LineWidth, OperatorPosition, QuoteProperties, QuoteStyle, Semicolons, SortImports, SortOrder,
TrailingCommas,
LineWidth, QuoteProperties, QuoteStyle, Semicolons, SortImports, SortOrder, TrailingCommas,
};

/// Configuration options for the formatter.
Expand Down Expand Up @@ -59,12 +58,7 @@ pub struct Oxfmtrc {
/// Put each attribute on a new line in JSX. (Default: false)
#[serde(skip_serializing_if = "Option::is_none")]
pub single_attribute_per_line: Option<bool>,
/// Experimental: Position of operators in expressions. (Default: "end")
#[serde(skip_serializing_if = "Option::is_none")]
pub experimental_operator_position: Option<OperatorPositionConfig>,
// TODO: Experimental: Use curious ternaries which move `?` after the condition. (Default: false)
// #[serde(skip_serializing_if = "Option::is_none")]
// pub experimental_ternaries: Option<bool>,

/// Control whether formats quoted code embedded in the file. (Default: "auto")
#[serde(skip_serializing_if = "Option::is_none")]
pub embedded_language_formatting: Option<EmbeddedLanguageFormattingConfig>,
Expand Down Expand Up @@ -123,14 +117,6 @@ pub enum ObjectWrapConfig {
Always,
}

#[derive(Debug, Clone, Copy, Default, Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "lowercase")]
pub enum OperatorPositionConfig {
Start,
#[default]
End,
}

#[derive(Debug, Clone, Copy, Default, Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "lowercase")]
pub enum EmbeddedLanguageFormattingConfig {
Expand Down Expand Up @@ -351,13 +337,9 @@ impl Oxfmtrc {
};
}

// Not yet supported options:
// [Prettier] experimentalOperatorPosition: "start" | "end"
if let Some(position) = self.experimental_operator_position {
options.experimental_operator_position = match position {
OperatorPositionConfig::Start => OperatorPosition::Start,
OperatorPositionConfig::End => OperatorPosition::End,
};
}
// [Prettier] experimentalTernaries: boolean

if let Some(embedded_language_formatting) = self.embedded_language_formatting {
options.embedded_language_formatting = match embedded_language_formatting {
Expand Down
18 changes: 0 additions & 18 deletions crates/oxc_formatter/tests/snapshots/schema_json.snap
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,6 @@ expression: json
}
]
},
"experimentalOperatorPosition": {
"description": "Experimental: Position of operators in expressions. (Default: \"end\")",
"anyOf": [
{
"$ref": "#/definitions/OperatorPositionConfig"
},
{
"type": "null"
}
]
},
"experimentalSortImports": {
"description": "Experimental: Sort import statements. Disabled by default.",
"anyOf": [
Expand Down Expand Up @@ -207,13 +196,6 @@ expression: json
"always"
]
},
"OperatorPositionConfig": {
"type": "string",
"enum": [
"start",
"end"
]
},
"QuotePropsConfig": {
"type": "string",
"enum": [
Expand Down
18 changes: 0 additions & 18 deletions npm/oxfmt/configuration_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,6 @@
}
]
},
"experimentalOperatorPosition": {
"description": "Experimental: Position of operators in expressions. (Default: \"end\")",
"anyOf": [
{
"$ref": "#/definitions/OperatorPositionConfig"
},
{
"type": "null"
}
]
},
"experimentalSortImports": {
"description": "Experimental: Sort import statements. Disabled by default.",
"anyOf": [
Expand Down Expand Up @@ -203,13 +192,6 @@
"always"
]
},
"OperatorPositionConfig": {
"type": "string",
"enum": [
"start",
"end"
]
},
"QuotePropsConfig": {
"type": "string",
"enum": [
Expand Down
Loading