From a3bca7dd6b509df1211d2b56b4a32734bcbbfdb0 Mon Sep 17 00:00:00 2001 From: Mario de Biase Date: Wed, 1 Nov 2017 17:58:51 +0100 Subject: [PATCH] Add linter rules for ionic projects --- package-lock.json | 9 ++++++++ package.json | 1 + src/app/app-redux/app.reducer.ts | 2 +- src/app/app-redux/meta.reducer.ts | 2 +- tslint.json | 35 ++++++++++++++++++++++++------- 5 files changed, 40 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 86be253..9a73e84 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9367,6 +9367,15 @@ } } }, + "tslint-ionic-rules": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/tslint-ionic-rules/-/tslint-ionic-rules-0.0.11.tgz", + "integrity": "sha512-EP4/Vgv0Zl66T8dqZe6LV3g+aWpGCSBxHKfScbiFh3kQKE3cikGEEYCLu1vR5yhjvm5DveWFUobwEFiwlts0hw==", + "dev": true, + "requires": { + "tslint-eslint-rules": "4.1.1" + } + }, "tsutils": { "version": "2.12.1", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.12.1.tgz", diff --git a/package.json b/package.json index 8c2cadd..7101e60 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "ngrx-store-freeze": "^0.2.0", "prettier": "^1.7.4", "tslint": "^5.8.0", + "tslint-ionic-rules": "0.0.11", "typescript": "2.3.4" }, "config": { diff --git a/src/app/app-redux/app.reducer.ts b/src/app/app-redux/app.reducer.ts index 92c62c4..51f0a3a 100644 --- a/src/app/app-redux/app.reducer.ts +++ b/src/app/app-redux/app.reducer.ts @@ -1,4 +1,4 @@ -import { createSelector, createFeatureSelector } from '@ngrx/store' +import { createFeatureSelector, createSelector } from '@ngrx/store' import * as appActions from './app.actions' diff --git a/src/app/app-redux/meta.reducer.ts b/src/app/app-redux/meta.reducer.ts index e34a553..4cb74f7 100644 --- a/src/app/app-redux/meta.reducer.ts +++ b/src/app/app-redux/meta.reducer.ts @@ -1,4 +1,4 @@ -import { ActionReducerMap, ActionReducer, MetaReducer } from '@ngrx/store' +import { ActionReducer, ActionReducerMap, MetaReducer } from '@ngrx/store' import { localStorageSync } from 'ngrx-store-localstorage' import { environment } from '@environments/environment' import { storage } from '../shared/global/global-ref.service' diff --git a/tslint.json b/tslint.json index e7cc07f..18bb961 100644 --- a/tslint.json +++ b/tslint.json @@ -2,6 +2,7 @@ "rulesDirectory": [ "node_modules/codelyzer" ], + "extends": "tslint-ionic-rules", "rules": { "callable-types": true, "class-name": true, @@ -9,10 +10,16 @@ true, "check-space" ], - "curly": [true, "ignore-same-line"], + "curly": [ + true, + "ignore-same-line" + ], "eofline": true, "forin": true, - "import-blacklist": [true, "rxjs"], + "import-blacklist": [ + true, + "rxjs" + ], "import-spacing": true, "indent": [ true, @@ -48,7 +55,10 @@ "no-empty": false, "no-empty-interface": true, "no-eval": true, - "no-inferrable-types": [true, "ignore-params"], + "no-inferrable-types": [ + true, + "ignore-params" + ], "no-shadowed-variable": true, "no-string-literal": false, "no-string-throw": true, @@ -102,9 +112,18 @@ "check-separator", "check-type" ], - - "directive-selector": [true, "attribute", "app", "camelCase"], - "component-selector": [true, "element", "app", "kebab-case"], + "directive-selector": [ + true, + "attribute", + "", + "camelCase" + ], + "component-selector": [ + true, + "element", + "", + "kebab-case" + ], "use-input-property-decorator": true, "use-output-property-decorator": true, "use-host-property-decorator": true, @@ -112,7 +131,9 @@ "no-output-rename": true, "use-life-cycle-interface": true, "use-pipe-transform-interface": true, - "component-class-suffix": [true], + "component-class-suffix": [ + false + ], "directive-class-suffix": true, "no-access-missing-member": true, "templates-use-public": true,