Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error message when not providing a value for JSX key (#12983)
* Improve error message when not providing a value for key * Update packages/babel-plugin-transform-react-jsx/src/create-plugin.js Show location of attribute instead of only the path Co-authored-by: Hu谩ng J霉nli脿ng <jlhwung@gmail.com> * Change error message to be less aggressive * Throw error when runtime is "classic" Co-authored-by: Hu谩ng J霉nli脿ng <jlhwung@gmail.com>
- Loading branch information
Showing
5 changed files
with
55 additions
and
17 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
2 changes: 2 additions & 0 deletions
2
...-transform-react-jsx/test/fixtures/react-automatic/should-disallow-valueless-key/input.js
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,2 @@ | ||
|
||
var x = [<div key></div>]; |
3 changes: 3 additions & 0 deletions
3
...nsform-react-jsx/test/fixtures/react-automatic/should-disallow-valueless-key/options.json
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,3 @@ | ||
{ | ||
"throws": "Please provide an explicit key value. Using \"key\" as a shorthand for \"key={true}\" is not allowed." | ||
} |
2 changes: 2 additions & 0 deletions
2
...bel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-valueless-key/input.js
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,2 @@ | ||
|
||
var x = [<div key></div>]; |
3 changes: 3 additions & 0 deletions
3
...plugin-transform-react-jsx/test/fixtures/react/should-disallow-valueless-key/options.json
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,3 @@ | ||
{ | ||
"throws": "Please provide an explicit key value. Using \"key\" as a shorthand for \"key={true}\" is not allowed." | ||
} |