Skip to content

Commit 39fddef

Browse files
authored
Fix inconsistency with dangling commas (#317)
1 parent 1646515 commit 39fddef

26 files changed

Lines changed: 94 additions & 93 deletions

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"no-var": "error",
1818
"prefer-const": "error",
1919
"quotes": ["error", "single"],
20+
"comma-dangle": ["error", "always-multiline"],
2021
"semi": "error",
2122
"space-before-blocks": "error",
2223
"space-before-function-paren": ["error", {

bin/concurrently.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const isWindows = process.platform === 'win32';
88
const createKillMessage = (prefix: string) => new RegExp(
99
_.escapeRegExp(prefix) +
1010
' exited with code ' +
11-
(isWindows ? 1 : '(SIGTERM|143)')
11+
(isWindows ? 1 : '(SIGTERM|143)'),
1212
);
1313

1414
/**
@@ -22,31 +22,31 @@ const run = (args: string) => {
2222
env: Object.assign({}, process.env, {
2323
// When upgrading from jest 23 -> 24, colors started printing in the test output.
2424
// They are forcibly disabled here
25-
FORCE_COLOR: 0
25+
FORCE_COLOR: 0,
2626
}),
2727
});
2828

2929
const stdout = readline.createInterface({
3030
input: child.stdout,
31-
output: null
31+
output: null,
3232
});
3333

3434
const stderr = readline.createInterface({
3535
input: child.stderr,
36-
output: null
36+
output: null,
3737
});
3838

3939
const close = Rx.fromEvent<[number | null, NodeJS.Signals | null]>(child, 'close');
4040
const log = Rx.merge(
4141
Rx.fromEvent<Buffer>(stdout, 'line'),
42-
Rx.fromEvent<Buffer>(stderr, 'line')
42+
Rx.fromEvent<Buffer>(stderr, 'line'),
4343
).pipe(map(data => data.toString()));
4444

4545
return {
4646
close,
4747
log,
4848
stdin: child.stdin,
49-
pid: child.pid
49+
pid: child.pid,
5050
};
5151
};
5252

@@ -61,7 +61,7 @@ it('has version command', done => {
6161
Rx.combineLatest(
6262
run('--version').close,
6363
run('-V').close,
64-
run('-v').close
64+
run('-v').close,
6565
).subscribe(events => {
6666
expect(events[0][0]).toBe(0);
6767
expect(events[1][0]).toBe(0);

bin/concurrently.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ const args = yargs
2020
describe:
2121
'How many processes should run at once.\n' +
2222
'New processes only spawn after all restart tries of a process.',
23-
type: 'number'
23+
type: 'number',
2424
},
2525
'names': {
2626
alias: 'n',
2727
describe:
2828
'List of custom names to be used in prefix template.\n' +
2929
'Example names: "main,browser,server"',
30-
type: 'string'
30+
type: 'string',
3131
},
3232
'name-separator': {
3333
describe:
@@ -42,48 +42,48 @@ const args = yargs
4242
'of the "first" child to terminate, the "last child", or succeed ' +
4343
'only if "all" child processes succeed.',
4444
choices: ['first', 'last', 'all'] as const,
45-
default: defaults.success
45+
default: defaults.success,
4646
},
4747
'raw': {
4848
alias: 'r',
4949
describe:
5050
'Output only raw output of processes, disables prettifying ' +
5151
'and concurrently coloring.',
52-
type: 'boolean'
52+
type: 'boolean',
5353
},
5454
// This one is provided for free. Chalk reads this itself and removes colours.
5555
// https://www.npmjs.com/package/chalk#chalksupportscolor
5656
'no-color': {
5757
describe: 'Disables colors from logging',
58-
type: 'boolean'
58+
type: 'boolean',
5959
},
6060
'hide': {
6161
describe:
6262
'Comma-separated list of processes to hide the output.\n' +
6363
'The processes can be identified by their name or index.',
6464
default: defaults.hide,
65-
type: 'string'
65+
type: 'string',
6666
},
6767
'group': {
6868
alias: 'g',
6969
describe: 'Order the output as if the commands were run sequentially.',
70-
type: 'boolean'
70+
type: 'boolean',
7171
},
7272
'timings': {
7373
describe: 'Show timing information for all processes',
7474
type: 'boolean',
75-
default: defaults.timings
75+
default: defaults.timings,
7676
},
7777

7878
// Kill others
7979
'kill-others': {
8080
alias: 'k',
8181
describe: 'kill other processes if one exits or dies',
82-
type: 'boolean'
82+
type: 'boolean',
8383
},
8484
'kill-others-on-fail': {
8585
describe: 'kill other processes if one exits with non zero status code',
86-
type: 'boolean'
86+
type: 'boolean',
8787
},
8888

8989
// Prefix
@@ -94,7 +94,7 @@ const args = yargs
9494
'Possible values: index, pid, time, command, name, none, or a template. ' +
9595
'Example template: "{time}-{pid}"',
9696
defaultDescription: 'index or name (when --names is set)',
97-
type: 'string'
97+
type: 'string',
9898
},
9999
'prefix-colors': {
100100
alias: 'c',
@@ -107,21 +107,21 @@ const args = yargs
107107
'- Available background colors: bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite\n' +
108108
'See https://www.npmjs.com/package/chalk for more information.',
109109
default: defaults.prefixColors,
110-
type: 'string'
110+
type: 'string',
111111
},
112112
'prefix-length': {
113113
alias: 'l',
114114
describe:
115115
'Limit how many characters of the command is displayed in prefix. ' +
116116
'The option can be used to shorten the prefix when it is set to "command"',
117117
default: defaults.prefixLength,
118-
type: 'number'
118+
type: 'number',
119119
},
120120
'timestamp-format': {
121121
alias: 't',
122122
describe: 'Specify the timestamp in moment/date-fns format.',
123123
default: defaults.timestampFormat,
124-
type: 'string'
124+
type: 'string',
125125
},
126126

127127
// Restarting
@@ -130,12 +130,12 @@ const args = yargs
130130
'How many times a process that died should restart.\n' +
131131
'Negative numbers will make the process restart forever.',
132132
default: defaults.restartTries,
133-
type: 'number'
133+
type: 'number',
134134
},
135135
'restart-after': {
136136
describe: 'Delay time to respawn the process, in milliseconds.',
137137
default: defaults.restartDelay,
138-
type: 'number'
138+
type: 'number',
139139
},
140140

141141
// Input
@@ -144,15 +144,15 @@ const args = yargs
144144
describe:
145145
'Whether input should be forwarded to the child processes. ' +
146146
'See examples for more information.',
147-
type: 'boolean'
147+
type: 'boolean',
148148
},
149149
'default-input-target': {
150150
default: defaults.defaultInputTarget,
151151
describe:
152152
'Identifier for child process to which input on stdin ' +
153153
'should be sent if not specified at start of input.\n' +
154-
'Can be either the index or the name of the process.'
155-
}
154+
'Can be either the index or the name of the process.',
155+
},
156156
})
157157
.group(['m', 'n', 'name-separator', 'raw', 's', 'no-color', 'hide', 'group', 'timings'], 'General')
158158
.group(['p', 'c', 'l', 't'], 'Prefix styling')
@@ -166,7 +166,7 @@ const names = (args.names || '').split(args['name-separator']);
166166

167167
concurrently(args._.map((command, index) => ({
168168
command: String(command),
169-
name: names[index]
169+
name: names[index],
170170
})), {
171171
handleInput: args['handle-input'],
172172
defaultInputTarget: args['default-input-target'],
@@ -184,8 +184,8 @@ concurrently(args._.map((command, index) => ({
184184
restartTries: args['restart-tries'],
185185
successCondition: args.success,
186186
timestampFormat: args['timestamp-format'],
187-
timings: args.timings
187+
timings: args.timings,
188188
}).result.then(
189189
() => process.exit(0),
190-
() => process.exit(1)
190+
() => process.exit(1),
191191
);

bin/epilogue.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
const examples = [
44
{
55
description: 'Output nothing more than stdout+stderr of child processes',
6-
example: '$ $0 --raw "npm run watch-less" "npm run watch-js"'
6+
example: '$ $0 --raw "npm run watch-less" "npm run watch-js"',
77
},
88
{
99
description: 'Normal output but without colors e.g. when logging to file',
10-
example: '$ $0 --no-color "grunt watch" "http-server" > log'
10+
example: '$ $0 --no-color "grunt watch" "http-server" > log',
1111
},
1212
{
1313
description: 'Custom prefix',
@@ -25,21 +25,21 @@ const examples = [
2525
description: 'Send input to default',
2626
example: [
2727
'$ $0 --handle-input "nodemon" "npm run watch-js"',
28-
'rs # Sends rs command to nodemon process'
28+
'rs # Sends rs command to nodemon process',
2929
].join('\n'),
3030
},
3131
{
3232
description: 'Send input to specific child identified by index',
3333
example: [
3434
'$ $0 --handle-input "npm run watch-js" nodemon',
35-
'1:rs'
35+
'1:rs',
3636
].join('\n'),
3737
},
3838
{
3939
description: 'Send input to specific child identified by name',
4040
example: [
4141
'$ $0 --handle-input -n js,srv "npm run watch-js" nodemon',
42-
'srv:rs'
42+
'srv:rs',
4343
].join('\n'),
4444
},
4545
{
@@ -52,8 +52,8 @@ const examples = [
5252
},
5353
{
5454
description: 'Exclude patterns so that between "lint:js" and "lint:fix:js", only "lint:js" is ran',
55-
example: '$ $0 "npm:*(!fix)"'
56-
}
55+
example: '$ $0 "npm:*(!fix)"',
56+
},
5757
];
5858

5959
export const epilogue = `

src/command-parser/expand-npm-shortcut.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ for (const npmCmd of ['npm', 'yarn', 'pnpm']) {
1919
expect(parser.parse(commandInfo)).toEqual({
2020
...commandInfo,
2121
name: 'echo',
22-
command: `${npmCmd} run foo -- bar`
22+
command: `${npmCmd} run foo -- bar`,
2323
});
2424
});
2525

@@ -28,7 +28,7 @@ for (const npmCmd of ['npm', 'yarn', 'pnpm']) {
2828
expect(parser.parse(commandInfo)).toEqual({
2929
...commandInfo,
3030
name: 'foo',
31-
command: `${npmCmd} run foo -- bar`
31+
command: `${npmCmd} run foo -- bar`,
3232
});
3333
});
3434
});

src/command-parser/expand-npm-shortcut.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class ExpandNpmShortcut implements CommandParser {
1313

1414
return Object.assign({}, commandInfo, {
1515
name: commandInfo.name || cmdName,
16-
command: `${npmCmd} run ${cmdName}${args}`
16+
command: `${npmCmd} run ${cmdName}${args}`,
1717
});
1818
}
1919
};

src/command-parser/expand-npm-wildcard.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ for (const npmCmd of ['npm', 'yarn', 'pnpm']) {
7474
scripts: {
7575
'foo-bar-baz': '',
7676
'foo--baz': '',
77-
}
77+
},
7878
});
7979

8080
expect(parser.parse(createCommandInfo(`${npmCmd} run foo-*-baz qux`))).toEqual([
@@ -88,7 +88,7 @@ for (const npmCmd of ['npm', 'yarn', 'pnpm']) {
8888
scripts: {
8989
'watch-js': '',
9090
'watch-css': '',
91-
}
91+
},
9292
});
9393

9494
expect(parser.parse({
@@ -107,7 +107,7 @@ for (const npmCmd of ['npm', 'yarn', 'pnpm']) {
107107
'lint:ts': '',
108108
'lint:fix:js': '',
109109
'lint:fix:ts': '',
110-
}
110+
},
111111
});
112112

113113
expect(parser.parse(createCommandInfo(`${npmCmd} run lint:*(!fix)`))).toEqual([

src/command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class Command implements CommandInfo {
161161
startDate,
162162
endDate,
163163
durationSeconds: durationSeconds + (durationNanoSeconds / 1e9),
164-
}
164+
},
165165
});
166166
});
167167
child.stdout && pipeTo(Rx.fromEvent<Buffer>(child.stdout, 'data'), this.stdout);

src/completion-listener.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ beforeEach(() => {
1212
const createController = (successCondition?: SuccessCondition) =>
1313
new CompletionListener({
1414
successCondition,
15-
scheduler
15+
scheduler,
1616
});
1717

1818
describe('with default success condition set', () => {

src/completion-listener.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class CompletionListener {
6464
switchMap(exitInfos =>
6565
this.isSuccess(exitInfos.map(({ exitCode }) => exitCode))
6666
? Rx.of(exitInfos, this.scheduler)
67-
: Rx.throwError(exitInfos, this.scheduler)
67+
: Rx.throwError(exitInfos, this.scheduler),
6868
),
6969
take(1),
7070
)

0 commit comments

Comments
 (0)