Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Jan 24, 2025
1 parent 3fd2e3d commit 6e66a86
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions rules/new-for-builtins.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const MESSAGE_ID_SWITCH_TO_NEW_DATE = 'switch-to-new-date';
const messages = {
enforce: 'Use `new {{name}}()` instead of `{{name}}()`.',
disallow: 'Use `{{name}}()` instead of `new {{name}}()`.',
[MESSAGE_ID_SWITCH_TO_NEW_DATE]: 'Switch to `String(new Date())`.'
[MESSAGE_ID_SWITCH_TO_NEW_DATE]: 'Switch to `String(new Date())`.',
};

function enforceNewExpression({node, path: [name]}, sourceCode) {
Expand All @@ -37,7 +37,6 @@ function enforceNewExpression({node, path: [name]}, sourceCode) {
if (name === 'Date') {
function * fix(fixer) {
yield fixer.replaceText(node, 'String(new Date())');

yield * fixSpaceAroundKeyword(fixer, node, sourceCode);
}

Expand Down

0 comments on commit 6e66a86

Please sign in to comment.