Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d7eb4ef

Browse files
committed
JS: test case for transform-react-jsx plugin
1 parent fa55e31 commit d7eb4ef

4 files changed

Lines changed: 15 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"plugins": [
3+
["transform-react-jsx", { "pragma": "h" }]
4+
]
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { h } from 'preact'; // OK - JSX element uses 'h' after babel compilation
2+
import { q } from 'preact'; // NOT OK - not used
3+
4+
export default (<div>Hello</div>);

javascript/ql/test/query-tests/Declarations/UnusedVariable/UnusedVariable.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
| Babelrc/importPragma.jsx:1:1:1:27 | import ... react'; | Unused import h. |
2+
| Babelrc/importPragma.jsx:2:1:2:27 | import ... react'; | Unused import q. |
13
| decorated.ts:1:1:1:126 | import ... where'; | Unused import actionHandler. |
24
| decorated.ts:4:10:4:12 | fun | Unused function fun. |
35
| externs.js:6:5:6:13 | iAmUnused | Unused variable iAmUnused. |
6+
| importWithoutPragma.jsx:1:1:1:27 | import ... react'; | Unused import h. |
47
| multi-imports.js:1:1:1:29 | import ... om 'x'; | Unused imports a, b, d. |
58
| multi-imports.js:2:1:2:42 | import ... om 'x'; | Unused imports alphabetically, ordered. |
69
| typeoftype.ts:9:7:9:7 | y | Unused variable y. |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { h } from 'preact'; // NOT OK - not in scope of .babelrc file
2+
3+
export default (<div>Hello</div>);

0 commit comments

Comments
 (0)