Skip to content

Commit

Permalink
feat(@schematics/angular): update default tslint.json rules
Browse files Browse the repository at this point in the history
In tslint version 6, several recommanded rules have been removed in the following PRs:
palantir/tslint#4871 palantir/tslint#4312

With this change, we bring back these rules in the CLI.
  • Loading branch information
alan-agius4 authored and mgechev committed Mar 17, 2020
1 parent cecb3de commit df4382f
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/schematics/angular/application/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ describe('Application Schematic', () => {
const content = JSON.parse(tree.readContent('/tslint.json'));
expect(content.extends).toMatch('tslint:recommended');
expect(content.rules['component-selector'][2]).toMatch('app');
expect(content.rules['trailing-comma']).toBeDefined();
expect(content.rules['no-console']).toBeDefined();
});

it(`should create correct paths when 'newProjectRoot' is blank`, async () => {
Expand Down
71 changes: 64 additions & 7 deletions packages/schematics/angular/workspace/files/tslint.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,34 @@
"codelyzer"
],
"rules": {
"align": {
"options": [
"parameters",
"statements"
]
},
"array-type": false,
"arrow-parens": false,
"arrow-return-shorthand": true,
"curly": true,
"deprecation": {
"severity": "warning"
},
"eofline": true,
"import-blacklist": [
true,
"rxjs/Rx"
],
"interface-name": false,
"import-spacing": true,
"indent": {
"options": [
"spaces"
]
},
"max-classes-per-file": false,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
{
Expand All @@ -31,7 +43,6 @@
]
}
],
"no-consecutive-blank-lines": false,
"no-console": [
true,
"debug",
Expand All @@ -53,13 +64,59 @@
true,
"as-needed"
],
"object-literal-sort-keys": false,
"ordered-imports": false,
"quotemark": [
true,
"single"
],
"trailing-comma": false,
"semicolon": {
"options": [
"always"
]
},
"space-before-function-paren": {
"options": {
"anonymous": "never",
"asyncArrow": "always",
"constructor": "never",
"method": "never",
"named": "never"
}
},
"typedef-whitespace": {
"options": [
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
},
{
"call-signature": "onespace",
"index-signature": "onespace",
"parameter": "onespace",
"property-declaration": "onespace",
"variable-declaration": "onespace"
}
]
},
"variable-name": {
"options": [
"ban-keywords",
"check-format",
"allow-pascal-case"
]
},
"whitespace": {
"options": [
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type",
"check-typecast"
]
},
"component-class-suffix": true,
"contextual-lifecycle": true,
"directive-class-suffix": true,
Expand Down

0 comments on commit df4382f

Please sign in to comment.