New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A case for prefer-flat-map
#311
Comments
Good idea! |
should we consider |
@fisker Consider it how? Can you elaborate? |
this demo seems not working on my chrome, but works on firefox check this https://jsbin.com/farogop/edit?js,console though this maybe not very common case, |
@fisker I'm comfortable using |
@fisker That's too much of an obscure use-case to handle. |
Imaging this [].concat(...someArray.map(fn)) When you wrote and tested, It works as expected, you may not think about adding If a linter can't be safe, what's the point of using it. I insist not to fix this code, at least an option, people should know this may cause problems |
@fisker This seems very unlikely, but sure, we can omit fixing this case.
Then you should probably not use JavaScript. Most lint rules are not 100% safe. That is just impossible for such a loose language as JS. |
@issuehunt has funded $40.00 to this issue.
|
@sindresorhus has rewarded $36.00 to @MrHen. See it on IssueHunt
|
I think it will be way greater rule if it will be able to identify legacy (before
.flat
got supported) code and suggest to refactor toflatMap
. I believe one of the most common scenario was use of[].concat
with array spread:IssueHunt Summary
[
<
i
m
g
s
r
c
'
h
t
t
p
s
:
/
/
a
v
a
t
a
r
s
1
.
g
i
t
h
u
b
u
s
e
r
c
o
n
t
e
n
t
.
c
o
m
/
u
/
7
4
2
6
0
?
v
4
'
a
l
t
'
m
r
h
e
n
'
w
i
d
t
h
2
4
h
e
i
g
h
t
2
4
m
r
h
e
n
]
(
h
t
t
p
s
:
/
/
i
s
s
u
e
h
u
n
t
.
i
o
/
u
/
m
r
h
e
n
)
h
a
s
b
e
e
n
r
e
w
a
r
d
e
d
.
Backers (Total: $40.00)
Submitted pull Requests
Tips
IssueHunt has been backed by the following sponsors. Become a sponsor
The text was updated successfully, but these errors were encountered: