Skip to content

Commit

Permalink
chore(code-style): upgrade Prettier related packages and Codelyzer. A…
Browse files Browse the repository at this point in the history
…dd/remove new/conflicting rules.
  • Loading branch information
christophercr committed Apr 23, 2018
1 parent 0850378 commit e5e00ed
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 48 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
"@angular/core": "5.2.10",
"@angular/compiler": "5.2.10",
"@angular/compiler-cli": "5.2.10",
"codelyzer": "4.2.1",
"codelyzer": "4.3.0",
"husky": "0.14.3",
"lint-staged": "7.0.4",
"prettier": "1.10.2",
"prettier": "1.12.1",
"rollup": "0.58.1",
"rollup-plugin-commonjs": "9.1.0",
"rollup-plugin-node-resolve": "3.3.0",
"rollup-plugin-sourcemaps": "0.4.2",
"stylelint": "9.2.0",
"stylelint-config-prettier": "3.0.4",
"stylelint-config-prettier": "3.2.0",
"tslint": "5.9.1",
"tslint-config-prettier": "1.8.0",
"tslint-config-prettier": "1.12.0",
"typescript": "2.6.2",
"uglify-es": "3.3.9"
},
Expand Down
18 changes: 10 additions & 8 deletions packages/stark-build/config/stylelint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ module.exports = {
}
],
"selector-pseudo-element-no-unknown": true,
// FIXME: cannot simply leave this rule commented for now (stylelint-config-prettier v3.2.0) otherwise it is still recognized as conflict
"selector-descendant-combinator-no-non-space": null,
"selector-type-case": [
"lower",
{
Expand All @@ -128,14 +130,6 @@ module.exports = {
message: "Never put spaces inside media feature parentheses to avoid unnecessary whitespace."
}
],
"at-rule-empty-line-before": [
"always",
{
ignore: ["after-comment", "blockless-after-same-name-blockless"],
ignoreAtRules: ["import"],
message: "Always put an empty line before each @ rule, except after a comment or for @import."
}
],
"at-rule-no-unknown": true,
"no-duplicate-at-import-rules": [
true,
Expand Down Expand Up @@ -345,6 +339,14 @@ module.exports = {
"message": "Never put spaces inside media feature parentheses to avoid unnecessary whitespace."
}
],
"at-rule-empty-line-before": [
"always",
{
ignore: ["after-comment", "blockless-after-same-name-blockless"],
ignoreAtRules: ["import"],
message: "Always put an empty line before each @ rule, except after a comment or for @import."
}
],
"at-rule-name-space-after": [
"always",
{
Expand Down
5 changes: 4 additions & 1 deletion packages/stark-build/config/tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"no-output-named-after-standard-event": true,
"max-inline-declarations": true,
// "no-life-cycle-call": true, // FIXME: throws an exception (Codelyzer v4.3.0). Enable this rule when solved
"no-conflicting-life-cycle-hooks": true,
"enforce-component-selector": true,
"component-class-suffix": [true, "Component"],
"directive-class-suffix": [true, "Directive"],

Expand All @@ -30,7 +34,6 @@
"use-view-encapsulation": true,
"trackBy-function": true,
"no-unused-css": true,
"i18n": false,
"template-cyclomatic-complexity": [true, 5],
"template-conditional-complexity": [true, 4],

Expand Down
6 changes: 3 additions & 3 deletions packages/stark-build/config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ module.exports = function(options) {
test: /\.js$/,
use: [buildOptimizerLoader]
}
]
]
: []),

// TsLint loader support for *.ts files
Expand All @@ -192,7 +192,7 @@ module.exports = function(options) {
use: ["source-map-loader"],
exclude: [helpers.root("node_modules/rxjs"), helpers.root("node_modules/@angular")]
}
]
]
: []),

/**
Expand Down Expand Up @@ -472,7 +472,7 @@ module.exports = function(options) {
caseSensitive: true,
collapseWhitespace: true,
keepClosingSlash: true
}
}
: false
}),

Expand Down
8 changes: 4 additions & 4 deletions packages/stark-build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"angular2-template-loader": "0.6.2",
"assets-webpack-plugin": "3.5.1",
"awesome-typescript-loader": "3.5.0",
"codelyzer": "4.2.1",
"codelyzer": "4.3.0",
"copy-webpack-plugin": "4.5.1",
"css-loader": "0.28.11",
"exports-loader": "0.7.0",
Expand All @@ -45,19 +45,19 @@
"postcss-simple-extend": "1.0.0",
"postcss-url": "7.3.2",
"preload-webpack-plugin": "2.3.0",
"prettier": "1.10.2",
"prettier": "1.12.1",
"raw-loader": "0.5.1",
"sass-loader": "7.0.1",
"script-ext-html-webpack-plugin": "2.0.1",
"source-map-loader": "0.2.3",
"string-replace-loader": "2.1.1",
"stylelint": "9.2.0",
"stylelint-config-prettier": "3.0.4",
"stylelint-config-prettier": "3.2.0",
"stylelint-webpack-plugin": "0.10.4",
"style-loader": "0.20.3",
"to-string-loader": "1.1.5",
"tslint": "5.9.1",
"tslint-config-prettier": "1.8.0",
"tslint-config-prettier": "1.12.0",
"tslint-loader": "3.6.0",
"uglifyjs-webpack-plugin": "1.2.5",
"url-loader": "1.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe("Service: StarkLoggingService", () => {
expect((<StarkLogMessage>message).timestamp).toBeDefined();
expect((<StarkLogMessage>message).error).toBeDefined();

const error: StarkError = (<StarkError>(<StarkLogMessage>message).error);
const error: StarkError = <StarkError>(<StarkLogMessage>message).error;
expect(error).toBeDefined(); // so the test will fail in case it is undefined
expect(<string>error.message).toContain("this is the error");
});
Expand All @@ -199,7 +199,7 @@ describe("Service: StarkLoggingService", () => {
expect((<StarkLogMessage>message).timestamp).toBeDefined();
expect((<StarkLogMessage>message).error).toBeDefined();

const error: StarkError = (<StarkError>(<StarkLogMessage>message).error);
const error: StarkError = <StarkError>(<StarkLogMessage>message).error;
expect(error).toBeDefined(); // so the test will fail in case it is undefined
expect(<string>error.name).toBe("STARK_ERROR");
expect(<string>error.timestamp).toBeDefined();
Expand Down Expand Up @@ -251,7 +251,7 @@ describe("Service: StarkLoggingService", () => {
expect(message.timestamp).toBeDefined();
expect(message.error).toBeDefined();

const starkError: StarkError = (<StarkError>(<StarkLogMessage>message).error);
const starkError: StarkError = <StarkError>(<StarkLogMessage>message).error;
expect(error).toBeDefined(); // so the test will fail in case it is undefined
expect(<string>starkError.name).toBe("STARK_ERROR");
expect(<string>starkError.timestamp).toBeDefined();
Expand Down
11 changes: 11 additions & 0 deletions starter/src/app/about/about.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<h1>About</h1>
<div>
For hot module reloading run
<pre>npm run start:hmr</pre>
</div>
<div>
<h3>
https://github.com/NationalBankBelgium/stark
</h3>
</div>
<pre>this.localState = {{ localState | json }}</pre>
19 changes: 2 additions & 17 deletions starter/src/app/about/about.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,8 @@ import { StarkLoggingService, starkLoggingServiceName } from "@nationalbankbelgi

@Component({
selector: "about",
styles: [
`
`
],
template: `
<h1>About</h1>
<div>
For hot module reloading run
<pre>npm run start:hmr</pre>
</div>
<div>
<h3>
https://github.com/NationalBankBelgium/stark
</h3>
</div>
<pre>this.localState = {{ localState | json }}</pre>
`
styles: [``],
templateUrl: "./about.component.html"
})
export class AboutComponent implements OnInit {
@Input() public resolvedData: Observable<any>;
Expand Down
2 changes: 1 addition & 1 deletion starter/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AppState } from "./app.service";
*/
@Component({
selector: "app",
/* tslint:disable */
/* tslint:disable:use-view-encapsulation */
encapsulation: ViewEncapsulation.None,
/* tslint:enable */
styleUrls: ["./app.component.css"],
Expand Down
1 change: 1 addition & 0 deletions starter/src/app/home/x-large/x-large.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe("x-large directive", () => {
* Create a test component to test directives.
*/
@Component({
selector: "test",
template: "<div x-large>Content</div>"
})
class TestComponent {}
Expand Down
8 changes: 3 additions & 5 deletions starter/src/app/no-content/no-content.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import { Component } from "@angular/core";

@Component({
selector: "no-content",
template: `
<div>
<h1>404: page missing</h1>
</div>
`
template: `<div>
<h1>404: page missing</h1>
</div>`
})
export class NoContentComponent {}
1 change: 0 additions & 1 deletion starter/tslint.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": ["./node_modules/@nationalbankbelgium/stark-build/config/tslint.json"],
"rules": {
"i18n": false,
"component-selector": false
}
}
1 change: 0 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": ["./packages/stark-build/config/tslint.json"],
"rules": {
"i18n": false,
"component-selector": false
}
}

0 comments on commit e5e00ed

Please sign in to comment.