New rule: `no-reserved-imports`
According to https://github.com/ember-cli/ember-rfc176-data I think we can add a rule that will check if reserved identifiers like Object are being imported.
Incorrect:
import Object from '@ember/object';
Correct:
import EmberObject from '@ember/object';
All reserved keys are here: https://github.com/ember-cli/ember-rfc176-data/blob/master/reserved.json
cc @Turbo87 ☝️
You can already do this with ESLint with this rule:
'no-shadow': ['error', { 'builtinGlobals': true }]
Oh, true @t-sauer. Then I think we should add this to recommended config.
Then I think we should add this to recommended config.
that would require a breaking change release again and I'm very much against that in the foreseeable future. IMHO we should only do breaking change releases if we actually need to break how a rule behaves, the recommended config should ideally live outside of this repo/project.
@t-sauer the potential advantage of having a custom rule would be that it can be --fix-able, but it's probably not worth it in this case 🤔
I found that there was a similar suggestion made to the Airbnb eslint base and it was not merged, with this as the reasoning: https://github.com/airbnb/javascript/pull/667#issuecomment-169913792
So similarly, I don't think we should be including the builtinGlobals option in our configuration.
I think that having a dedicated fixable rule just for the ember object, string, etc. might be a good idea, I'd personally find it valuable.
Ok, so it looks like indeed having a dedicated rule will be most valuable in this case.
Picking this up then - will probably make a PR around saturday/sunday