-
Notifications
You must be signed in to change notification settings - Fork 8
Fix browserslist support, added options to disable browserlist feature #4
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
Conversation
…feature New features: - new option to disable browserslist support Fixed: - fix browserslist feature, eg: report lookahead errors even though lookahead is supported Breaking Changes: - changed rule options format
|
@latel instead of adding a new option, can we just check for browserslist config and enable it only if it is present? |
|
|
@latel Ok, makes sense. The reasoning makes sense, the only thing I dislike about the PR is that it will require us to bump the package major version as the config has changed - this is something I would like to avoid. I propose that instead of breaking the config options and having to increment the package major, we allow users to pass an options object - since all other values are string types, we can type guard for The API would then look something like 'no-lookahead-lookbehind-regexp/no-lookahead-lookbehind-regexp': [
'error',
'no-lookbehind',
'no-negative-lookbehind',
+ {browserslist: false}
],The code in our plugin then checks for object shape and browserslist property and sets it to that value. I think this is more DX friendly and can ship as a minor version change so everyone can seamlessly upgrade. Mea culpa on the initial API design... it probably should always have been an object. Let me know if you have any thoughts on this. P.S. if you do not have time to make this change it's totally understandable and I am happy to take over, just let me know, your contributions are much appreciated! |
|
You are right, let's keep options compatible, your suggestions are always welcome |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌🏼, thank you for the contribution. I will publish a new version today!
| import { noLookaheadLookbehindRegexp } from "./noLookaheadLookbehindRegex"; | ||
|
|
||
| // Rule tester for when no browserlist is passed, so lookahead and lookbehind should not be allowed | ||
| // Rule tester for when no browserslist is passed, so lookahead and lookbehind should not be allowed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for also fixing my typos :)
|
I think this PR broke some functionality around negative lookbehind, I also just noticed that we copy the string literal for each node value which is not desirable as it can slowdown the plugin and increase memory usage |
|
Do you have an actual broken case, let me digest it. |
|
Already fixed it, tldr, this was not reporting errors |
|
This breaks the main fix in my PR, here is how to re-produce the case. .eslintrc.js .browserslistrc src/index.js running In fact, iOS 16.3 and above do support regex lookahead expression, |
|
😢 |
|
@latel sorry I was off end of last week. Will look into this and fix it |
|
Ok, understood. I think this worked before because you were escaping the lookahead from being reported entirely, which should be a configurable option. I will look into it and make sure we have a fix asap |
|
ping @latel if you have a moment to review |
New features:
bumping up minor version for a new but compatible option
new option to disable browserslist support(to enforce no usages even though browsers are supported)
Fixed:
Breaking Changes: none