Skip to content

Commit 3825f21

Browse files
committed
style(lint): lint all files again
1 parent 4774abe commit 3825f21

12 files changed

+103
-118
lines changed

.eslintrc.json

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
11
{
2-
"parserOptions": {
3-
"ecmaVersion": 6,
4-
"ecmaFeatures": {
5-
"experimentalObjectRestSpread": true
6-
}
7-
},
8-
"env": {
9-
"node": true,
10-
"mocha": true,
11-
"es6": true
12-
},
13-
"extends": "eslint:recommended",
14-
"rules": {
15-
"indent": [
16-
"error",
17-
2
18-
],
19-
"quotes": [
20-
"error",
21-
"single"
22-
],
23-
"semi": [
24-
"error",
25-
"always"
26-
]
2+
"parserOptions": {
3+
"ecmaVersion": 6,
4+
"ecmaFeatures": {
5+
"experimentalObjectRestSpread": true
276
}
28-
}
7+
},
8+
"env": {
9+
"node": true,
10+
"mocha": true,
11+
"es6": true
12+
},
13+
"extends": "eslint:recommended"
14+
}

.prettierrc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"singleQuote": true
3-
}
2+
"singleQuote": true,
3+
"semi": true,
4+
"tabWidth": 2,
5+
"useTabs": false,
6+
"printWidth": 80
7+
}

