-
-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(transformer): add diagnostics to react transform (#2974)
- Loading branch information
Showing
4 changed files
with
57 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use oxc_diagnostics::{ | ||
miette::{self, Diagnostic}, | ||
thiserror::Error, | ||
}; | ||
use oxc_span::Span; | ||
|
||
#[derive(Debug, Error, Diagnostic)] | ||
#[error("pragma and pragmaFrag cannot be set when runtime is automatic.")] | ||
#[diagnostic(severity(warning), help("Remove `pragma` and `pragmaFrag` options."))] | ||
pub struct PragmaAndPragmaFragCannotBeSet; | ||
|
||
#[derive(Debug, Error, Diagnostic)] | ||
#[error("importSource cannot be set when runtime is classic.")] | ||
#[diagnostic(severity(warning), help("Remove `importSource` option."))] | ||
pub struct ImportSourceCannotBeSet; | ||
|
||
#[derive(Debug, Error, Diagnostic)] | ||
#[error("Namespace tags are not supported by default. React's JSX doesn't support namespace tags. You can set `throwIfNamespace: false` to bypass this warning.")] | ||
#[diagnostic(severity(warning))] | ||
pub struct NamespaceDoesNotSupport(#[label] pub Span); | ||
|
||
#[derive(Debug, Error, Diagnostic)] | ||
#[error("Please provide an explicit key value. Using \"key\" as a shorthand for \"key={{true}}\" is not allowed.")] | ||
#[diagnostic(severity(warning))] | ||
pub struct ValuelessKey(#[label] pub Span); | ||
|
||
#[derive(Debug, Error, Diagnostic)] | ||
#[error("Spread children are not supported in React.")] | ||
#[diagnostic(severity(warning))] | ||
pub struct SpreadChildrenAreNotSupported(#[label] pub Span); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters