npm install --save-dev --save-exact codelyzer
tslint.json
{
"rules": {
"no-duplicate-variable": true,
"no-unused-variable": [
true
],
// codelyzer
"angular-whitespace": [
true,
"check-interpolation",
"check-pipe",
"check-semicolon"
],
"banana-in-box": true,
"templates-no-negated-async": true,
"directive-selector": [
true,
"attribute",
"sg",
"camelCase"
],
"component-selector": [
true,
"element",
"sg",
"kebab-case"
],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"use-view-encapsulation": true,
"no-attribute-parameter-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"no-forward-ref": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"pipe-naming": [
true,
"camelCase",
"sg"
],
"component-class-suffix": true,
"directive-class-suffix": true,
"templates-use-public": true,
"no-access-missing-member": true,
"invoke-injectable": true,
"template-to-ng-template": true
},
"rulesDirectory": [
"node_modules/tslint-eslint-rules/dist/rules",
"node_modules/codelyzer"
]
}
npm run lint
> ionic-codelyzer@0.0.1 lint C:\VSCode\temp\ionic-codelyzer
> ionic-app-scripts lint
[14:07:21] ionic-app-scripts 2.1.3
[14:07:21] lint started ...
[14:07:23] tslint: C:/VSCode/temp/ionic-codelyzer/src/pages/home/home.ts, line: 5
The selector of the component "HomePage" should have prefix "sg" (https://angular.io/styleguide#style-02-07)
L4: @Component({
L5: selector: 'page-home',
L6: templateUrl: 'home.html'
[14:07:23] tslint: C:/VSCode/temp/ionic-codelyzer/src/pages/home/home.ts, line: 8
The name of the class HomePage should end with the suffix Component
(https://angular.io/styleguide#style-02-03)
L8: export class HomePage {
[14:07:23] tslint: C:/VSCode/temp/ionic-codelyzer/src/app/app.component.ts, line: 10
The name of the class MyApp should end with the suffix Component (https://angular.io/styleguide#style-02-03)
L10: export class MyApp {
L11: rootPage:any = HomePage;
[14:07:23] lint finished in 2.52 s
hth
Tim