enable prefer const (#5113)

This commit is contained in:
Henry Zhu
2017-01-14 09:48:52 -05:00
committed by GitHub
parent 982850731e
commit 672adba9a1
177 changed files with 1862 additions and 1863 deletions

View File

@@ -1,12 +1,12 @@
/* eslint max-len: 0 */
export default function ({ types: t }) {
let JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
let visitor = require("babel-helper-builder-react-jsx")({
const visitor = require("babel-helper-builder-react-jsx")({
pre(state) {
let tagName = state.tagName;
let args = state.args;
const tagName = state.tagName;
const args = state.args;
if (t.react.isCompatTag(tagName)) {
args.push(t.stringLiteral(tagName));
} else {
@@ -20,11 +20,11 @@ export default function ({ types: t }) {
});
visitor.Program = function (path, state) {
let { file } = state;
const { file } = state;
let id = state.opts.pragma || "React.createElement";
for (let comment of (file.ast.comments: Array<Object>)) {
let matches = JSX_ANNOTATION_REGEX.exec(comment.value);
for (const comment of (file.ast.comments: Array<Object>)) {
const matches = JSX_ANNOTATION_REGEX.exec(comment.value);
if (matches) {
id = matches[1];
if (id === "React.DOM") {