src/CancellationToken.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ export class CancellationToken {
1515
lastCancellationCheckTime: number;
1616
constructor(cancellationFileName: string, isCancelled: boolean) {
1717
this.isCancelled = !!isCancelled;
18-
this.cancellationFileName = cancellationFileName || crypto.randomBytes(64).toString('hex');
18+
this.cancellationFileName =
19+
cancellationFileName || crypto.randomBytes(64).toString('hex');
1920
this.lastCancellationCheckTime = 0;
2021
}
2122

2223
static createFromJSON(json: CancellationTokenData) {
23-
return new CancellationToken(
24-
json.cancellationFileName,
25-
json.isCancelled
26-
);
24+
return new CancellationToken(json.cancellationFileName, json.isCancelled);
2725
}
2826

2927
toJSON() {

src/FilesWatcher.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ export class FilesWatcher {
2424
}
2525

2626
this.watchers = this.watchPaths.map((watchPath: string) => {
27-
return chokidar.watch(
28-
watchPath,
29-
{ persistent: true, alwaysStat: true }
30-
)
27+
return chokidar
28+
.watch(watchPath, { persistent: true, alwaysStat: true })
3129
.on('change', (filePath: string, stats: any) => {
3230
if (this.isFileSupported(filePath)) {
3331
(this.listeners['change'] || []).forEach(changeListener => {
@@ -67,7 +65,9 @@ export class FilesWatcher {
6765

6866
off(event: string, listener: Function) {
6967
if (this.listeners[event]) {
70-
this.listeners[event] = this.listeners[event].filter(oldListener => oldListener !== listener);
68+
this.listeners[event] = this.listeners[event].filter(
69+
oldListener => oldListener !== listener
70+
);
7171
}
7272
}
7373
}

src/Message.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NormalizedMessage } from './NormalizedMessage';
22

33
export interface Message {
4-
diagnostics: NormalizedMessage[];
5-
lints: NormalizedMessage[];
4+
diagnostics: NormalizedMessage[];
5+
lints: NormalizedMessage[];
66
}

src/WorkResult.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export class WorkResult {
1515

1616
set(workName: number, result: any) {
1717
if (!this.supports(workName)) {
18-
throw new Error('Cannot set result - work "' + workName + '" is not supported.');
18+
throw new Error(
19+
'Cannot set result - work "' + workName + '" is not supported.'
20+
);
1921
}
2022

2123
this.workResult[workName] = result;
@@ -27,7 +29,9 @@ export class WorkResult {
2729

2830
get(workName: number) {
2931
if (!this.supports(workName)) {
30-
throw new Error('Cannot get result - work "' + workName + '" is not supported.');
32+
throw new Error(
33+
'Cannot get result - work "' + workName + '" is not supported.'
34+
);
3135
}
3236

3337
return this.workResult[workName];

src/WorkSet.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ export class WorkSet {
88
workBegin: number;
99
workEnd: number;
1010

11-
constructor(workDomain: ReadonlyArray<ts.SourceFile> | string[], workNumber: number, workDivision: number) {
11+
constructor(
12+
workDomain: ReadonlyArray<ts.SourceFile> | string[],
13+
workNumber: number,
14+
workDivision: number
15+
) {
1216
this.workDomain = workDomain;
1317
this.workNumber = workNumber;
1418
this.workDivision = workDivision;

src/cluster.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@ const workers: childProcess.ChildProcess[] = [];
1212

1313
for (let num = 0; num < division; num++) {
1414
workers.push(
15-
childProcess.fork(
16-
path.resolve(__dirname, './service.js'),
17-
[],
18-
{
19-
execArgv: ['--max-old-space-size=' + process.env.MEMORY_LIMIT],
20-
env: Object.assign({}, process.env, { WORK_NUMBER: num }),
21-
stdio: ['inherit', 'inherit', 'inherit', 'ipc']
22-
}
23-
)
15+
childProcess.fork(path.resolve(__dirname, './service.js'), [], {
16+
execArgv: ['--max-old-space-size=' + process.env.MEMORY_LIMIT],
17+
env: Object.assign({}, process.env, { WORK_NUMBER: num }),
18+
stdio: ['inherit', 'inherit', 'inherit', 'ipc']
19+
})
2420
);
2521
}
2622

@@ -46,13 +42,10 @@ process.on('message', (message: Message) => {
4642
workers.forEach(worker => {
4743
worker.on('message', (message: Message) => {
4844
// set result from worker
49-
result.set(
50-
worker.pid,
51-
{
52-
diagnostics: message.diagnostics.map(NormalizedMessage.createFromJSON),
53-
lints: message.lints.map(NormalizedMessage.createFromJSON)
54-
}
55-
);
45+
result.set(worker.pid, {
46+
diagnostics: message.diagnostics.map(NormalizedMessage.createFromJSON),
47+
lints: message.lints.map(NormalizedMessage.createFromJSON)
48+
});
5649

5750
// if we have result from all workers, send merged
5851
if (result.hasAll()) {

src/service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function run(cancellationToken: CancellationToken) {
4646
}
4747
}
4848

49-
process.on('message', (message) => {
49+
process.on('message', message => {
5050
run(CancellationToken.createFromJSON(message));
5151
});
5252

src/tsconfig.json

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
{
2-
"compilerOptions": {
3-
"target": "es5",
4-
"noImplicitAny": true,
5-
"noImplicitReturns": true,
6-
"noImplicitThis": true,
7-
"noUnusedLocals": true,
8-
"noUnusedParameters": true,
9-
"suppressImplicitAnyIndexErrors": true,
10-
"strictNullChecks": false,
11-
"lib": [
12-
"es5", "es2015.core", "dom"
13-
],
14-
"module": "commonjs",
15-
"moduleResolution": "node",
16-
"declaration": true,
17-
"outDir": "../lib",
18-
"declarationDir": "../lib/types"
19-
}
20-
}
2+
"compilerOptions": {
3+
"target": "es5",
4+
"noImplicitAny": true,
5+
"noImplicitReturns": true,
6+
"noImplicitThis": true,
7+
"noUnusedLocals": true,
8+
"noUnusedParameters": true,
9+
"suppressImplicitAnyIndexErrors": true,
10+
"strictNullChecks": false,
11+
"lib": ["es5", "es2015.core", "dom"],
12+
"module": "commonjs",
13+
"moduleResolution": "node",
14+
"declaration": true,
15+
"outDir": "../lib",
16+
"declarationDir": "../lib/types"
17+
}
18+
}

src/tslint.json

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
{
2-
"extends": ["tslint:latest", "tslint-config-prettier"],
3-
"rules": {
4-
"max-line-length": [false, 140],
5-
"object-literal-sort-keys": false,
6-
"interface-name": [true, "never-prefix"],
7-
"member-ordering": [
8-
false
9-
],
10-
"no-object-literal-type-assertion":false,
11-
"no-var-requires": false,
12-
"no-string-literal": false,
13-
"ordered-imports":false,
14-
"prefer-object-spread": false,
15-
"ban-types": false,
16-
"arrow-parens": false,
17-
"member-access": [
18-
false
19-
],
20-
"trailing-comma": [false],
21-
"triple-equals": [
22-
true
23-
],
24-
"variable-name": [true,
25-
"ban-keywords",
26-
"check-format",
27-
"allow-leading-underscore",
28-
"allow-pascal-case"
29-
],
30-
"no-namespace": false
31-
}
2+
"extends": ["tslint:latest", "tslint-config-prettier"],
3+
"rules": {
4+
"object-literal-sort-keys": false,
5+
"interface-name": [true, "never-prefix"],
6+
"member-ordering": [false],
7+
"no-object-literal-type-assertion": false,
8+
"no-var-requires": false,
9+
"no-string-literal": false,
10+
"ordered-imports": false,
11+
"prefer-object-spread": false,
12+
"ban-types": false,
13+
"arrow-parens": false,
14+
"member-access": [false],
15+
"trailing-comma": [false],
16+
"triple-equals": [true],
17+
"variable-name": [
18+
true,
19+
"ban-keywords",
20+
"check-format",
21+
"allow-leading-underscore",
22+
"allow-pascal-case"
23+
],
24+
"no-namespace": false
3225
}
33-
26+
}

src/types/vue-template-compiler.d.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ declare module 'vue-template-compiler' {
2424

2525
interface CompiledResultFunctions {
2626
render: () => VNode;
27-
staticRenderFns: (() => VNode)[];
27+
staticRenderFns: Array<() => VNode>;
2828
}
2929

3030
interface ModuleOptions {
@@ -36,7 +36,10 @@ declare module 'vue-template-compiler' {
3636
staticKeys?: string[];
3737
}
3838

39-
type DirectiveFunction = (node: ASTElement, directiveMeta: ASTDirective) => void;
39+
type DirectiveFunction = (
40+
node: ASTElement,
41+
directiveMeta: ASTDirective
42+
) => void;
4043

4144
/*
4245
* AST Types
@@ -49,7 +52,7 @@ declare module 'vue-template-compiler' {
4952
* - 3: CHILDREN - self un-optimizable but have fully optimizable children
5053
* - 4: PARTIAL - self un-optimizable with some un-optimizable children
5154
*/
52-
export type SSROptimizability = 0 | 1 | 2 | 3 | 4
55+
export type SSROptimizability = 0 | 1 | 2 | 3 | 4;
5356

5457
export interface ASTModifiers {
5558
[key: string]: boolean;
@@ -83,7 +86,7 @@ declare module 'vue-template-compiler' {
8386
export interface ASTElement {
8487
type: 1;
8588
tag: string;
86-
attrsList: { name: string; value: any }[];
89+
attrsList: Array<{ name: string; value: any }>;
8790
attrsMap: Record<string, any>;
8891
parent: ASTElement | undefined;
8992
children: ASTNode[];
@@ -97,8 +100,8 @@ declare module 'vue-template-compiler' {
97100
hasBindings?: boolean;
98101

99102
text?: string;
100-
attrs?: { name: string; value: any }[];
101-
props?: { name: string; value: string }[];
103+
attrs?: Array<{ name: string; value: any }>;
104+
props?: Array<{ name: string; value: string }>;
102105
plain?: boolean;
103106
pre?: true;
104107
ns?: string;
@@ -162,7 +165,7 @@ declare module 'vue-template-compiler' {
162165
type: 2;
163166
expression: string;
164167
text: string;
165-
tokens: (string | Record<string, any>)[];
168+
tokens: Array<string | Record<string, any>>;
166169
static?: boolean;
167170
// 2.4 ssr optimization
168171
ssrOptimizability?: SSROptimizability;
@@ -218,7 +221,9 @@ declare module 'vue-template-compiler' {
218221
options?: CompilerOptions
219222
): CompiledResult;
220223

221-
export function ssrCompileToFunctions(template: string): CompiledResultFunctions;
224+
export function ssrCompileToFunctions(
225+
template: string
226+
): CompiledResultFunctions;
222227

223228
export function parseComponent(
224229
file: string,

0 commit comments

Comments
 (0)