Skip to content

Commit

Permalink
Fix message
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed May 9, 2024
1 parent f82fcdd commit 5d4a63a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions rules/consistent-empty-array-spread.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const {getStaticValue} = require('@eslint-community/eslint-utils');

const MESSAGE_ID = 'consistent-empty-array-spread';
const messages = {
[MESSAGE_ID]: 'Prefer using empty {{replacementDescription}} since the {{anotherNodePosition}} is {{problemNodeDescription}}.',
[MESSAGE_ID]: 'Prefer using empty {{replacementDescription}} since the {{anotherNodePosition}} is {{anotherNodeDescription}}.',
};

const isEmptyArrayExpression = node =>
Expand Down Expand Up @@ -32,14 +32,14 @@ const cases = [
{
oneSidePredicate: isEmptyStringLiteral,
anotherSidePredicate: isArray,
problemNodeDescription: 'a string',
anotherNodeDescription: 'an array',
replacementDescription: 'array',
replacementCode: '[]',
},
{
oneSidePredicate: isEmptyArrayExpression,
anotherSidePredicate: isString,
problemNodeDescription: 'an array',
anotherNodeDescription: 'a string',
replacementDescription: 'string',
replacementCode: '\'\'',
},
Expand All @@ -48,7 +48,7 @@ const cases = [
function createProblem({
problemNode,
anotherNodePosition,
problemNodeDescription,
anotherNodeDescription,
replacementDescription,
replacementCode,
}) {
Expand All @@ -58,7 +58,7 @@ function createProblem({
data: {
replacementDescription,
anotherNodePosition,
problemNodeDescription,
anotherNodeDescription,
},
fix: fixer => fixer.replaceText(problemNode, replacementCode),
};
Expand Down
18 changes: 9 additions & 9 deletions test/snapshots/consistent-empty-array-spread.mjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Generated by [AVA](https://avajs.dev).
`␊
1 | [␊
> 2 | ...(test ? [] : "ab"),␊
| ^^ Prefer using empty string since the alternate is an array.␊
| ^^ Prefer using empty string since the alternate is a string.␊
3 | ...(test ? "ab" : []),␊
4 | ];␊
`
Expand All @@ -40,7 +40,7 @@ Generated by [AVA](https://avajs.dev).
1 | [␊
2 | ...(test ? [] : "ab"),␊
> 3 | ...(test ? "ab" : []),␊
| ^^ Prefer using empty string since the consequent is an array.␊
| ^^ Prefer using empty string since the consequent is a string.␊
4 | ];␊
`

Expand Down Expand Up @@ -72,7 +72,7 @@ Generated by [AVA](https://avajs.dev).
1 | const STRING = "ab";␊
2 | [␊
> 3 | ...(test ? [] : STRING),␊
| ^^ Prefer using empty string since the alternate is an array.␊
| ^^ Prefer using empty string since the alternate is a string.␊
4 | ...(test ? STRING : []),␊
5 | ];␊
`
Expand All @@ -84,7 +84,7 @@ Generated by [AVA](https://avajs.dev).
2 | [␊
3 | ...(test ? [] : STRING),␊
> 4 | ...(test ? STRING : []),␊
| ^^ Prefer using empty string since the consequent is an array.␊
| ^^ Prefer using empty string since the consequent is a string.␊
5 | ];␊
`

Expand Down Expand Up @@ -113,7 +113,7 @@ Generated by [AVA](https://avajs.dev).
`␊
1 | [␊
> 2 | ...(test ? "" : [a, b]),␊
| ^^ Prefer using empty array since the alternate is a string.␊
| ^^ Prefer using empty array since the alternate is an array.␊
3 | ...(test ? [a, b] : ""),␊
4 | ];␊
`
Expand All @@ -124,7 +124,7 @@ Generated by [AVA](https://avajs.dev).
1 | [␊
2 | ...(test ? "" : [a, b]),␊
> 3 | ...(test ? [a, b] : ""),␊
| ^^ Prefer using empty array since the consequent is a string.␊
| ^^ Prefer using empty array since the consequent is an array.␊
4 | ];␊
`

Expand Down Expand Up @@ -163,7 +163,7 @@ Generated by [AVA](https://avajs.dev).
2 | [␊
3 | /* hole */,␊
> 4 | ...(test ? "" : ARRAY),␊
| ^^ Prefer using empty array since the alternate is a string.␊
| ^^ Prefer using empty array since the alternate is an array.␊
5 | /* hole */,␊
6 | ...(test ? ARRAY : ""),␊
7 | /* hole */,␊
Expand All @@ -179,7 +179,7 @@ Generated by [AVA](https://avajs.dev).
4 | ...(test ? "" : ARRAY),␊
5 | /* hole */,␊
> 6 | ...(test ? ARRAY : ""),␊
| ^^ Prefer using empty array since the consequent is a string.␊
| ^^ Prefer using empty array since the consequent is an array.␊
7 | /* hole */,␊
8 | ];␊
`
Expand All @@ -202,5 +202,5 @@ Generated by [AVA](https://avajs.dev).
`␊
> 1 | [...(foo ? "" : [])]␊
| ^^ Prefer using empty array since the alternate is a string.␊
| ^^ Prefer using empty array since the alternate is an array.␊
`
Binary file modified test/snapshots/consistent-empty-array-spread.mjs.snap
Binary file not shown.

0 comments on commit 5d4a63a

Please sign in to comment.