Skip to content

Commit

Permalink
chore: fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed Jul 9, 2021
1 parent 501363c commit 8437f12
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions packages/autofix/lib/rules/no-unused-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,19 @@ module.exports = ruleComposer.mapReports(
return fixer.insertTextBefore(node, prefix);
}
case "after-used": {
const tokenBefore = sourceCode.getTokenBefore(node)
const tokenAfter = sourceCode.getTokenAfter(node)
const tokenBefore = sourceCode.getTokenBefore(node);
const tokenAfter = sourceCode.getTokenAfter(node);

if (
parent.params.length === 1 &&
!(tokenBefore && tokenBefore.value === '(') &&
!(tokenAfter && tokenAfter.value === ')')
parent.params.length === 1 &&
!(tokenBefore && tokenBefore.value === "(") &&
!(tokenAfter && tokenAfter.value === ")")
) {
return [
fixer.insertTextBefore(node, '('),
fixer.insertTextAfter(node, ')'),
fixer.remove(node)
]
fixer.insertTextBefore(node, "("),
fixer.insertTextAfter(node, ")"),
fixer.remove(node)
];
}

const comma = sourceCode.getTokenBefore(node, commaFilter);
Expand Down
8 changes: 4 additions & 4 deletions packages/autofix/tests/lib/rules/no-unused-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,23 +242,23 @@ ruleTester.run("no-unused-vars", rule, {
output: "const foo = () => {}; foo();",
parserOptions: { ecmaVersion: 2018 },
errors: [
{ type: "Identifier" }
{ type: "Identifier" }
],
options: [{
args: "after-used",
argsIgnorePattern: "^_",
argsIgnorePattern: "^_"
}]
},
{
code: "const foo = a => {}; foo();",
output: "const foo = () => {}; foo();",
parserOptions: { ecmaVersion: 2018 },
errors: [
{ type: "Identifier" }
{ type: "Identifier" }
],
options: [{
args: "after-used",
argsIgnorePattern: "^_",
argsIgnorePattern: "^_"
}]
},
{
Expand Down

0 comments on commit 8437f12

Please sign in to comment.