diff --git a/README.md b/README.md index 2344c4b..761727d 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,14 @@ body { - [AirBnB EsLint](https://github.com/bigspaceship/javascript) +### 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/) + - [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 Here at Big Spaceship we practice Test Driven Development (TDD) which is where you write a test before you write enough code to fulfill that test and then refactor the code to make the test pass. This process is repeated until the feature is complete. Each component built should have proper Unit tests as well as Acceptance tests verifying the expected functionality of the compoonent. Testing utilities such as [Enzyme](https://github.com/airbnb/enzyme) for React, [Vue Test Utils](https://github.com/vuejs/vue-test-utils) for Vue, and [Karma](https://karma-runner.github.io/2.0/index.html) for Angular are integrated to make it easier to assert, manipulate, and traverse a components output. Using coverage tools built into the testing frameworks offer a table with percentages of code that is covered by tests and what lines of code are missing testing. Each file should aim to have complete coverage. diff --git a/linting-formatting/angular/tslint.json b/linting-formatting/angular/tslint.json new file mode 100644 index 0000000..2bf2143 --- /dev/null +++ b/linting-formatting/angular/tslint.json @@ -0,0 +1,91 @@ +{ + "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"], + "trailing-comma": [true, { "multiline": "always", "singleline": "never" }], + "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"] +}