Skip to content

Commit c13aca8

Browse files
authored
fix: Upgrade production dependencies + babel and eslint (#197)
* Upgrade production dependencies * Fix flow problems * Make dev dependencies non-exact * Upgrade all of babel * Upgrade eslint-based dependencies * Run eslint autofix * Fix remaining lint issues manually
1 parent 794fbc8 commit c13aca8

54 files changed

Lines changed: 851 additions & 692 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flowconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[ignore]
22
.*/node_modules/fbjs/.*
3+
.*/node_modules/yargs/.*
34
.*/dist/.*
45
.*/__tests__/fixtures/.*
56

__tests__/integrations/cli/test-badge-reporter.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,39 +22,43 @@ async function svg2json(filePath) {
2222

2323
describe('badge reporter', () => {
2424
it('should generate red badges on project-low-coverage-with-error', async () => {
25-
const tmpDir = tempy.directory();
25+
const temporaryDir = tempy.directory();
2626

2727
const {exitCode} = await runFlowCoverageReport([
28-
'-i', `"src/*.js"`, '-t', 'badge', '-o', tmpDir
28+
'-i', '"src/*.js"', '-t', 'badge', '-o', temporaryDir
2929
], {cwd: testLowCoverageDir});
3030

3131
// Expect flow-coverage-report to exit with 2 on low coverage.
3232
expect(exitCode).toBe(2);
3333

34-
const flowBadge = await svg2json(path.join(tmpDir, 'flow-badge.svg'));
35-
const flowCoverageBadge = await svg2json(path.join(tmpDir, 'flow-coverage-badge.svg'));
34+
const flowBadge = await svg2json(path.join(temporaryDir, 'flow-badge.svg'));
35+
const flowCoverageBadge = await svg2json(path.join(temporaryDir, 'flow-coverage-badge.svg'));
3636

3737
expect(flowBadge).toMatchSnapshot('flow-badge red');
3838
expect(flowCoverageBadge).toMatchSnapshot('flow-coverage-badge red');
3939

40-
await new Promise(resolve => rimraf(path.join(tmpDir, '*.svg'), resolve));
40+
await new Promise(resolve => {
41+
rimraf(path.join(temporaryDir, '*.svg'), resolve);
42+
});
4143
});
4244

4345
it('should generate green badges on full covered project', async () => {
44-
const tmpDir = tempy.directory();
46+
const temporaryDir = tempy.directory();
4547

4648
const {exitCode} = await runFlowCoverageReport([
47-
'-i', `"src/*.js"`, '-t', 'badge', '-o', tmpDir
49+
'-i', '"src/*.js"', '-t', 'badge', '-o', temporaryDir
4850
], {cwd: testFullCoverageDir});
4951

5052
expect(exitCode).toBe(0);
5153

52-
const flowBadge = await svg2json(path.join(tmpDir, 'flow-badge.svg'));
53-
const flowCoverageBadge = await svg2json(path.join(tmpDir, 'flow-coverage-badge.svg'));
54+
const flowBadge = await svg2json(path.join(temporaryDir, 'flow-badge.svg'));
55+
const flowCoverageBadge = await svg2json(path.join(temporaryDir, 'flow-coverage-badge.svg'));
5456

5557
expect(flowBadge).toMatchSnapshot('flow-badge green');
5658
expect(flowCoverageBadge).toMatchSnapshot('flow-coverage-badge green');
5759

58-
await new Promise(resolve => rimraf(path.join(tmpDir, '*.svg'), resolve));
60+
await new Promise(resolve => {
61+
rimraf(path.join(temporaryDir, '*.svg'), resolve);
62+
});
5963
});
6064
});

__tests__/integrations/cli/test-exit-value.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,29 @@ const testProjectDir = path.join(FIXTURE_PATH, 'project-low-coverage');
1212
describe('CLI exit value', async () => {
1313
it('should exit with code 2 when total coverage is lower than the default threshold', async () => {
1414
const {exitCode, error} = await runFlowCoverageReport([
15-
'-i', `"src/*.js"`
15+
'-i', '"src/*.js"'
1616
], {cwd: testProjectDir});
1717

1818
expect({exitCode, error}).toMatchSnapshot();
1919
});
2020

2121
it('should exit with code 2 when total coverage is lower than the custom threshold', async () => {
2222
const {exitCode, error} = await runFlowCoverageReport([
23-
'-i', `"src/*.js"`,
24-
'--threshold', '22'
23+
'-i',
24+
'"src/*.js"',
25+
'--threshold',
26+
'22'
2527
], {cwd: testProjectDir});
2628

2729
expect({exitCode, error}).toMatchSnapshot();
2830
});
2931

3032
it('should exit with code 0 when total coverage is higher than the custom threshold', async () => {
3133
const {exitCode, error} = await runFlowCoverageReport([
32-
'-i', `"src/*.js"`,
33-
'--threshold', '10'
34+
'-i',
35+
'"src/*.js"',
36+
'--threshold',
37+
'10'
3438
], {cwd: testProjectDir});
3539

3640
expect({exitCode, error}).toMatchSnapshot();

__tests__/integrations/cli/test-file-special-chars-escape.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import {
99

1010
const testProjectDir = path.join(FIXTURE_PATH, 'file-special-chars-escape');
1111

12-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; // 10 second timeout
12+
jest.setTimeout(10000); // 10 second timeout
1313

1414
test('Fixed #92 - Escape special chars in filenames', async () => {
1515
const {stdout, stderr} = await runFlowCoverageReport([
16-
'-i', `"src/*.js"`
16+
'-i', '"src/*.js"'
1717
], {cwd: testProjectDir});
1818

1919
const filteredStdout = stdout.split('\n').filter(
20-
line => line.indexOf('src/file-with-a') >= 0
20+
line => line.includes('src/file-with-a')
2121
);
2222

2323
expect({filteredStdout, stderr}).toMatchSnapshot();

__tests__/integrations/cli/test-flow-strict.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import {
99

1010
const testProjectDir = path.join(FIXTURE_PATH, 'flow-strict');
1111

12-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; // 10 second timeout
12+
jest.setTimeout(10000); // 10 second timeout
1313

1414
test('Accept \'@flow strict\' and \'@flow strict-local\' pragmas', async () => {
1515
const {stdout, stderr} = await runFlowCoverageReport([
16-
'-i', `"src/*.js"`
16+
'-i', '"src/*.js"'
1717
], {cwd: testProjectDir});
1818

19-
const filteredStdoutMain = stdout.split('\n').filter(line => line.indexOf('src/main') >= 0);
20-
const filteredStdoutLocal = stdout.split('\n').filter(line => line.indexOf('src/local') >= 0);
19+
const filteredStdoutMain = stdout.split('\n').filter(line => line.includes('src/main'));
20+
const filteredStdoutLocal = stdout.split('\n').filter(line => line.includes('src/local'));
2121

2222
expect({filteredStdoutMain, filteredStdoutLocal, stderr}).toMatchSnapshot();
2323
});

__tests__/integrations/cli/test-issue-135.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import {
99

1010
const testProjectDir = path.join(FIXTURE_PATH, 'issue-135');
1111

12-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; // 10 second timeout
12+
jest.setTimeout(10000); // 10 second timeout
1313

1414
test('Fixed #135 - Annotation wrong on multiple pragma on the same line', async () => {
1515
const {stdout, stderr} = await runFlowCoverageReport([
16-
'-i', `"src/*.js"`
16+
'-i', '"src/*.js"'
1717
], {cwd: testProjectDir});
1818

19-
const filteredStdout = stdout.split('\n').filter(line => line.indexOf('src/multiple-pragmas') >= 0);
19+
const filteredStdout = stdout.split('\n').filter(line => line.includes('src/multiple-pragmas'));
2020

2121
expect({filteredStdout, stderr}).toMatchSnapshot();
2222
});

__tests__/integrations/cli/test-percent-decimals.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ const testProjectDir = path.join(FIXTURE_PATH, 'project-decimal-coverage');
1212
describe('--percent-decimals option', () => {
1313
it('should round percent values using the requested precision', async () => {
1414
const {exitCode, error, stderr, stdout} = await runFlowCoverageReport([
15-
'--percent-decimals', '2',
16-
'-i', '"src/**.js"'
15+
'--percent-decimals',
16+
'2',
17+
'-i',
18+
'"src/**.js"'
1719
], {cwd: testProjectDir});
1820

1921
const filteredStdout = stdout.split('\n').filter(
20-
line => line.indexOf('src/main.js') >= 0 || line.indexOf('project-decimal-coverage') >= 0);
22+
line => line.includes('src/main.js') || line.includes('project-decimal-coverage'));
2123

2224
expect({exitCode, error, stderr, filteredStdout}).toMatchSnapshot();
2325
});

__tests__/integrations/cli/test-regression-issue-57.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import {
99

1010
const testProjectDir = path.join(FIXTURE_PATH, 'issue-57');
1111

12-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; // 10 second timeout
12+
jest.setTimeout(10000); // 10 second timeout
1313

1414
test('Fixed #57 - NaN in text report', async () => {
1515
const {stdout, stderr} = await runFlowCoverageReport([
16-
'-i', `"src/*.js"`
16+
'-i', '"src/*.js"'
1717
], {cwd: testProjectDir});
1818

19-
const filteredStdout = stdout.split('\n').filter(line => line.indexOf('src/url.js') >= 0);
19+
const filteredStdout = stdout.split('\n').filter(line => line.includes('src/url.js'));
2020

2121
expect({filteredStdout, stderr}).toMatchSnapshot();
2222
});

bin/flow-coverage-report.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env node
22
const path = require('path');
33

4-
require(path.join(__dirname, '../dist/lib/cli')).run(); // eslint-disable-line import/no-dynamic-require
4+
require(path.join(__dirname, '../dist/lib/cli')).run();

flow-typed/npm/glob_v7.1.x.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// flow-typed signature: 257135a98dbce29a68026e7b9b7f381d
2+
// flow-typed version: c6154227d1/glob_v7.1.x/flow_>=v0.42.x <=v0.103.x
3+
4+
declare module "glob" {
5+
declare type MinimatchOptions = {|
6+
debug?: boolean,
7+
nobrace?: boolean,
8+
noglobstar?: boolean,
9+
dot?: boolean,
10+
noext?: boolean,
11+
nocase?: boolean,
12+
nonull?: boolean,
13+
matchBase?: boolean,
14+
nocomment?: boolean,
15+
nonegate?: boolean,
16+
flipNegate?: boolean
17+
|};
18+
19+
declare type Options = {|
20+
...MinimatchOptions,
21+
cwd?: string,
22+
root?: string,
23+
nomount?: boolean,
24+
mark?: boolean,
25+
nosort?: boolean,
26+
stat?: boolean,
27+
silent?: boolean,
28+
strict?: boolean,
29+
cache?: {
30+
[path: string]: boolean | "DIR" | "FILE" | $ReadOnlyArray<string>
31+
},
32+
statCache?: {
33+
[path: string]: boolean | { isDirectory(): boolean } | void
34+
},
35+
symlinks?: { [path: string]: boolean | void },
36+
realpathCache?: { [path: string]: string },
37+
sync?: boolean,
38+
nounique?: boolean,
39+
nodir?: boolean,
40+
ignore?: string | $ReadOnlyArray<string>,
41+
follow?: boolean,
42+
realpath?: boolean,
43+
absolute?: boolean
44+
|};
45+
46+
/**
47+
* Called when an error occurs, or matches are found
48+
* err
49+
* matches: filenames found matching the pattern
50+
*/
51+
declare type CallBack = (err: ?Error, matches: Array<string>) => void;
52+
53+
declare class Glob extends events$EventEmitter {
54+
constructor(pattern: string): this;
55+
constructor(pattern: string, callback: CallBack): this;
56+
constructor(pattern: string, options: Options, callback: CallBack): this;
57+
58+
minimatch: {};
59+
options: Options;
60+
aborted: boolean;
61+
cache: {
62+
[path: string]: boolean | "DIR" | "FILE" | $ReadOnlyArray<string>
63+
};
64+
statCache: {
65+
[path: string]: boolean | { isDirectory(): boolean } | void
66+
};
67+
symlinks: { [path: string]: boolean | void };
68+
realpathCache: { [path: string]: string };
69+
found: Array<string>;
70+
71+
pause(): void;
72+
resume(): void;
73+
abort(): void;
74+
}
75+
76+
declare class GlobModule {
77+
Glob: Class<Glob>;
78+
79+
(pattern: string, callback: CallBack): void;
80+
(pattern: string, options: Options, callback: CallBack): void;
81+
82+
hasMagic(pattern: string, options?: Options): boolean;
83+
sync(pattern: string, options?: Options): Array<string>;
84+
}
85+
86+
declare module.exports: GlobModule;
87+
}

0 commit comments

Comments
 (0)