-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
Array methods not reporting errors #258
Comments
I ran into the same issue today. Any update on this? |
@davidbarredo After thinking about this for some time I think that this is finally a good solution for now. Would love if anyone could work on this |
I think this should be closed in favor of the more generic #206 (letting that apply to all ES features). |
As proof of concept(PoC), I've created eslint-plugin-typescript-compat to resolve this issue. For example, TypeScript Compiler know
This plugin get type information from TypeScript and lint it. 📝 This plugin only works on TypeScript. It requires TypeScript compiler and TypeScript codebase. |
## Description of the change This PR adds eslint configuration for fixing browser compatibility errors. However this doesn't detect array methods such as `toSorted` #53 amilajack/eslint-plugin-compat#258 (comment). I've also tried to add https://github.com/azu/eslint-plugin-typescript-compat for detecting the methods. But no luck. 😩 - Add eslint config for the project - Add `eslint-plugin-compat` for browser compatibilities - Add to `package.json` ``` "browserslist": [ "chrome 64", "edge 79", "firefox 67", "opera 51", "safari 12" ] ``` I've disabled the recommended rules as there quite a lot of error and we can tackle them in another PR. <img width="461" alt="Screenshot 2024-02-28 at 17 09 56" src="https://github.com/saasquatch/bunshi/assets/17547035/9be59f4c-f58b-4552-a868-532f579d3466"> --------- Co-authored-by: Logan Volkers <[email protected]>
The plugin is no reporting errors for array methods such as:
The flat method is not supported in IE (https://caniuse.com/#feat=array-flat), but the plugin is not reporting it as an error.
To test it, just add these lines into
index.js
file inside the demo: https://github.com/amilajack/eslint-plugin-compat-demoI've just saw #168 (comment) and tested
Array.flat();
. Is showing the error.Maybe adding these methods as a warning when not able to check te type is a good enough solution.
The text was updated successfully, but these errors were encountered: