You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use eslint-plugin-compat to check browser compatibility in our projects. However, we recently noticed some compatibility issues in our code related to Babel configurations and core-js.
For us, this happened specifically, when using the feature Object.hasOwn, which isn't supported in Safari < 15.3, we expected eslint-plugin-compat to flag this as an error. However, it seems the plugin checks for the presence of a Babel config and assumes that all possible polyfills for the browsers (defined in the browserslist file) are being used. This assumption can lead to false negatives, especially if there's a mismatch with the core-js version or if specific polyfills aren't explicitly imported.
This happened because we are using Gatsby and in the babel-preset-gatsby, it only use the major version for the corejs option, like corejs: 3 and recommendations from corejs repo says to use the minor version. I have created a PR against Gatsby to address this issue: https://github.com/gatsbyjs/gatsby/pull/38589/files
Potential Solutions
Honestly I'm not sure what could be done to address this in the logic / code - maybe detecting that @babel/preset-env is being used and checking the corejs version being passed in. Or maybe just something adding to the docs
## Description
We use eslint-plugin-compat to check browser compatibility in our projects. However, we recently noticed some compatibility issues in our code related to Babel configurations and core-js.
For us, this happened specifically, when using the feature
Object.hasOwn
, which isn't supported in Safari < 15.3, we expected eslint-plugin-compat to flag this as an error. However, it seems the plugin checks for the presence of a Babel config and assumes that all possible polyfills for the browsers (defined in the browserslist file) are being used. This assumption can lead to false negatives, especially if there's a mismatch with the core-js version or if specific polyfills aren't explicitly imported.This happened because we are using Gatsby and in the
babel-preset-gatsby
, it only use the major version for the corejs option, likecorejs: 3
and recommendations from corejs repo says to use the minor version. I have created a PR against Gatsby to address this issue: https://github.com/gatsbyjs/gatsby/pull/38589/filesPotential Solutions
Honestly I'm not sure what could be done to address this in the logic / code - maybe detecting that
@babel/preset-env
is being used and checking thecorejs
version being passed in. Or maybe just something adding to the docsMinimal Repo
https://github.com/ChrisSargent/eslint-compat-example
The text was updated successfully, but these errors were encountered: