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>
This commit is contained in:
hajnalbendeguz
2021-03-16 13:02:08 +01:00
committed by GitHub
parent 6e1e00388b
commit 281acd6448
5 changed files with 55 additions and 17 deletions

View File

@@ -0,0 +1,2 @@
var x = [<div key></div>];

View File

@@ -0,0 +1,3 @@
{
"throws": "Please provide an explicit key value. Using \"key\" as a shorthand for \"key={true}\" is not allowed."
}

View File

@@ -0,0 +1,2 @@
var x = [<div key></div>];

View File

@@ -0,0 +1,3 @@
{
"throws": "Please provide an explicit key value. Using \"key\" as a shorthand for \"key={true}\" is not allowed."
}