diff --git a/crates/oxc_transformer/src/jsx/diagnostics.rs b/crates/oxc_transformer/src/jsx/diagnostics.rs index cfc896ca8d3ce..b09f5b4f7786d 100644 --- a/crates/oxc_transformer/src/jsx/diagnostics.rs +++ b/crates/oxc_transformer/src/jsx/diagnostics.rs @@ -1,31 +1,37 @@ use oxc_diagnostics::OxcDiagnostic; use oxc_span::Span; +#[cold] pub fn pragma_and_pragma_frag_cannot_be_set() -> OxcDiagnostic { OxcDiagnostic::warn("pragma and pragmaFrag cannot be set when runtime is automatic.") .with_help("Remove `pragma` and `pragmaFrag` options.") } +#[cold] pub fn invalid_pragma() -> OxcDiagnostic { OxcDiagnostic::warn("pragma and pragmaFrag must be of the form `foo` or `foo.bar`.") .with_help("Fix `pragma` and `pragmaFrag` options.") } +#[cold] pub fn import_source_cannot_be_set() -> OxcDiagnostic { OxcDiagnostic::warn("importSource cannot be set when runtime is classic.") .with_help("Remove `importSource` option.") } +#[cold] pub fn invalid_import_source() -> OxcDiagnostic { OxcDiagnostic::warn("importSource cannot be an empty string or longer than u32::MAX bytes") .with_help("Fix `importSource` option.") } +#[cold] pub fn namespace_does_not_support(span: Span) -> OxcDiagnostic { OxcDiagnostic::warn("Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set `throwIfNamespace: false` to bypass this warning.") .with_label(span) } +#[cold] pub fn valueless_key(span: Span) -> OxcDiagnostic { OxcDiagnostic::warn("Please provide an explicit key value. Using \"key\" as a shorthand for \"key={true}\" is not allowed.") .with_label(span) diff --git a/crates/oxc_transformer/src/typescript/diagnostics.rs b/crates/oxc_transformer/src/typescript/diagnostics.rs index 200316a3be929..e1028d10d8f1a 100644 --- a/crates/oxc_transformer/src/typescript/diagnostics.rs +++ b/crates/oxc_transformer/src/typescript/diagnostics.rs @@ -1,6 +1,7 @@ use oxc_diagnostics::OxcDiagnostic; use oxc_span::Span; +#[cold] pub fn import_equals_cannot_be_used_in_esm(span: Span) -> OxcDiagnostic { OxcDiagnostic::warn("Import assignment cannot be used when targeting ECMAScript modules.") .with_help( @@ -11,6 +12,7 @@ pub fn import_equals_cannot_be_used_in_esm(span: Span) -> OxcDiagnostic { .with_error_code("TS", "1202") } +#[cold] pub fn export_assignment_cannot_bed_used_in_esm(span: Span) -> OxcDiagnostic { OxcDiagnostic::warn("Export assignment cannot be used when targeting ECMAScript modules.") .with_help("Consider using 'export default' or another module format instead.") @@ -18,16 +20,19 @@ pub fn export_assignment_cannot_bed_used_in_esm(span: Span) -> OxcDiagnostic { .with_error_code("TS", "1203") } +#[cold] pub fn ambient_module_nested(span: Span) -> OxcDiagnostic { OxcDiagnostic::warn("Ambient modules cannot be nested in other modules or namespaces.") .with_label(span) } +#[cold] pub fn namespace_exporting_non_const(span: Span) -> OxcDiagnostic { OxcDiagnostic::warn("Namespaces exporting non-const are not supported by Babel. Change to const or see: https://babeljs.io/docs/en/babel-plugin-transform-typescript") .with_label(span) } +#[cold] pub fn namespace_not_supported(span: Span) -> OxcDiagnostic { OxcDiagnostic::warn("Namespace not marked type-only declare. Non-declarative namespaces are only supported experimentally in Babel. To enable and review caveats see: https://babeljs.io/docs/en/babel-plugin-transform-typescript") .with_label(span)