Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Apr 13, 2021
1 parent b170403 commit c4079ba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
8 changes: 4 additions & 4 deletions rules/prefer-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function fixRequireCall(node, sourceCode) {
yield fixer.replaceText(openingParenthesisToken, ' ');
const closingParenthesisToken = sourceCode.getLastToken(requireCall);
yield fixer.remove(closingParenthesisToken);
yield* removeParentheses([callee, requireCall, source], fixer, sourceCode);
yield * removeParentheses([callee, requireCall, source], fixer, sourceCode);
};
}

Expand Down Expand Up @@ -124,7 +124,7 @@ function fixRequireCall(node, sourceCode) {
const closingParenthesisToken = sourceCode.getLastToken(requireCall);
yield fixer.remove(closingParenthesisToken);

yield* removeParentheses([callee, requireCall, source], fixer, sourceCode);
yield * removeParentheses([callee, requireCall, source], fixer, sourceCode);

if (id.type === 'Identifier') {
return;
Expand Down Expand Up @@ -180,7 +180,7 @@ function fixDefaultExport(node, sourceCode) {
yield fixer.remove(equalToken);
yield removeSpacesAfter(equalToken, sourceCode, fixer);

yield* removeParentheses([node.parent, node], fixer, sourceCode);
yield * removeParentheses([node.parent, node], fixer, sourceCode);
};
}

Expand All @@ -191,7 +191,7 @@ function fixNamedExport(node, sourceCode) {
const local = assignmentExpression.right.name;
yield fixer.replaceText(assignmentExpression, `export {${local} as ${exported}}`);

yield* removeParentheses(assignmentExpression, fixer, sourceCode);
yield * removeParentheses(assignmentExpression, fixer, sourceCode);
};
}

Expand Down
19 changes: 18 additions & 1 deletion test/run-rules-on-codebase/lint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,24 @@ const eslint = new ESLint({
],
// https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1109#issuecomment-782689255
'unicorn/consistent-destructuring': 'off'
}
},
overrides: [
{
files: [
// ESLint don't support module
'rules/**/*.js',
'index.js',
// `eslint-remote-tester` only support cjs config
'test/smoke/eslint-remote-tester.config.js',
// TODO: Switch to module
'scripts/create-rule.js',
'test/integration/**/*',
],
rules: {
'unicorn/prefer-module': 'off'
}
}
]
}
});

Expand Down

0 comments on commit c4079ba

Please sign in to comment.