Skip to content

Commit 0cb03f6

Browse files
SimenBcpojer
authored andcommitted
Upgrade to prettier 1.6 (#4426)
1 parent 1517391 commit 0cb03f6

39 files changed

Lines changed: 225 additions & 241 deletions

File tree

examples/react-native/__tests__/intro.test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ it('renders the ListView component', () => {
5151
.create(
5252
<ListView
5353
dataSource={dataSource}
54-
renderRow={rowData =>
55-
<Text>
56-
{rowData}
57-
</Text>}
54+
renderRow={rowData => <Text>{rowData}</Text>}
5855
/>
5956
)
6057
.toJSON();

examples/snapshot/Clock.react.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ export default class Clock extends React.Component {
2525

2626
render() {
2727
return (
28-
<p>
29-
{this.state.seconds} seconds have ellapsed since the UNIX epoch.
30-
</p>
28+
<p>{this.state.seconds} seconds have ellapsed since the UNIX epoch.</p>
3129
);
3230
}
3331
}

examples/snapshot/__tests__/link.react.test.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ it('renders as an anchor when no page is set', () => {
2121

2222
it('properly escapes quotes', () => {
2323
const tree = renderer
24-
.create(
25-
<Link>
26-
{"\"Facebook\" \\'is \\ 'awesome'"}
27-
</Link>
28-
)
24+
.create(<Link>{"\"Facebook\" \\'is \\ 'awesome'"}</Link>)
2925
.toJSON();
3026
expect(tree).toMatchSnapshot();
3127
});

integration_tests/__tests__/env.test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111

1212
const runJest = require('../runJest');
1313

14-
const getLog = result => result.stdout.toString().split('\n')[1].trim();
14+
const getLog = result =>
15+
result.stdout
16+
.toString()
17+
.split('\n')[1]
18+
.trim();
1519

1620
describe('Environment override', () => {
1721
it('uses jsdom when specified', () => {

integration_tests/__tests__/jest_changed_files.test.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ test('gets changed files for git', async () => {
148148

149149
let {changedFiles: files} = await getChangedFilesForRoots(roots, {});
150150
expect(
151-
Array.from(files).map(filePath => path.basename(filePath)).sort(),
151+
Array.from(files)
152+
.map(filePath => path.basename(filePath))
153+
.sort(),
152154
).toEqual(['file1.txt', 'file2.txt', 'file3.txt']);
153155

154156
run(`${GIT} add .`, DIR);
@@ -161,7 +163,9 @@ test('gets changed files for git', async () => {
161163
lastCommit: true,
162164
}));
163165
expect(
164-
Array.from(files).map(filePath => path.basename(filePath)).sort(),
166+
Array.from(files)
167+
.map(filePath => path.basename(filePath))
168+
.sort(),
165169
).toEqual(['file1.txt', 'file2.txt', 'file3.txt']);
166170

167171
writeFiles(DIR, {
@@ -170,7 +174,9 @@ test('gets changed files for git', async () => {
170174

171175
({changedFiles: files} = await getChangedFilesForRoots(roots, {}));
172176
expect(
173-
Array.from(files).map(filePath => path.basename(filePath)).sort(),
177+
Array.from(files)
178+
.map(filePath => path.basename(filePath))
179+
.sort(),
174180
).toEqual(['file1.txt']);
175181
});
176182

@@ -198,7 +204,9 @@ test('gets changed files for hg', async () => {
198204

199205
let {changedFiles: files} = await getChangedFilesForRoots(roots, {});
200206
expect(
201-
Array.from(files).map(filePath => path.basename(filePath)).sort(),
207+
Array.from(files)
208+
.map(filePath => path.basename(filePath))
209+
.sort(),
202210
).toEqual(['file1.txt', 'file2.txt', 'file3.txt']);
203211

204212
run(`${HG} add .`, DIR);
@@ -211,7 +219,9 @@ test('gets changed files for hg', async () => {
211219
lastCommit: true,
212220
}));
213221
expect(
214-
Array.from(files).map(filePath => path.basename(filePath)).sort(),
222+
Array.from(files)
223+
.map(filePath => path.basename(filePath))
224+
.sort(),
215225
).toEqual(['file1.txt', 'file2.txt', 'file3.txt']);
216226

217227
writeFiles(DIR, {
@@ -220,7 +230,9 @@ test('gets changed files for hg', async () => {
220230

221231
({changedFiles: files} = await getChangedFilesForRoots(roots, {}));
222232
expect(
223-
Array.from(files).map(filePath => path.basename(filePath)).sort(),
233+
Array.from(files)
234+
.map(filePath => path.basename(filePath))
235+
.sort(),
224236
).toEqual(['file1.txt']);
225237

226238
run(`${HG} commit -m "test2"`, DIR);
@@ -234,6 +246,8 @@ test('gets changed files for hg', async () => {
234246
}));
235247
// Returns files from current uncommited state + the last commit
236248
expect(
237-
Array.from(files).map(filePath => path.basename(filePath)).sort(),
249+
Array.from(files)
250+
.map(filePath => path.basename(filePath))
251+
.sort(),
238252
).toEqual(['file1.txt', 'file4.txt']);
239253
});

integration_tests/__tests__/list_tests.test.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ describe('--listTests flag', () => {
2727

2828
expect(status).toBe(0);
2929
expect(
30-
normalizePaths(stdout).split('\n').sort().join('\n'),
30+
normalizePaths(stdout)
31+
.split('\n')
32+
.sort()
33+
.join('\n'),
3134
).toMatchSnapshot();
3235
});
3336

@@ -37,7 +40,11 @@ describe('--listTests flag', () => {
3740
expect(status).toBe(0);
3841
expect(() => JSON.parse(stdout)).not.toThrow();
3942
expect(
40-
JSON.stringify(JSON.parse(stdout).map(normalizePaths).sort()),
43+
JSON.stringify(
44+
JSON.parse(stdout)
45+
.map(normalizePaths)
46+
.sort(),
47+
),
4148
).toMatchSnapshot();
4249
});
4350
});

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
"debug": "^2.6.8",
2626
"enzyme": "^2.8.2",
2727
"eslint": "^4.2.0",
28-
"eslint-config-prettier": "^2.3.0",
28+
"eslint-config-prettier": "^2.4.0",
2929
"eslint-plugin-babel": "^4.1.1",
3030
"eslint-plugin-flowtype": "^2.35.0",
3131
"eslint-plugin-import": "^2.6.0",
3232
"eslint-plugin-jest": "^21.0.0",
3333
"eslint-plugin-jsx-a11y": "^6.0.2",
3434
"eslint-plugin-markdown": "^1.0.0-beta.6",
35-
"eslint-plugin-prettier": "^2.1.2",
35+
"eslint-plugin-prettier": "^2.2.0",
3636
"eslint-plugin-react": "^7.1.0",
3737
"eslint-plugin-relay": "0.0.8",
3838
"eslint-plugin-unicorn": "^2.1.2",
@@ -55,7 +55,7 @@
5555
"mkdirp": "^0.5.1",
5656
"mocha": "^3.4.2",
5757
"mock-fs": "^4.4.1",
58-
"prettier": "^1.5.2",
58+
"prettier": "^1.6.1",
5959
"progress": "^1.1.8",
6060
"react": "^15.4.2",
6161
"react-addons-test-utils": "15.4.2",

packages/jest-circus/src/legacy_code_todo_rewrite/jest_adapter_init.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ const initialize = ({
4343

4444
// Jest tests snapshotSerializers in order preceding built-in serializers.
4545
// Therefore, add in reverse because the last added is the first tested.
46-
config.snapshotSerializers.concat().reverse().forEach(path => {
47-
addSerializer(localRequire(path));
48-
});
46+
config.snapshotSerializers
47+
.concat()
48+
.reverse()
49+
.forEach(path => {
50+
addSerializer(localRequire(path));
51+
});
4952

5053
const {expand, updateSnapshot} = globalConfig;
5154
const snapshotState = new SnapshotState(testPath, {expand, updateSnapshot});

packages/jest-cli/src/__tests__/watch_filename_pattern_mode.test.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@ describe('Watch mode flows', () => {
201201
stdin.emit(KEYS.P);
202202
expect(pipe.write.mock.calls.join('\n')).toMatchSnapshot();
203203

204-
['p'].map(toHex).concat(KEYS.ENTER).forEach(key => stdin.emit(key));
204+
['p']
205+
.map(toHex)
206+
.concat(KEYS.ENTER)
207+
.forEach(key => stdin.emit(key));
205208

206209
pipe.write.mockReset();
207210
stdin.emit(KEYS.P);
@@ -223,7 +226,10 @@ describe('Watch mode flows', () => {
223226
stdin.emit(KEYS.T);
224227
expect(pipe.write.mock.calls.join('\n')).toMatchSnapshot();
225228

226-
['t'].map(toHex).concat(KEYS.ENTER).forEach(key => stdin.emit(key));
229+
['t']
230+
.map(toHex)
231+
.concat(KEYS.ENTER)
232+
.forEach(key => stdin.emit(key));
227233

228234
pipe.write.mockReset();
229235
stdin.emit(KEYS.T);

packages/jest-cli/src/reporters/coverage_reporter.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ class CoverageReporter extends BaseReporter {
202202
}
203203
};
204204

205-
return Promise.all(instrumentation).then(cleanup).catch(cleanup);
205+
return Promise.all(instrumentation)
206+
.then(cleanup)
207+
.catch(cleanup);
206208
}
207209

208210
_checkThreshold(globalConfig: GlobalConfig, map: CoverageMap) {

0 commit comments

Comments
 (0)