Version: 3.1.8
ESLint: 8.31.0
Node.js: 19.3.0
For the following code:
export const uniqueMappingPaths = (
mappingPaths: RA<MappingPath | undefined>
): RA<MappingPath> =>
Array.from(
new Set(filterArray(mappingPaths).map(mappingPathToString)),
splitJoinedMappingPath
).map((path) => (path.length === 1 && path[0] === '' ? [] : path));
ESLint reports:
ESLint: use mapFn callback of Array.from instead of map() (array-func/from-map)
for the Array.from( line.
The autofix turns the above into:
export const uniqueMappingPaths = (
mappingPaths: RA<MappingPath | undefined>
): RA<MappingPath> =>
Array.from(
new Set(filterArray(mappingPaths).map(mappingPathToString)),
(item, index) => ((path) => (path.length === 1 && path[0] === '' ? [] : path))((splitJoinedMappingPath).call(this, item, index), index)
);
Which is very much undesired (turns code into an unreadable mess, with an IIFE and this.).
Can't speak of possible performance improvements, but not worth the readability sacrifice.
If this is indeed desired behavior, I would just disable the rule. If not, posting it here to notify you of this behavior.
Version: 3.1.8
ESLint: 8.31.0
Node.js: 19.3.0
For the following code:
ESLint reports:
for the
Array.from(line.The autofix turns the above into:
Which is very much undesired (turns code into an unreadable mess, with an
IIFEandthis.).Can't speak of possible performance improvements, but not worth the readability sacrifice.
If this is indeed desired behavior, I would just disable the rule. If not, posting it here to notify you of this behavior.