Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jordan Harband <ljharb@gmail.com>
  • Loading branch information
gfmio and ljharb committed Jun 12, 2020
1 parent a639467 commit d2ce572
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/util/pragma.js
Expand Up @@ -16,9 +16,7 @@ function getCreateClassFromContext(context) {
pragma = context.settings.react.createClass;
}
if (!JS_IDENTIFIER_REGEX.test(pragma)) {
throw new Error(
`createClass pragma ${pragma} is not a valid function name`
);
throw new Error(`createClass pragma ${pragma} is not a valid function name`);
}
return pragma;
}
Expand All @@ -39,9 +37,7 @@ function getFromContext(context) {
let pragma = 'React';

const sourceCode = context.getSourceCode();
const pragmaNode = sourceCode
.getAllComments()
.find((node) => JSX_ANNOTATION_REGEX.test(node.value));
const pragmaNode = sourceCode.getAllComments().find((node) => JSX_ANNOTATION_REGEX.test(node.value));

if (pragmaNode) {
const matches = JSX_ANNOTATION_REGEX.exec(pragmaNode.value);
Expand Down

0 comments on commit d2ce572

Please sign in to comment.