Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix: Ignore import expressions in no-unused-expressions rule (#13387)
  • Loading branch information
vkrol committed Jun 5, 2020
1 parent 220349f commit e49732e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/no-unused-expressions.js
Expand Up @@ -124,7 +124,7 @@ module.exports = {
return true;
}

return /^(?:Assignment|Call|New|Update|Yield|Await)Expression$/u.test(node.type) ||
return /^(?:Assignment|Call|New|Update|Yield|Await|Import)Expression$/u.test(node.type) ||
(node.type === "UnaryExpression" && ["delete", "void"].indexOf(node.operator) >= 0);
}

Expand Down
4 changes: 4 additions & 0 deletions tests/lib/rules/no-unused-expressions.js
Expand Up @@ -70,6 +70,10 @@ ruleTester.run("no-unused-expressions", rule, {
code: "shouldNotBeAffectedByAllowTemplateTagsOption()",
options: [{ allowTaggedTemplates: true }],
parserOptions: { ecmaVersion: 6 }
},
{
code: "import(\"foo\")",
parserOptions: { ecmaVersion: 11 }
}
],
invalid: [
Expand Down

0 comments on commit e49732e

Please sign in to comment.