Skip to content

Commit

Permalink
chore: ensure consistent indentation of template strings (#14522)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Sep 14, 2023
1 parent 211ddcb commit eb6cdd2
Show file tree
Hide file tree
Showing 17 changed files with 185 additions and 112 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.cjs
Expand Up @@ -385,7 +385,7 @@ module.exports = {
parserOptions: {
sourceType: 'module',
},
plugins: ['import', 'jsdoc'],
plugins: ['import', 'jsdoc', 'unicorn'],
rules: {
'accessor-pairs': ['warn', {setWithoutGet: true}],
'block-scoped-var': 'off',
Expand Down Expand Up @@ -590,6 +590,8 @@ module.exports = {
'wrap-iife': 'off',
'wrap-regex': 'off',
yoda: 'off',

'unicorn/template-indent': 'error',
},
settings: {
'import/ignore': ['react-native'],
Expand Down
14 changes: 7 additions & 7 deletions docs/Configuration.md
Expand Up @@ -1739,14 +1739,14 @@ test('does not show prototypes for object and array inline', () => {
array: [{hello: 'Danger'}],
};
expect(object).toMatchInlineSnapshot(`
{
"array": [
{
"hello": "Danger",
},
],
}
`);
"array": [
{
"hello": "Danger",
},
],
}
`);
});
```

Expand Down
18 changes: 9 additions & 9 deletions docs/SnapshotTesting.md
Expand Up @@ -127,15 +127,15 @@ it('renders correctly', () => {
.create(<Link page="https://example.com">Example Site</Link>)
.toJSON();
expect(tree).toMatchInlineSnapshot(`
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
});
```

Expand Down
2 changes: 1 addition & 1 deletion e2e/resolve/__tests__/resolve.test.js
Expand Up @@ -112,7 +112,7 @@ test('should throw module not found error if the module has dependencies that ca
requiresUnexistingModule.js
Test7.js
__tests__/resolve.test.js\n
`,
`,
}),
);
});
Expand Down
16 changes: 8 additions & 8 deletions e2e/snapshot-formatting-changes/__tests__/snapshot.test.js
Expand Up @@ -13,14 +13,14 @@ describe('snapshot serializer', () => {
array: [{hello: 'Danger'}],
};
expect(object).toMatchInlineSnapshot(`
{
"array": [
{
"hello": "Danger",
},
],
}
`);
{
"array": [
{
"hello": "Danger",
},
],
}
`);
});

it('uses 8 chars for indent, and shows no prototypes for object and array in a snapshot', () => {
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -41,6 +41,7 @@
"eslint-plugin-local": "link:./.eslintplugin",
"eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-unicorn": "^46.0.0",
"execa": "^5.0.0",
"find-process": "^1.4.1",
"glob": "^10.0.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/jest-circus/src/utils.ts
Expand Up @@ -236,9 +236,9 @@ export const callAsyncCircusFn = (
Promise.resolve().then(() => {
if (returnedValue !== undefined) {
asyncError.message = dedent`
Test functions cannot both take a 'done' callback and return something. Either use a 'done' callback, or return a promise.
Returned value: ${prettyFormat(returnedValue, {maxDepth: 3})}
`;
Test functions cannot both take a 'done' callback and return something. Either use a 'done' callback, or return a promise.
Returned value: ${prettyFormat(returnedValue, {maxDepth: 3})}
`;
return reject(asyncError);
}

Expand Down Expand Up @@ -289,9 +289,9 @@ export const callAsyncCircusFn = (
reject(
new Error(
dedent`
test functions can only return Promise or undefined.
Returned value: ${prettyFormat(returnedValue, {maxDepth: 3})}
`,
test functions can only return Promise or undefined.
Returned value: ${prettyFormat(returnedValue, {maxDepth: 3})}
`,
),
);
return;
Expand Down
18 changes: 9 additions & 9 deletions scripts/verifyPnP.mjs
Expand Up @@ -52,21 +52,21 @@ try {
fs.writeFileSync(
path.join(cwd, 'jsdom.test.js'),
dedent`
/*
* @jest-environment jsdom
*/
/*
* @jest-environment jsdom
*/
test('dummy', () => {
expect(window).toBeDefined();
});
test('dummy', () => {
expect(window).toBeDefined();
});
`,
);
fs.writeFileSync(
path.join(cwd, 'node.test.js'),
dedent`
test('dummy', () => {
expect(typeof window).toBe('undefined');
});
test('dummy', () => {
expect(typeof window).toBe('undefined');
});
`,
);
execa.sync('yarn', ['link', '--private', '--all', rootDirectory], {
Expand Down
14 changes: 7 additions & 7 deletions website/versioned_docs/version-29.4/Configuration.md
Expand Up @@ -1668,14 +1668,14 @@ test('does not show prototypes for object and array inline', () => {
array: [{hello: 'Danger'}],
};
expect(object).toMatchInlineSnapshot(`
{
"array": [
{
"hello": "Danger",
},
],
}
`);
"array": [
{
"hello": "Danger",
},
],
}
`);
});
```

Expand Down
18 changes: 9 additions & 9 deletions website/versioned_docs/version-29.4/SnapshotTesting.md
Expand Up @@ -127,15 +127,15 @@ it('renders correctly', () => {
.create(<Link page="https://example.com">Example Site</Link>)
.toJSON();
expect(tree).toMatchInlineSnapshot(`
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
});
```

Expand Down
14 changes: 7 additions & 7 deletions website/versioned_docs/version-29.5/Configuration.md
Expand Up @@ -1703,14 +1703,14 @@ test('does not show prototypes for object and array inline', () => {
array: [{hello: 'Danger'}],
};
expect(object).toMatchInlineSnapshot(`
{
"array": [
{
"hello": "Danger",
},
],
}
`);
"array": [
{
"hello": "Danger",
},
],
}
`);
});
```

Expand Down
18 changes: 9 additions & 9 deletions website/versioned_docs/version-29.5/SnapshotTesting.md
Expand Up @@ -127,15 +127,15 @@ it('renders correctly', () => {
.create(<Link page="https://example.com">Example Site</Link>)
.toJSON();
expect(tree).toMatchInlineSnapshot(`
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
});
```

Expand Down
14 changes: 7 additions & 7 deletions website/versioned_docs/version-29.6/Configuration.md
Expand Up @@ -1739,14 +1739,14 @@ test('does not show prototypes for object and array inline', () => {
array: [{hello: 'Danger'}],
};
expect(object).toMatchInlineSnapshot(`
{
"array": [
{
"hello": "Danger",
},
],
}
`);
"array": [
{
"hello": "Danger",
},
],
}
`);
});
```

Expand Down
18 changes: 9 additions & 9 deletions website/versioned_docs/version-29.6/SnapshotTesting.md
Expand Up @@ -127,15 +127,15 @@ it('renders correctly', () => {
.create(<Link page="https://example.com">Example Site</Link>)
.toJSON();
expect(tree).toMatchInlineSnapshot(`
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
});
```

Expand Down
14 changes: 7 additions & 7 deletions website/versioned_docs/version-29.7/Configuration.md
Expand Up @@ -1739,14 +1739,14 @@ test('does not show prototypes for object and array inline', () => {
array: [{hello: 'Danger'}],
};
expect(object).toMatchInlineSnapshot(`
{
"array": [
{
"hello": "Danger",
},
],
}
`);
"array": [
{
"hello": "Danger",
},
],
}
`);
});
```

Expand Down
18 changes: 9 additions & 9 deletions website/versioned_docs/version-29.7/SnapshotTesting.md
Expand Up @@ -127,15 +127,15 @@ it('renders correctly', () => {
.create(<Link page="https://example.com">Example Site</Link>)
.toJSON();
expect(tree).toMatchInlineSnapshot(`
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
});
```

Expand Down

0 comments on commit eb6cdd2

Please sign in to comment.