Skip to content

Commit e39ae89

Browse files
authored
Improve error message for no-new-array (#2459)
1 parent 6a043c2 commit e39ae89

File tree

3 files changed

+68
-68
lines changed

3 files changed

+68
-68
lines changed

rules/no-new-array.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const MESSAGE_ID_LENGTH = 'array-length';
99
const MESSAGE_ID_ONLY_ELEMENT = 'only-element';
1010
const MESSAGE_ID_SPREAD = 'spread';
1111
const messages = {
12-
[MESSAGE_ID_ERROR]: 'Do not use `new Array()`.',
12+
[MESSAGE_ID_ERROR]: '`new Array()` is unclear in intent; use either `[x]` or `Array.from({length: x})`',
1313
[MESSAGE_ID_LENGTH]: 'The argument is the length of array.',
1414
[MESSAGE_ID_ONLY_ELEMENT]: 'The argument is the only element of array.',
1515
[MESSAGE_ID_SPREAD]: 'Spread the argument.',

0 commit comments

Comments
 (0)