-
Notifications
You must be signed in to change notification settings - Fork 13
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
Allow-listing syntax rules, like is already possible for polyfills #95
Comments
Not at the moment. What do you need this for? |
I just joined a codebase that's a Ruby-React-Angular creature with a custom build. I fell into the trap of adding a regular expression look-behind causing a regression because some of the older browser versions we want to support don't support that feature. Since the browsers we want to support are documented well in the Since I cannot whitelist any rule, I had to circumvent the false positives by using the Does that make sense? Why would you allow to whitelist rules there are polyfills for only? |
In this case I recommend you lint your build output rather than your source code. Linting it with just this plugin and no other rules. I had documented some example usages here but you have brought up a new one I will document: using the plugin to check that the transpiler configuration is adequate for the supported browsers.
Polyfills are compatible with all browsers, so can be used to uplift supported features. Syntax (like in your example) must be transpiled or it'll cause a parsing error in the browser - there is no usefulness I see in being able to list these as exceptions; I envisage that for your purpose you lint the build output. |
Ah. That's an interesting solution I haven't thought of! I think it does come with one trade-off though: The feedback loop for the developers is shorter because they won't see errors lighting up in their IDEs while coding. They will only see them when they light up in the CI/CD checks. Anyway, linting the final build seems the best way to ensure that the shipped code doesn't contain any unsupported features. Who knows what the build system does to the code when it's transpiled? 👍🏼 I think we'll go with a two-gate set-up: First, we use Thanks for sharing your thoughts! |
Is there a way to whitelist any rule i.e., not only the ones there are polyfills for? In my use case, I would like the plugin to enforce according the
browserslist
but whitelist theno-rest-spread-properties
rule:es-compat/packages/eslint-plugin-ecmascript-compat/lib/features/es2018.js
Lines 16 to 22 in ca10780
The text was updated successfully, but these errors were encountered: