Skip to content

Commit 5190241

Browse files
ChristianMurphymarionebl
authored andcommitted
feat(babel-preset-commitlint): add jsx tranform (#163)
JSX transform is needed to enable ink as CLI tool. Plugin and plugin options are recommended by ink as part of the package setup process. <https://github.com/vadimdemedes/ink#getting-started> first step toward #86
1 parent a6e1bab commit 5190241

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

@packages/babel-preset-commitlint/index.js

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const addModuleExports = require('babel-plugin-add-module-exports');
22
const fastAsync = require('fast-async');
3+
const jsx = require('babel-plugin-transform-react-jsx');
34
const istanbul = require('babel-plugin-istanbul').default;
45
const transformRuntime = require('babel-plugin-transform-runtime').default;
56
const env = require('babel-preset-env').default;
@@ -9,6 +10,7 @@ module.exports = preset;
910
function preset() {
1011
const plugins = [
1112
addModuleExports,
13+
[jsx, {pragma: 'h'}],
1214
[fastAsync, {spec: true}],
1315
[transformRuntime, {polyfill: false, regenerator: false}]
1416
];
@@ -21,11 +23,14 @@ function preset() {
2123
},
2224
plugins,
2325
presets: [
24-
[env, {
25-
debug: process.env.DEBUG === 'true',
26-
exclude: ['transform-regenerator', 'transform-async-to-generator'],
27-
targets: {node: '4.8'}
28-
}]
29-
],
26+
[
27+
env,
28+
{
29+
debug: process.env.DEBUG === 'true',
30+
exclude: ['transform-regenerator', 'transform-async-to-generator'],
31+
targets: {node: '4.8'}
32+
}
33+
]
34+
]
3035
};
3136
}

@packages/babel-preset-commitlint/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"dependencies": {
5656
"babel-plugin-add-module-exports": "^0.2.1",
5757
"babel-plugin-istanbul": "^4.1.4",
58+
"babel-plugin-transform-react-jsx": "^6.24.1",
5859
"babel-plugin-transform-runtime": "^6.23.0",
5960
"babel-preset-env": "^1.6.0",
6061
"fast-async": "^6.3.0"

yarn.lock

+20
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,14 @@ babel-helper-builder-binary-assignment-operator-visitor@^6.24.1:
701701
babel-runtime "^6.22.0"
702702
babel-types "^6.24.1"
703703

704+
babel-helper-builder-react-jsx@^6.24.1:
705+
version "6.26.0"
706+
resolved "https://registry.npmjs.org/babel-helper-builder-react-jsx/-/babel-helper-builder-react-jsx-6.26.0.tgz#39ff8313b75c8b65dceff1f31d383e0ff2a408a0"
707+
dependencies:
708+
babel-runtime "^6.26.0"
709+
babel-types "^6.26.0"
710+
esutils "^2.0.2"
711+
704712
babel-helper-call-delegate@^6.24.1:
705713
version "6.24.1"
706714
resolved "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz#ece6aacddc76e41c3461f88bfc575bd0daa2df8d"
@@ -845,6 +853,10 @@ babel-plugin-syntax-exponentiation-operator@^6.8.0:
845853
version "6.13.0"
846854
resolved "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de"
847855

856+
babel-plugin-syntax-jsx@^6.8.0:
857+
version "6.18.0"
858+
resolved "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
859+
848860
babel-plugin-syntax-trailing-function-commas@^6.20.0, babel-plugin-syntax-trailing-function-commas@^6.22.0:
849861
version "6.22.0"
850862
resolved "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3"
@@ -1033,6 +1045,14 @@ babel-plugin-transform-exponentiation-operator@^6.22.0, babel-plugin-transform-e
10331045
babel-plugin-syntax-exponentiation-operator "^6.8.0"
10341046
babel-runtime "^6.22.0"
10351047

1048+
babel-plugin-transform-react-jsx@^6.24.1:
1049+
version "6.24.1"
1050+
resolved "https://registry.npmjs.org/babel-plugin-transform-react-jsx/-/babel-plugin-transform-react-jsx-6.24.1.tgz#840a028e7df460dfc3a2d29f0c0d91f6376e66a3"
1051+
dependencies:
1052+
babel-helper-builder-react-jsx "^6.24.1"
1053+
babel-plugin-syntax-jsx "^6.8.0"
1054+
babel-runtime "^6.22.0"
1055+
10361056
babel-plugin-transform-regenerator@^6.22.0:
10371057
version "6.26.0"
10381058
resolved "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz#e0703696fbde27f0a3efcacf8b4dca2f7b3a8f2f"

0 commit comments

Comments
 (0)