Add babel-plugin-syntax-jsx package (#18282)

This commit is contained in:
Marvin Hagemeister
2017-07-21 18:52:37 +02:00
committed by Wesley Wigham
parent cfb448f0ac
commit d7a3309b4e
4 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
import jsx from "babel-plugin-syntax-jsx";
// Example taken from the babel plugin handbook:
// https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#-enabling-syntax-in-plugins
export default function myBabelPlugin() {
return {
visitor: {},
inherits: jsx,
};
}

View File

@@ -0,0 +1,13 @@
// Type definitions for babel-plugin-syntax-jsx 6.18
// Project: https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-jsx
// Definitions by: Marvin Hagemeister <https://github.com/marvinhagemeister>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// NB: This export doesn't match the handbook example, where `jsx` is the default export.
// But it does match the runtime behaviour (at least at the time of this writing). For some reason,
// babel-plugin-syntax-jsx/lib/index.js has this line at the bottom: module.exports = exports["default"];
declare function jsx(): {
manipulateOptions(opts: any, parserOpts: { plugins: string[] }): void;
};
export default jsx;

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"babel-plugin-syntax-jsx-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }