eslint-plugin-angular, available on NPM, should give the possilibility to create rules for the first or second version. And, in fact, it is very easy to do, and it is actually already usable.
We just need to add a new property in the global ESLint
settings object we can define in the configuration file of this tool. For the
eslint-plugin-angular, I have decided to create an…
angular property, that can have two values : 1 (for Angular 1) or 2 (for Angular 2)
Once this value defined, we can have access to this property in our rule. We just need to read the value of the
context object, defined as a parameter of the module, in which the the rule is defined :