Skip to content

Commit 1e9d4dd

Browse files
committed
Upgrade tslint and update lint rules
1 parent 82725e8 commit 1e9d4dd

15 files changed

+179
-327
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ language: node_js
22
node_js:
33
- "10"
44
- "8"
5-
- "6"
65

76
cache:
87
yarn: true

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@
5757
"npm-run-all": "^4.1.5",
5858
"prettier": "^1.16.4",
5959
"rxjs": "^6.0.0",
60-
"tslint": "^4.5.1",
60+
"tslint": "^5.13.0",
6161
"tslint-config-prettier": "^1.18.0",
62-
"typescript": "~2.9.0"
62+
"tslint-consistent-codestyle": "^1.15.0",
63+
"tslint-microsoft-contrib": "^6.0.0",
64+
"tslint-misc-rules": "^3.5.1",
65+
"typescript": "~3.0.0"
6366
},
6467
"peerDependencies": {
6568
"rxjs": "^6.0.0"

src/cli.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import { promisify } from 'bluebird';
12
import * as jscodeshift from 'jscodeshift';
23
import { ASTNode, ASTPath } from 'jscodeshift';
34
import { Collection } from 'jscodeshift/src/Collection';
45
import * as minimist from 'minimist';
6+
import { fs } from 'mz';
57
import * as protobuf from 'protobufjs';
68
import { pbjs, pbts } from 'protobufjs/cli';
79
import * as tmp from 'tmp';
8-
import { fs } from 'mz';
9-
import { promisify } from 'bluebird';
1010

1111
const pbjsMain = promisify(pbjs.main);
1212
const pbtsMain = promisify(pbts.main);
@@ -45,7 +45,7 @@ export async function main(args: string[]) {
4545
return 1;
4646
}
4747

48-
let ts = await buildTypeScript(protoFiles);
48+
const ts = await buildTypeScript(protoFiles);
4949
if (out) {
5050
await fs.writeFile(out, ts);
5151
} else {

src/tests/enums.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as cli from '../cli';
2+
23
import { compileInMemory } from './utils';
34

45
describe('enums test', () => {

src/tests/examples.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import * as path from 'path';
21
import * as glob from 'glob';
32
import { fs } from 'mz';
3+
import * as path from 'path';
44

55
import * as cli from '../cli';
6+
67
import { compileInMemory, Sources } from './utils';
78

89
describe('compile/examples', () => {

src/tests/full-api.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as cli from '../cli';
2+
23
import { compileInMemory } from './utils';
34

45
describe('full api test', () => {

src/tests/messages.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as cli from '../cli';
2+
23
import { compileInMemory } from './utils';
34

45
describe('messages test', () => {

src/tests/multiple-namespaces.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as cli from '../cli';
2+
23
import { compileInMemory } from './utils';
34

45
describe('multiple namespaces test', () => {

src/tests/multiple-services.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as cli from '../cli';
2+
23
import { compileInMemory } from './utils';
34

45
describe('multiple services test', () => {

src/tests/nested-namespaces.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as cli from '../cli';
2+
23
import { compileInMemory } from './utils';
34

45
describe('nested namespaces test', () => {

src/tests/reference.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as cli from '../cli';
2+
23
import { compileInMemory } from './utils';
34

45
describe('reference test', () => {

src/tests/required.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as cli from '../cli';
2+
23
import { compileInMemory } from './utils';
34

45
describe('required test', () => {

tsconfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
"preserveConstEnums": true,
1212
"sourceMap": true,
1313
"target": "es5",
14+
"plugins": [
15+
{
16+
"name": "typescript-tslint-plugin",
17+
"ignoreDefinitionFiles": true
18+
}
19+
],
1420
"typeRoots": [
1521
"./node_modules/@types"
1622
]

tslint.json

Lines changed: 26 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,58 @@
11
{
22
"rulesDirectory": [
3-
"node_modules/tslint-config-prettier"
3+
"tslint-microsoft-contrib",
4+
"tslint-misc-rules",
5+
"tslint-consistent-codestyle",
6+
"tslint-config-prettier"
47
],
58
"rules": {
9+
"ban-comma-operator": true,
610
"class-name": true,
7-
"comment-format": [
8-
true,
9-
"check-space"
10-
],
11+
"class-method-newlines": true,
12+
"comment-format": [true, "check-space"],
1113
"curly": true,
12-
"eofline": true,
1314
"forin": true,
14-
"indent": [
15-
true,
16-
"spaces"
17-
],
1815
"label-position": true,
19-
"max-line-length": [
20-
true,
21-
140
22-
],
2316
"member-access": false,
2417
"member-ordering": [
2518
true,
26-
"static-before-instance",
27-
"variables-before-functions"
19+
{
20+
"order": ["static-field", "instance-field", "static-method", "instance-method"]
21+
}
2822
],
23+
"no-accessor-recursion": true,
2924
"no-arg": true,
3025
"no-bitwise": true,
31-
"no-console": [
32-
true,
33-
"debug",
34-
"info",
35-
"time",
36-
"timeEnd",
37-
"trace"
38-
],
26+
"no-console": [true, "debug", "info", "time", "timeEnd", "trace"],
3927
"no-construct": true,
4028
"no-debugger": true,
29+
"no-duplicate-switch-case": true,
4130
"no-duplicate-variable": true,
4231
"no-empty": false,
4332
"no-eval": true,
44-
"no-inferrable-types": true,
33+
"no-inferrable-types": [true],
34+
"no-return-await": true,
4535
"no-shadowed-variable": true,
36+
"no-static-this": true,
4637
"no-string-literal": false,
38+
"no-suspicious-comment": true,
4739
"no-switch-case-fall-through": true,
48-
"no-trailing-whitespace": true,
4940
"no-unused-expression": true,
50-
"no-unused-variable": true,
5141
"no-use-before-declare": true,
5242
"no-var-keyword": true,
5343
"object-literal-sort-keys": false,
54-
"one-line": [
55-
true,
56-
"check-open-brace",
57-
"check-catch",
58-
"check-else",
59-
"check-whitespace"
60-
],
61-
"quotemark": [
62-
true,
63-
"single"
64-
],
65-
"radix": true,
66-
"semicolon": [
67-
"always"
68-
],
69-
"triple-equals": [
70-
true,
71-
"allow-null-check"
72-
],
73-
"typedef-whitespace": [
44+
"ordered-imports": [
7445
true,
7546
{
76-
"call-signature": "nospace",
77-
"index-signature": "nospace",
78-
"parameter": "nospace",
79-
"property-declaration": "nospace",
80-
"variable-declaration": "nospace"
47+
"grouped-imports": true
8148
}
8249
],
83-
"variable-name": false,
84-
"whitespace": [
85-
true,
86-
"check-branch",
87-
"check-decl",
88-
"check-operator",
89-
"check-separator",
90-
"check-type"
91-
]
50+
"prefer-const": true,
51+
"prefer-readonly": true,
52+
"prefer-while": true,
53+
"radix": true,
54+
"semicolon": [true, "always"],
55+
"triple-equals": [true, "allow-null-check"],
56+
"variable-name": false
9257
}
9358
}

0 commit comments

Comments
 (0)