diff options
author | cjihrig <cjihrig@gmail.com> | 2018-10-26 12:35:42 -0400 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-10-29 07:49:16 +0100 |
commit | 2f1c356d7abe4949b5ee68e0724ed7e493fc03e1 (patch) | |
tree | b830b2ba85798b69df5b2750b97e32ce97211bfc /tools/node_modules/eslint/node_modules/acorn-jsx/README.md | |
parent | 9697c0820f015ccf898a3662305a0caa3cd9c208 (diff) | |
download | android-node-v8-2f1c356d7abe4949b5ee68e0724ed7e493fc03e1.tar.gz android-node-v8-2f1c356d7abe4949b5ee68e0724ed7e493fc03e1.tar.bz2 android-node-v8-2f1c356d7abe4949b5ee68e0724ed7e493fc03e1.zip |
tools: update ESLint to 5.8.0
Update ESLint to 5.8.0.
PR-URL: https://github.com/nodejs/node/pull/23904
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'tools/node_modules/eslint/node_modules/acorn-jsx/README.md')
-rw-r--r-- | tools/node_modules/eslint/node_modules/acorn-jsx/README.md | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/tools/node_modules/eslint/node_modules/acorn-jsx/README.md b/tools/node_modules/eslint/node_modules/acorn-jsx/README.md index cd9674c0b3..2bbb1d99fd 100644 --- a/tools/node_modules/eslint/node_modules/acorn-jsx/README.md +++ b/tools/node_modules/eslint/node_modules/acorn-jsx/README.md @@ -17,44 +17,24 @@ Please note that this tool only parses source code to JSX AST, which is useful f ## Usage -You can use module directly in order to get Acorn instance with plugin installed: +Requiring this module provides you with an Acorn plugin that you can use like this: ```javascript -var acorn = require('acorn-jsx'); -``` - -Or you can use `inject.js` for injecting plugin into your own version of Acorn like following: - -```javascript -var acorn = require('acorn-jsx/inject')(require('./custom-acorn')); -``` - -Then, use `plugins` option whenever you need to support JSX while parsing: - -```javascript -var ast = acorn.parse(code, { - plugins: { jsx: true } -}); +var acorn = require("acorn"); +var jsx = require("acorn-jsx"); +acorn.Parser.extend(jsx()).parse("my(<jsx/>, 'code');"); ``` Note that official spec doesn't support mix of XML namespaces and object-style access in tag names (#27) like in `<namespace:Object.Property />`, so it was deprecated in `acorn-jsx@3.0`. If you still want to opt-in to support of such constructions, you can pass the following option: ```javascript -var ast = acorn.parse(code, { - plugins: { - jsx: { allowNamespacedObjects: true } - } -}); +acorn.Parser.extend(jsx({ allowNamespacedObjects: true })) ``` Also, since most apps use pure React transformer, a new option was introduced that allows to prohibit namespaces completely: ```javascript -var ast = acorn.parse(code, { - plugins: { - jsx: { allowNamespaces: false } - } -}); +acorn.Parser.extend(jsx({ allowNamespaces: false })) ``` Note that by default `allowNamespaces` is enabled for spec compliancy. |