-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Dont work with Array.prototype.at #539
Comments
Is this still not working in the latest version (4.1.4)? I think I've fixed it there. If not still working, can you provide a small reproduction case that we can take a look at? |
Hmm, I guess this is a little tricky because I guess ESLint doesn't know the types of variables? const thing = [4, 5, 6]
const a = thing.at(2) // no error
const b = [4, 5, 6].at(2) // correct error https://github.com/MetRonnie/eslint-plugin-compat-demo/tree/issue-539 |
Right! So I think that ESLint doesn't have the type information of the variable using the default parser (using the TypeScript parser we might be able to do that) so as it stands now we can't know that the Am I getting that right @amilajack? |
FYI, This is still not working, just tested it with the following code:
findLastIndex() is only supported in Chrome 97+, but in my browserlist I have chrome >= 80. Compat doesn't flag this. |
Do you have any suggestions to make it work when I use js? |
i have the same problem, do you solve it now? |
I took a stab at implementing I would appreciate if people in this thread would give it a go and file issues if there's something wrong with it. Check out the repo: https://github.com/koddsson/eslint-plugin-tscompat |
@koddsson will this be ported to this repository, or is it a standalone alternative solution? |
I have Next.js (13) project, in code i use
['some', 'arrays'].at(-1)
and dont has error from this plugin.Array.prototype.at
supports in Safari 15.4: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/atbut i have correct
.browserlistrc
withnot safari < 12
:Project fixed when i add
import 'core-js/features/array/at'
inpages/_app.tsx
.Plugin added correctly, and have setting in
.eslintrc.json
:Added because Next add some (3) polyfills underhood.
The text was updated successfully, but these errors were encountered: