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
Leverage eslint-plugin-compat with this.project.targets
#158
Comments
I'm generally in favor, but I think the extent of things here would be to update the default We should experiment with the config required, but I suspect something like this should suffice: const targets = require('config/targets');
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 6,
sourceType: 'module'
},
extends: 'eslint:recommended',
env: {
browser: true
},
plugins: ['compat'],
rules: {
'compat/compat': [2, targets.browsers]
}
}; Can someone test / confirm this? |
I'll try to teste it once the first ember-cli 2.13-beta with support for targets goes out |
The beauty of this is that all you have to have is a |
We should confirm the above works properly now... |
in my case I got such error:
though if I omitted targets.browsers, e.g.: |
Ditto on the above. Getting this error with latest ember-cli, eslint, etc. |
Actually I guess it's slightly different:
|
Couldn't get Working config: const targets = require('./config/targets');
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 6,
sourceType: 'module'
},
extends: 'eslint:recommended',
env: {
browser: true
},
settings: {
targets: targets.browsers
},
plugins: ['compat'],
rules: {
'compat/compat': 2
}
}; Tested with:
|
Passing targets through settings: {..} also worked for me. |
Actually eslint-plugin-compat does not currently support everything, for example Object.assign will pass through without a notice. So use with caution. |
Some context: https://github.com/amilajack/eslint-plugin-compat
This eslint plugin is gaining popularity. The idea is to customize the rules based on the target browsers, warning when the user attempts to use a feature that is not present across the board for the entire support matrix, unless it has been polyfilled.
Examples of those include:
This issue intends to be a placeholder to discuss wether we want to bake this into this plugin or develop it as a separate addon, and track its implementation if needed.
The text was updated successfully, but these errors were encountered: