From 299eb96ce8de28457083829801cc954341c8d12a Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Wed, 26 Sep 2018 16:02:23 -0400 Subject: [PATCH 1/5] added a tslint.json file --- linting-formatting/angular/tslint.json | 90 ++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 linting-formatting/angular/tslint.json diff --git a/linting-formatting/angular/tslint.json b/linting-formatting/angular/tslint.json new file mode 100644 index 0000000..8ceb69b --- /dev/null +++ b/linting-formatting/angular/tslint.json @@ -0,0 +1,90 @@ +{ + "defaultSeverity": "error", + "extends": ["tslint:recommended", "tslint-config-standard", "tslint-config-prettier"], + "jsRules": {}, + "rules": { + "arrow-return-shorthand": true, + "callable-types": true, + "class-name": true, + "comment-format": [true, "check-space"], + "curly": true, + "deprecation": { + "severity": "warn" + }, + "eofline": true, + "forin": true, + "import-blacklist": [true, "rxjs/Rx"], + "import-spacing": true, + "indent": [true, "spaces"], + "interface-over-type-literal": true, + "label-position": true, + "max-line-length": [true, 140], + "member-access": false, + "member-ordering": [ + true, + { + "order": ["static-field", "instance-field", "static-method", "instance-method"] + } + ], + "no-arg": true, + "no-bitwise": true, + "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], + "no-construct": true, + "no-debugger": true, + "no-duplicate-super": true, + "no-empty": false, + "no-empty-interface": true, + "no-eval": true, + "no-inferrable-types": [true, "ignore-params"], + "no-misused-new": true, + "no-non-null-assertion": true, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-string-throw": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unnecessary-initializer": true, + "no-unused-expression": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "ordered-imports": false, + "object-literal-sort-keys": false, + "one-line": [true, "check-open-brace", "check-catch", "check-else", "check-whitespace"], + "prefer-const": true, + "quotemark": [true, "single"], + "radix": true, + "semicolon": [true, "always"], + "triple-equals": [true, "allow-null-check"], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "unified-signatures": true, + "variable-name": false, + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ], + "no-output-on-prefix": true, + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true + }, + "rulesDirectory": ["node_modules/codelyzer"] +} From dbeef069822fe32d1f435b4afe748ac4b321c5f0 Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Wed, 26 Sep 2018 16:02:23 -0400 Subject: [PATCH 2/5] added a tslint.json file --- linting-formatting/angular/tslint.json | 90 ++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 linting-formatting/angular/tslint.json diff --git a/linting-formatting/angular/tslint.json b/linting-formatting/angular/tslint.json new file mode 100644 index 0000000..8ceb69b --- /dev/null +++ b/linting-formatting/angular/tslint.json @@ -0,0 +1,90 @@ +{ + "defaultSeverity": "error", + "extends": ["tslint:recommended", "tslint-config-standard", "tslint-config-prettier"], + "jsRules": {}, + "rules": { + "arrow-return-shorthand": true, + "callable-types": true, + "class-name": true, + "comment-format": [true, "check-space"], + "curly": true, + "deprecation": { + "severity": "warn" + }, + "eofline": true, + "forin": true, + "import-blacklist": [true, "rxjs/Rx"], + "import-spacing": true, + "indent": [true, "spaces"], + "interface-over-type-literal": true, + "label-position": true, + "max-line-length": [true, 140], + "member-access": false, + "member-ordering": [ + true, + { + "order": ["static-field", "instance-field", "static-method", "instance-method"] + } + ], + "no-arg": true, + "no-bitwise": true, + "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], + "no-construct": true, + "no-debugger": true, + "no-duplicate-super": true, + "no-empty": false, + "no-empty-interface": true, + "no-eval": true, + "no-inferrable-types": [true, "ignore-params"], + "no-misused-new": true, + "no-non-null-assertion": true, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-string-throw": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unnecessary-initializer": true, + "no-unused-expression": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "ordered-imports": false, + "object-literal-sort-keys": false, + "one-line": [true, "check-open-brace", "check-catch", "check-else", "check-whitespace"], + "prefer-const": true, + "quotemark": [true, "single"], + "radix": true, + "semicolon": [true, "always"], + "triple-equals": [true, "allow-null-check"], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "unified-signatures": true, + "variable-name": false, + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ], + "no-output-on-prefix": true, + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true + }, + "rulesDirectory": ["node_modules/codelyzer"] +} From 614c0ebfb7e5fa34a2fe963569d4b1700ec98c7b Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Fri, 28 Sep 2018 12:27:13 -0400 Subject: [PATCH 3/5] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 302dcd9..7b9f682 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,14 @@ you can learn more about all these tags [here](https://html.com/semantic-markup/ - [AirBnB EsLint](https://github.com/bigspaceship/javascript) +### Typescript Linitng +- Angular usually sets up a tslint file by defualt but in this repo we have a custom [one](https://github.com/bigspaceship/coding-standards/tree/feature/ts-lint/linting-formatting/angular) +- At Big Spaceship whenever working on a Angular application we use the following tools for ensuring a proper lint environment. + - [TSLint](https://palantir.github.io/tslint/) + - [Prettier](https://prettier.io/) + - And to bind the two together [tslint-config-prettier](https://github.com/alexjoverm/tslint-config-prettier) + - Since our code editor of choice is currently VS Code, [this tool](https://marketplace.visualstudio.com/items?itemName=eg2.tslint) is what we recommend for this IDE. + ## Testing - [Jest](https://facebook.github.io/jest/) From 98acaff2eea8701015710543e0e4a8f01140cb65 Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Fri, 28 Sep 2018 12:27:47 -0400 Subject: [PATCH 4/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b9f682..1fcef23 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ you can learn more about all these tags [here](https://html.com/semantic-markup/ - [AirBnB EsLint](https://github.com/bigspaceship/javascript) -### Typescript Linitng +### Typescript Linting - Angular usually sets up a tslint file by defualt but in this repo we have a custom [one](https://github.com/bigspaceship/coding-standards/tree/feature/ts-lint/linting-formatting/angular) - At Big Spaceship whenever working on a Angular application we use the following tools for ensuring a proper lint environment. - [TSLint](https://palantir.github.io/tslint/) From 557f24395b89f9e05c0b4c4a8baacdd8baa2cb59 Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Fri, 28 Sep 2018 14:29:56 -0400 Subject: [PATCH 5/5] Added trailign comma --- linting-formatting/angular/tslint.json | 1 + 1 file changed, 1 insertion(+) diff --git a/linting-formatting/angular/tslint.json b/linting-formatting/angular/tslint.json index 8ceb69b..2bf2143 100644 --- a/linting-formatting/angular/tslint.json +++ b/linting-formatting/angular/tslint.json @@ -54,6 +54,7 @@ "quotemark": [true, "single"], "radix": true, "semicolon": [true, "always"], + "trailing-comma": [true, { "multiline": "always", "singleline": "never" }], "triple-equals": [true, "allow-null-check"], "typedef-whitespace": [ true,