Skip to content

Commit eb6cdd2

Browse files
authored
chore: ensure consistent indentation of template strings (#14522)
1 parent 211ddcb commit eb6cdd2

File tree

17 files changed

+185
-112
lines changed

17 files changed

+185
-112
lines changed

.eslintrc.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ module.exports = {
385385
parserOptions: {
386386
sourceType: 'module',
387387
},
388-
plugins: ['import', 'jsdoc'],
388+
plugins: ['import', 'jsdoc', 'unicorn'],
389389
rules: {
390390
'accessor-pairs': ['warn', {setWithoutGet: true}],
391391
'block-scoped-var': 'off',
@@ -590,6 +590,8 @@ module.exports = {
590590
'wrap-iife': 'off',
591591
'wrap-regex': 'off',
592592
yoda: 'off',
593+
594+
'unicorn/template-indent': 'error',
593595
},
594596
settings: {
595597
'import/ignore': ['react-native'],

docs/Configuration.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,14 +1739,14 @@ test('does not show prototypes for object and array inline', () => {
17391739
array: [{hello: 'Danger'}],
17401740
};
17411741
expect(object).toMatchInlineSnapshot(`
1742-
{
1743-
"array": [
17441742
{
1745-
"hello": "Danger",
1746-
},
1747-
],
1748-
}
1749-
`);
1743+
"array": [
1744+
{
1745+
"hello": "Danger",
1746+
},
1747+
],
1748+
}
1749+
`);
17501750
});
17511751
```
17521752

docs/SnapshotTesting.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ it('renders correctly', () => {
127127
.create(<Link page="https://example.com">Example Site</Link>)
128128
.toJSON();
129129
expect(tree).toMatchInlineSnapshot(`
130-
<a
131-
className="normal"
132-
href="https://example.com"
133-
onMouseEnter={[Function]}
134-
onMouseLeave={[Function]}
135-
>
136-
Example Site
137-
</a>
138-
`);
130+
<a
131+
className="normal"
132+
href="https://example.com"
133+
onMouseEnter={[Function]}
134+
onMouseLeave={[Function]}
135+
>
136+
Example Site
137+
</a>
138+
`);
139139
});
140140
```
141141

e2e/resolve/__tests__/resolve.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ test('should throw module not found error if the module has dependencies that ca
112112
requiresUnexistingModule.js
113113
Test7.js
114114
__tests__/resolve.test.js\n
115-
`,
115+
`,
116116
}),
117117
);
118118
});

e2e/snapshot-formatting-changes/__tests__/snapshot.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ describe('snapshot serializer', () => {
1313
array: [{hello: 'Danger'}],
1414
};
1515
expect(object).toMatchInlineSnapshot(`
16-
{
17-
"array": [
18-
{
19-
"hello": "Danger",
20-
},
21-
],
22-
}
23-
`);
16+
{
17+
"array": [
18+
{
19+
"hello": "Danger",
20+
},
21+
],
22+
}
23+
`);
2424
});
2525

2626
it('uses 8 chars for indent, and shows no prototypes for object and array in a snapshot', () => {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"eslint-plugin-local": "link:./.eslintplugin",
4242
"eslint-plugin-markdown": "^3.0.0",
4343
"eslint-plugin-prettier": "^4.0.0",
44+
"eslint-plugin-unicorn": "^46.0.0",
4445
"execa": "^5.0.0",
4546
"find-process": "^1.4.1",
4647
"glob": "^10.0.0",

packages/jest-circus/src/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ export const callAsyncCircusFn = (
236236
Promise.resolve().then(() => {
237237
if (returnedValue !== undefined) {
238238
asyncError.message = dedent`
239-
Test functions cannot both take a 'done' callback and return something. Either use a 'done' callback, or return a promise.
240-
Returned value: ${prettyFormat(returnedValue, {maxDepth: 3})}
241-
`;
239+
Test functions cannot both take a 'done' callback and return something. Either use a 'done' callback, or return a promise.
240+
Returned value: ${prettyFormat(returnedValue, {maxDepth: 3})}
241+
`;
242242
return reject(asyncError);
243243
}
244244

@@ -289,9 +289,9 @@ export const callAsyncCircusFn = (
289289
reject(
290290
new Error(
291291
dedent`
292-
test functions can only return Promise or undefined.
293-
Returned value: ${prettyFormat(returnedValue, {maxDepth: 3})}
294-
`,
292+
test functions can only return Promise or undefined.
293+
Returned value: ${prettyFormat(returnedValue, {maxDepth: 3})}
294+
`,
295295
),
296296
);
297297
return;

scripts/verifyPnP.mjs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,21 @@ try {
5252
fs.writeFileSync(
5353
path.join(cwd, 'jsdom.test.js'),
5454
dedent`
55-
/*
56-
* @jest-environment jsdom
57-
*/
55+
/*
56+
* @jest-environment jsdom
57+
*/
5858
59-
test('dummy', () => {
60-
expect(window).toBeDefined();
61-
});
59+
test('dummy', () => {
60+
expect(window).toBeDefined();
61+
});
6262
`,
6363
);
6464
fs.writeFileSync(
6565
path.join(cwd, 'node.test.js'),
6666
dedent`
67-
test('dummy', () => {
68-
expect(typeof window).toBe('undefined');
69-
});
67+
test('dummy', () => {
68+
expect(typeof window).toBe('undefined');
69+
});
7070
`,
7171
);
7272
execa.sync('yarn', ['link', '--private', '--all', rootDirectory], {

website/versioned_docs/version-29.4/Configuration.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,14 +1668,14 @@ test('does not show prototypes for object and array inline', () => {
16681668
array: [{hello: 'Danger'}],
16691669
};
16701670
expect(object).toMatchInlineSnapshot(`
1671-
{
1672-
"array": [
16731671
{
1674-
"hello": "Danger",
1675-
},
1676-
],
1677-
}
1678-
`);
1672+
"array": [
1673+
{
1674+
"hello": "Danger",
1675+
},
1676+
],
1677+
}
1678+
`);
16791679
});
16801680
```
16811681

website/versioned_docs/version-29.4/SnapshotTesting.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ it('renders correctly', () => {
127127
.create(<Link page="https://example.com">Example Site</Link>)
128128
.toJSON();
129129
expect(tree).toMatchInlineSnapshot(`
130-
<a
131-
className="normal"
132-
href="https://example.com"
133-
onMouseEnter={[Function]}
134-
onMouseLeave={[Function]}
135-
>
136-
Example Site
137-
</a>
138-
`);
130+
<a
131+
className="normal"
132+
href="https://example.com"
133+
onMouseEnter={[Function]}
134+
onMouseLeave={[Function]}
135+
>
136+
Example Site
137+
</a>
138+
`);
139139
});
140140
```
141141

website/versioned_docs/version-29.5/Configuration.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,14 +1703,14 @@ test('does not show prototypes for object and array inline', () => {
17031703
array: [{hello: 'Danger'}],
17041704
};
17051705
expect(object).toMatchInlineSnapshot(`
1706-
{
1707-
"array": [
17081706
{
1709-
"hello": "Danger",
1710-
},
1711-
],
1712-
}
1713-
`);
1707+
"array": [
1708+
{
1709+
"hello": "Danger",
1710+
},
1711+
],
1712+
}
1713+
`);
17141714
});
17151715
```
17161716

website/versioned_docs/version-29.5/SnapshotTesting.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ it('renders correctly', () => {
127127
.create(<Link page="https://example.com">Example Site</Link>)
128128
.toJSON();
129129
expect(tree).toMatchInlineSnapshot(`
130-
<a
131-
className="normal"
132-
href="https://example.com"
133-
onMouseEnter={[Function]}
134-
onMouseLeave={[Function]}
135-
>
136-
Example Site
137-
</a>
138-
`);
130+
<a
131+
className="normal"
132+
href="https://example.com"
133+
onMouseEnter={[Function]}
134+
onMouseLeave={[Function]}
135+
>
136+
Example Site
137+
</a>
138+
`);
139139
});
140140
```
141141

website/versioned_docs/version-29.6/Configuration.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,14 +1739,14 @@ test('does not show prototypes for object and array inline', () => {
17391739
array: [{hello: 'Danger'}],
17401740
};
17411741
expect(object).toMatchInlineSnapshot(`
1742-
{
1743-
"array": [
17441742
{
1745-
"hello": "Danger",
1746-
},
1747-
],
1748-
}
1749-
`);
1743+
"array": [
1744+
{
1745+
"hello": "Danger",
1746+
},
1747+
],
1748+
}
1749+
`);
17501750
});
17511751
```
17521752

website/versioned_docs/version-29.6/SnapshotTesting.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ it('renders correctly', () => {
127127
.create(<Link page="https://example.com">Example Site</Link>)
128128
.toJSON();
129129
expect(tree).toMatchInlineSnapshot(`
130-
<a
131-
className="normal"
132-
href="https://example.com"
133-
onMouseEnter={[Function]}
134-
onMouseLeave={[Function]}
135-
>
136-
Example Site
137-
</a>
138-
`);
130+
<a
131+
className="normal"
132+
href="https://example.com"
133+
onMouseEnter={[Function]}
134+
onMouseLeave={[Function]}
135+
>
136+
Example Site
137+
</a>
138+
`);
139139
});
140140
```
141141

website/versioned_docs/version-29.7/Configuration.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,14 +1739,14 @@ test('does not show prototypes for object and array inline', () => {
17391739
array: [{hello: 'Danger'}],
17401740
};
17411741
expect(object).toMatchInlineSnapshot(`
1742-
{
1743-
"array": [
17441742
{
1745-
"hello": "Danger",
1746-
},
1747-
],
1748-
}
1749-
`);
1743+
"array": [
1744+
{
1745+
"hello": "Danger",
1746+
},
1747+
],
1748+
}
1749+
`);
17501750
});
17511751
```
17521752

website/versioned_docs/version-29.7/SnapshotTesting.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ it('renders correctly', () => {
127127
.create(<Link page="https://example.com">Example Site</Link>)
128128
.toJSON();
129129
expect(tree).toMatchInlineSnapshot(`
130-
<a
131-
className="normal"
132-
href="https://example.com"
133-
onMouseEnter={[Function]}
134-
onMouseLeave={[Function]}
135-
>
136-
Example Site
137-
</a>
138-
`);
130+
<a
131+
className="normal"
132+
href="https://example.com"
133+
onMouseEnter={[Function]}
134+
onMouseLeave={[Function]}
135+
>
136+
Example Site
137+
</a>
138+
`);
139139
});
140140
```
141141

0 commit comments

Comments
 (0)