Skip to content

Commit

Permalink
[Fix]jsx-indent: don't check literals not within JSX
Browse files Browse the repository at this point in the history
  • Loading branch information
toshi-toma committed Feb 3, 2020
1 parent 37c4ef3 commit 2beff81
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/rules/jsx-indent.js
Expand Up @@ -374,6 +374,9 @@ module.exports = {
if (!node.parent) {
return;
}
if (node.parent.type !== "JSXElement") {
return;
}
const parentNodeIndent = getNodeIndent(node.parent);
checkLiteralNodeIndent(node, parentNodeIndent + indentSize);
}
Expand Down
8 changes: 8 additions & 0 deletions tests/lib/rules/jsx-indent.js
Expand Up @@ -989,6 +989,14 @@ const Component = () => (
'</App>'
].join('\n'),
options: ['tab']
}, {
// don't check literals not within JSX. See #2563
code: [
'function foo() {',
'const a = `aa`;',
'const b = `b\nb`;',
'}'
].join('\n')
}],

invalid: [{
Expand Down

0 comments on commit 2beff81

Please sign in to comment.