Ionic 2 Support
See original GitHub issueI have been using Codelyzer with an Ng2 project and loving it. I have started an Ionic 2 project that uses Codelyzer and it works almost perfectly except for an issue with pages. In Ionic the Component decorator is used for pages but the class name is suffixed with “Page.” For example the file hello-ionic.page.ts would be:
import { Component } from '@angular/core';
@Component({
templateUrl: 'hello-ionic.page.html'
})
export class HelloIonicPage {
constructor() {
}
}
This causes Codelyzer to state that “The name of the class HelloIonicPage should end with the suffix Component”.
Changing componentClassSuffixRule.js line 16 from:
return /.*Component$/.test(className);
to
return (/.*Component$/.test(className) || /.*Page$/.test(className));
Fixes the problem but I figure there is probably a more elegant solution. In Ionic projects there will still be components so is there a way of discerning between a page and component based on location (src/pages/* vs srv/components/*)? Or allowing custom component suffixes in the rules config?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:13 (5 by maintainers)
I think README.md should be updated with an example for using both, the single syntax and the array syntax, or at least mention it. 😃. Do you mind if I do it?
Great! Thanks for all your work on this project