Skip to content
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

Add browserslist options to the rule options #83

Merged
merged 11 commits into from
Oct 31, 2023

Conversation

lukeapage
Copy link
Contributor

We have a number of browserslist environments and would like some files to be scanned using one environment and some with another.

I can only achieve this by clearing the node cache and re-importing the rule.. Most browserslist tools allow you to pass the environment through.

I added the full API options to the eslint rule options for full flexibility.

I've also added a warning if the browsers list comes back empty - we had missed that when we introduced environments, the tool no longer did anything...

One gotcha with the es2022 test was that the rule tester seems to be async but returns void - so initially it didn't work because the environment variable is changed synchronously which works when re-importing the rule, but not when the testing is done async.. but the new options provide a neater way to test different configurations anyway.

@lukeapage
Copy link
Contributor Author

I've been trying it out - One problem is that the console logs now happen once per file.

I could memoize getting the target rules, but then it still might flip-flop depending on the size of the memoize cache.

any suggestions?

Copy link
Owner

@robatwilliams robatwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. Looks like a sound change, and I think all your/my comments now have a path to being solved.

I'm afraid I've not spent any time maintaining this recently, but happy to review and release stuff.

I've not been using it myself for approaching two years, and I'm cautious about reading much into NPM download stats (mirrors, CI, etc. could account for a lot) for if many people actually use/need it.

README.md Outdated Show resolved Hide resolved
@robatwilliams robatwilliams changed the title Add browserify options to the eslint config Add browserslist options to the rule options Oct 19, 2023
@lukeapage
Copy link
Contributor Author

@robatwilliams I've made the changes now. I resolve the comments, wasn't sure if I should do that or you. Let me know if there is anything else.

@robatwilliams robatwilliams merged commit 65e31fb into robatwilliams:master Oct 31, 2023
4 checks passed
@robatwilliams
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants