Skip to content

Commit

Permalink
Update snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Sep 21, 2022
1 parent 8b6fa6c commit 8c3739b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 38 deletions.
28 changes: 0 additions & 28 deletions rules/prefer-number-properties.js
Expand Up @@ -51,34 +51,6 @@ function checkProperty({node, path: [name]}, sourceCode) {
yield fixer.replaceText(parent, 'Number.NEGATIVE_INFINITY');
yield * fixSpaceAroundKeyword(fixer, parent, sourceCode);
};

if (property === 'NEGATIVE_INFINITY') {
problem.node = parent;
problem.data.description = '-Infinity';
problem.fix = function * (fixer) {
yield fixer.replaceText(parent, 'Number.NEGATIVE_INFINITY');
yield * fixSpaceAroundKeyword(fixer, parent, sourceCode);
};

yield problem;
continue;
}

const fix = fixer => replaceReferenceIdentifier(node, `Number.${property}`, fixer, sourceCode);
const isSafeToFix = globalObjects[name];

if (isSafeToFix) {
problem.fix = fix;
} else {
problem.suggest = [
{
messageId: MESSAGE_ID_SUGGESTION,
fix,
},
];
}

yield problem;
}

const fix = fixer => replaceReferenceIdentifier(node, `Number.${property}`, fixer, sourceCode);
Expand Down
20 changes: 10 additions & 10 deletions test/snapshots/require-post-message-target-origin.mjs.md
Expand Up @@ -18,7 +18,7 @@ Generated by [AVA](https://avajs.dev).
1 | window.postMessage(message, window.location.origin)␊
--------------------------------------------------------------------------------␊
Suggestion 2/2: Use \`"*"\`.␊
Suggestion 2/2: Use \`'*'\`.␊
1 | window.postMessage(message, '*')␊
`

Expand All @@ -36,7 +36,7 @@ Generated by [AVA](https://avajs.dev).
1 | self.postMessage(message, self.location.origin)␊
--------------------------------------------------------------------------------␊
Suggestion 2/2: Use \`"*"\`.␊
Suggestion 2/2: Use \`'*'\`.␊
1 | self.postMessage(message, '*')␊
`

Expand All @@ -54,7 +54,7 @@ Generated by [AVA](https://avajs.dev).
1 | globalThis.postMessage(message, globalThis.location.origin)␊
--------------------------------------------------------------------------------␊
Suggestion 2/2: Use \`"*"\`.␊
Suggestion 2/2: Use \`'*'\`.␊
1 | globalThis.postMessage(message, '*')␊
`

Expand All @@ -76,7 +76,7 @@ Generated by [AVA](https://avajs.dev).
1 | foo.postMessage(message , self.location.origin)␊
--------------------------------------------------------------------------------␊
Suggestion 3/3: Use \`"*"\`.␊
Suggestion 3/3: Use \`'*'\`.␊
1 | foo.postMessage(message , '*')␊
`

Expand All @@ -98,7 +98,7 @@ Generated by [AVA](https://avajs.dev).
1 | foo.postMessage( ((message)) , self.location.origin)␊
--------------------------------------------------------------------------------␊
Suggestion 3/3: Use \`"*"\`.␊
Suggestion 3/3: Use \`'*'\`.␊
1 | foo.postMessage( ((message)) , '*')␊
`

Expand All @@ -120,7 +120,7 @@ Generated by [AVA](https://avajs.dev).
1 | foo.postMessage(message, self.location.origin,)␊
--------------------------------------------------------------------------------␊
Suggestion 3/3: Use \`"*"\`.␊
Suggestion 3/3: Use \`'*'\`.␊
1 | foo.postMessage(message, '*',)␊
`

Expand All @@ -142,7 +142,7 @@ Generated by [AVA](https://avajs.dev).
1 | foo.postMessage(message , self.location.origin,)␊
--------------------------------------------------------------------------------␊
Suggestion 3/3: Use \`"*"\`.␊
Suggestion 3/3: Use \`'*'\`.␊
1 | foo.postMessage(message , '*',)␊
`

Expand All @@ -160,7 +160,7 @@ Generated by [AVA](https://avajs.dev).
1 | foo.window.postMessage(message, self.location.origin)␊
--------------------------------------------------------------------------------␊
Suggestion 2/2: Use \`"*"\`.␊
Suggestion 2/2: Use \`'*'\`.␊
1 | foo.window.postMessage(message, '*')␊
`

Expand All @@ -178,7 +178,7 @@ Generated by [AVA](https://avajs.dev).
1 | document.defaultView.postMessage(message, self.location.origin)␊
--------------------------------------------------------------------------------␊
Suggestion 2/2: Use \`"*"\`.␊
Suggestion 2/2: Use \`'*'\`.␊
1 | document.defaultView.postMessage(message, '*')␊
`

Expand All @@ -196,6 +196,6 @@ Generated by [AVA](https://avajs.dev).
1 | getWindow().postMessage(message, self.location.origin)␊
--------------------------------------------------------------------------------␊
Suggestion 2/2: Use \`"*"\`.␊
Suggestion 2/2: Use \`'*'\`.␊
1 | getWindow().postMessage(message, '*')␊
`
Binary file modified test/snapshots/require-post-message-target-origin.mjs.snap
Binary file not shown.

0 comments on commit 8c3739b

Please sign in to comment.