├── .npmignore ├── README.md ├── package.json └── tslint.json /.npmignore: -------------------------------------------------------------------------------- 1 | package-lock.json 2 | node_modules 3 | .git 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Angular TSLint Preset 2 | 3 | A preset with TSLint rules for development of Angular applications. The preset contains both, tslint core rules, and [codelyzer](https://github.com/mgechev/codelyzer) rules, which are going to perform Angular specific linting. 4 | 5 | This package is based on the tslint configuration of [Angular CLI](https://github.com/angular/angular-cli) and aligns with the [Angular style guide](https://angular.io/guide/styleguide). 6 | 7 | **Note:** there are few more rules added on top of the Angular CLI configuration. 8 | 9 | ## How to use? 10 | 11 | ```bash 12 | npm i tslint-angular --save-dev 13 | ``` 14 | 15 | After that configure `tslint.json` to use the preset: 16 | 17 | ```json 18 | { 19 | "extends": ["tslint-angular"], 20 | "rules": { 21 | "directive-selector": [true, "attribute", "foo", "camelCase"], 22 | "component-selector": [true, "element", "foo", "kebab-case"] 23 | } 24 | } 25 | ``` 26 | 27 | **Notice** that `directive-selector` and `component-selector` are configurable so you need to add them manually in the `rules` section of `tslint.json`. 28 | 29 | ## License 30 | 31 | MIT 32 | 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tslint-angular", 3 | "version": "3.0.3", 4 | "description": "tslint preset for Angular", 5 | "main": "./tslint.json", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/mgechev/tslint-angular.git" 9 | }, 10 | "keywords": [ 11 | "Angular", 12 | "tslint", 13 | "codelyzer" 14 | ], 15 | "author": "Minko Gechev ", 16 | "license": "MIT", 17 | "bugs": { 18 | "url": "https://github.com/mgechev/tslint-angular/issues" 19 | }, 20 | "homepage": "https://github.com/mgechev/tslint-angular#readme", 21 | "peerDependencies": { 22 | "codelyzer": ">=5.0.0", 23 | "tslint": ">=5.16.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": ["codelyzer"], 3 | "rules": { 4 | "arrow-return-shorthand": true, 5 | "callable-types": true, 6 | "class-name": true, 7 | "comment-format": [true, "check-space"], 8 | "curly": true, 9 | "deprecation": { 10 | "severity": "warn" 11 | }, 12 | "eofline": true, 13 | "forin": true, 14 | "import-blacklist": [true, "rxjs/Rx"], 15 | "import-spacing": true, 16 | "indent": [true, "spaces"], 17 | "interface-over-type-literal": true, 18 | "label-position": true, 19 | "max-classes-per-file": [true, 1], 20 | "max-line-length": [true, 140], 21 | "member-access": false, 22 | "member-ordering": [ 23 | true, 24 | { 25 | "order": ["static-field", "instance-field", "static-method", "instance-method"] 26 | } 27 | ], 28 | "no-arg": true, 29 | "no-bitwise": true, 30 | "no-construct": true, 31 | "no-debugger": true, 32 | "no-duplicate-super": true, 33 | "no-empty": false, 34 | "no-empty-interface": true, 35 | "no-eval": true, 36 | "no-inferrable-types": [true, "ignore-params"], 37 | "no-misused-new": true, 38 | "no-non-null-assertion": true, 39 | "no-shadowed-variable": true, 40 | "no-string-literal": false, 41 | "no-string-throw": true, 42 | "no-switch-case-fall-through": true, 43 | "no-trailing-whitespace": true, 44 | "no-unnecessary-initializer": true, 45 | "no-unused-expression": true, 46 | "no-var-keyword": true, 47 | "object-literal-sort-keys": false, 48 | "one-line": [true, "check-open-brace", "check-catch", "check-else", "check-whitespace"], 49 | "prefer-const": true, 50 | "quotemark": [true, "single"], 51 | "radix": true, 52 | "semicolon": [true, "always"], 53 | "triple-equals": [true, "allow-null-check"], 54 | "typedef-whitespace": [ 55 | true, 56 | { 57 | "call-signature": "nospace", 58 | "index-signature": "nospace", 59 | "parameter": "nospace", 60 | "property-declaration": "nospace", 61 | "variable-declaration": "nospace" 62 | } 63 | ], 64 | "unified-signatures": true, 65 | "variable-name": false, 66 | "whitespace": [true, "check-branch", "check-decl", "check-operator", "check-separator", "check-type"], 67 | 68 | "use-component-view-encapsulation": true, 69 | "contextual-lifecycle": true, 70 | "no-output-on-prefix": true, 71 | "no-inputs-metadata-property": true, 72 | "no-outputs-metadata-property": true, 73 | "no-host-metadata-property": true, 74 | "no-input-rename": true, 75 | "no-output-rename": true, 76 | "use-lifecycle-interface": true, 77 | "use-pipe-decorator": true, 78 | "use-pipe-transform-interface": true, 79 | "component-class-suffix": true, 80 | "directive-class-suffix": true, 81 | "template-banana-in-box": true, 82 | "template-no-negated-async": true 83 | } 84 | } 85 | --------------------------------------------------------------------------------