Skip to content

Commit

Permalink
update codelyzer and related (#279)
Browse files Browse the repository at this point in the history
* update codelyzer and related

* add templates-use-public tslint rule

* add compiler options for unused

forbids unused locals and unused paramters

* revert typescript to 2.0
  • Loading branch information
GaryB432 authored and Foxandxss committed Jan 24, 2017
1 parent 4f25b28 commit 84d25c8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 18 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"angular2-template-loader": "^0.6.0",
"autoprefixer": "^6.3.2",
"awesome-typescript-loader": "^3.0.0-beta.17",
"codelyzer": "1.0.0-beta.3",
"codelyzer": "2.0.0-beta.4",
"copy-webpack-plugin": "^4.0.0",
"css-loader": "^0.26.1",
"extract-text-webpack-plugin": "^2.0.0-beta.4",
Expand Down Expand Up @@ -78,8 +78,8 @@
"shelljs": "^0.7.0",
"style-loader": "^0.13.0",
"ts-helpers": "^1.1.1",
"tslint": "^3.4.0",
"tslint-loader": "^2.1.0",
"tslint": "^4.3.1",
"tslint-loader": "^3.3.0",
"typedoc": "^0.5.1",
"typescript": "2.0.10",
"url-loader": "^0.5.6",
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</nav>
</header>
<main>
<h1>Hello from {{api.title}}!</h1>
<h1>Hello from {{title}}!</h1>

<!-- Images (and assets) are parsed and loaded from within the public directory -->
<img src="/img/angular.png">
Expand Down
3 changes: 2 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import '../style/app.scss';
})
export class AppComponent {
url = 'https://github.com/preboot/angular2-webpack';
title: string;

constructor(private api: ApiService) {
// Do something with api
this.title = this.api.title;
}
}
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noEmitHelpers": true
"noEmitHelpers": true,
"noUnusedLocals": true,
"noUnusedParameters": true

This comment has been minimized.

Copy link
@hazmah0

hazmah0 Jan 25, 2017

How can I suppress errors for the scenario below where I only use state in my guard?
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {

This comment has been minimized.

Copy link
@Foxandxss

Foxandxss Jan 25, 2017

Member

Uhm, that is true, I will need to remove that. Will research.

This comment has been minimized.

Copy link
@GaryB432

GaryB432 Jan 25, 2017

Author Contributor

Looks like prefixing the parameter with an underscore will exempt if from the check

this issue

},
"compileOnSave": false,
"buildOnSave": false,
Expand Down
35 changes: 23 additions & 12 deletions tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"spaces"
],
"label-position": true,
"label-undefined": true,
"max-line-length": [
true,
140
Expand All @@ -39,7 +38,6 @@
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-key": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-eval": true,
Expand All @@ -49,8 +47,6 @@
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-unreachable": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
Expand Down Expand Up @@ -92,11 +88,18 @@
"check-separator",
"check-type"
],

"directive-selector-name": [true, "camelCase"],
"component-selector-name": [true, "kebab-case"],
"directive-selector-type": [true, "attribute"],
"component-selector-type": [true, "element"],
"directive-selector": [
true,
"attribute",
"my",
"camelCase"
],
"component-selector": [
true,
"element",
"my",
"kebab-case"
],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
Expand All @@ -106,8 +109,16 @@
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"directive-selector-prefix": [true, "my"],
"component-selector-prefix": [true, "my"],
"pipe-naming": [true, "camelCase", "my"]
"pipe-naming": [
true,
"camelCase",
"my"
],
"no-attribute-parameter-decorator": true,
"no-forward-ref": true,
"import-destructuring-spacing": true,
"no-access-missing-member": true,
"templates-use-public": true,
"invoke-injectable": true
}
}

0 comments on commit 84d25c8

Please sign in to comment.