Skip to content

Commit 0ec9949

Browse files
committed
style: format with prettier properly
Apparently the regexp for formatting the files within npm command must be passed with double quotes. More details here: https://dev.to/gruckion/comment/b665
1 parent f35e95f commit 0ec9949

File tree

6 files changed

+39
-39
lines changed

6 files changed

+39
-39
lines changed

lib/node-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function isImportSpecifier(
4040
export function isImportNamespaceSpecifier(
4141
node: TSESTree.Node
4242
): node is TSESTree.ImportNamespaceSpecifier {
43-
return node?.type === AST_NODE_TYPES.ImportNamespaceSpecifier
43+
return node?.type === AST_NODE_TYPES.ImportNamespaceSpecifier;
4444
}
4545

4646
export function isImportDefaultSpecifier(
@@ -145,7 +145,7 @@ export function isReturnStatement(
145145
export function isArrayExpression(
146146
node: TSESTree.Node
147147
): node is TSESTree.ArrayExpression {
148-
return node?.type === AST_NODE_TYPES.ArrayExpression
148+
return node?.type === AST_NODE_TYPES.ArrayExpression;
149149
}
150150

151151
export function isAwaited(node: TSESTree.Node): boolean {

lib/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,5 @@ export {
128128
METHODS_RETURNING_NODES,
129129
ALL_RETURNING_NODES,
130130
PRESENCE_MATCHERS,
131-
ABSENCE_MATCHERS
131+
ABSENCE_MATCHERS,
132132
};

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"postbuild": "cpy README.md ./dist && cpy package.json ./dist && cpy LICENSE ./dist",
3030
"lint": "eslint . --ext .js,.ts",
3131
"lint:fix": "npm run lint -- --fix",
32-
"format": "prettier --write README.md {lib,docs,tests}/**/*.{js,ts,md}",
33-
"format:check": "prettier --check README.md {lib,docs,tests}/**/*.{js,json,yml,ts,md}",
32+
"format": "prettier --write README.md \"{lib,docs,tests}/**/*.{js,ts,md}\"",
33+
"format:check": "prettier --check README.md \"{lib,docs,tests}/**/*.{js,json,yml,ts,md}\"",
3434
"test:local": "jest",
3535
"test:ci": "jest --coverage",
3636
"test:update": "npm run test:local -- --u",

tests/lib/rules/await-async-utils.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ ruleTester.run(RULE_NAME, rule, {
120120
});
121121
`,
122122
})),
123-
...ASYNC_UTILS.map(asyncUtil => ({
123+
...ASYNC_UTILS.map((asyncUtil) => ({
124124
code: `
125125
import { ${asyncUtil} } from '@testing-library/dom';
126126
test('${asyncUtil} util used in with Promise.all() does not trigger an error', async () => {
@@ -131,7 +131,7 @@ ruleTester.run(RULE_NAME, rule, {
131131
});
132132
`,
133133
})),
134-
...ASYNC_UTILS.map(asyncUtil => ({
134+
...ASYNC_UTILS.map((asyncUtil) => ({
135135
code: `
136136
import { ${asyncUtil} } from '@testing-library/dom';
137137
test('${asyncUtil} util used in with Promise.all() with an await does not trigger an error', async () => {
@@ -142,7 +142,7 @@ ruleTester.run(RULE_NAME, rule, {
142142
});
143143
`,
144144
})),
145-
...ASYNC_UTILS.map(asyncUtil => ({
145+
...ASYNC_UTILS.map((asyncUtil) => ({
146146
code: `
147147
import { ${asyncUtil} } from '@testing-library/dom';
148148
test('${asyncUtil} util used in with Promise.all() with ".then" does not trigger an error', async () => {
@@ -162,7 +162,7 @@ ruleTester.run(RULE_NAME, rule, {
162162
waitForElementToBeRemoved(() => document.querySelector('div.getOuttaHere')),
163163
])
164164
});
165-
`
165+
`,
166166
},
167167
{
168168
code: `
@@ -191,8 +191,8 @@ ruleTester.run(RULE_NAME, rule, {
191191
await foo().then(() => baz())
192192
])
193193
})
194-
`
195-
}
194+
`,
195+
},
196196
],
197197
invalid: [
198198
...ASYNC_UTILS.map((asyncUtil) => ({

tests/lib/rules/no-wait-for-snapshot.test.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const ruleTester = createRuleTester();
66

77
ruleTester.run(RULE_NAME, rule, {
88
valid: [
9-
...ASYNC_UTILS.map(asyncUtil => ({
9+
...ASYNC_UTILS.map((asyncUtil) => ({
1010
code: `
1111
import { ${asyncUtil} } from '@testing-library/dom';
1212
test('snapshot calls outside of ${asyncUtil} are valid', () => {
@@ -16,7 +16,7 @@ ruleTester.run(RULE_NAME, rule, {
1616
})
1717
`,
1818
})),
19-
...ASYNC_UTILS.map(asyncUtil => ({
19+
...ASYNC_UTILS.map((asyncUtil) => ({
2020
code: `
2121
import { ${asyncUtil} } from '@testing-library/dom';
2222
test('snapshot calls outside of ${asyncUtil} are valid', () => {
@@ -28,7 +28,7 @@ ruleTester.run(RULE_NAME, rule, {
2828
})
2929
`,
3030
})),
31-
...ASYNC_UTILS.map(asyncUtil => ({
31+
...ASYNC_UTILS.map((asyncUtil) => ({
3232
code: `
3333
import * as asyncUtils from '@testing-library/dom';
3434
test('snapshot calls outside of ${asyncUtil} are valid', () => {
@@ -38,7 +38,7 @@ ruleTester.run(RULE_NAME, rule, {
3838
})
3939
`,
4040
})),
41-
...ASYNC_UTILS.map(asyncUtil => ({
41+
...ASYNC_UTILS.map((asyncUtil) => ({
4242
code: `
4343
import * as asyncUtils from '@testing-library/dom';
4444
test('snapshot calls outside of ${asyncUtil} are valid', () => {
@@ -50,15 +50,15 @@ ruleTester.run(RULE_NAME, rule, {
5050
})
5151
`,
5252
})),
53-
...ASYNC_UTILS.map(asyncUtil => ({
53+
...ASYNC_UTILS.map((asyncUtil) => ({
5454
code: `
5555
import { ${asyncUtil} } from 'some-other-library';
5656
test('snapshot calls within ${asyncUtil} are not valid', async () => {
5757
await ${asyncUtil}(() => expect(foo).toMatchSnapshot());
5858
});
5959
`,
6060
})),
61-
...ASYNC_UTILS.map(asyncUtil => ({
61+
...ASYNC_UTILS.map((asyncUtil) => ({
6262
code: `
6363
import { ${asyncUtil} } from 'some-other-library';
6464
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -68,15 +68,15 @@ ruleTester.run(RULE_NAME, rule, {
6868
});
6969
`,
7070
})),
71-
...ASYNC_UTILS.map(asyncUtil => ({
71+
...ASYNC_UTILS.map((asyncUtil) => ({
7272
code: `
7373
import * as asyncUtils from 'some-other-library';
7474
test('snapshot calls within ${asyncUtil} are not valid', async () => {
7575
await asyncUtils.${asyncUtil}(() => expect(foo).toMatchSnapshot());
7676
});
7777
`,
7878
})),
79-
...ASYNC_UTILS.map(asyncUtil => ({
79+
...ASYNC_UTILS.map((asyncUtil) => ({
8080
code: `
8181
import * as asyncUtils from 'some-other-library';
8282
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -86,15 +86,15 @@ ruleTester.run(RULE_NAME, rule, {
8686
});
8787
`,
8888
})),
89-
...ASYNC_UTILS.map(asyncUtil => ({
89+
...ASYNC_UTILS.map((asyncUtil) => ({
9090
code: `
9191
import { ${asyncUtil} } from 'some-other-library';
9292
test('snapshot calls within ${asyncUtil} are not valid', async () => {
9393
await ${asyncUtil}(() => expect(foo).toMatchInlineSnapshot());
9494
});
9595
`,
9696
})),
97-
...ASYNC_UTILS.map(asyncUtil => ({
97+
...ASYNC_UTILS.map((asyncUtil) => ({
9898
code: `
9999
import { ${asyncUtil} } from 'some-other-library';
100100
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -104,15 +104,15 @@ ruleTester.run(RULE_NAME, rule, {
104104
});
105105
`,
106106
})),
107-
...ASYNC_UTILS.map(asyncUtil => ({
107+
...ASYNC_UTILS.map((asyncUtil) => ({
108108
code: `
109109
import * as asyncUtils from 'some-other-library';
110110
test('snapshot calls within ${asyncUtil} are not valid', async () => {
111111
await asyncUtils.${asyncUtil}(() => expect(foo).toMatchInlineSnapshot());
112112
});
113113
`,
114114
})),
115-
...ASYNC_UTILS.map(asyncUtil => ({
115+
...ASYNC_UTILS.map((asyncUtil) => ({
116116
code: `
117117
import * as asyncUtils from 'some-other-library';
118118
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -124,7 +124,7 @@ ruleTester.run(RULE_NAME, rule, {
124124
})),
125125
],
126126
invalid: [
127-
...ASYNC_UTILS.map(asyncUtil => ({
127+
...ASYNC_UTILS.map((asyncUtil) => ({
128128
code: `
129129
import { ${asyncUtil} } from '@testing-library/dom';
130130
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -133,7 +133,7 @@ ruleTester.run(RULE_NAME, rule, {
133133
`,
134134
errors: [{ line: 4, messageId: 'noWaitForSnapshot' }],
135135
})),
136-
...ASYNC_UTILS.map(asyncUtil => ({
136+
...ASYNC_UTILS.map((asyncUtil) => ({
137137
code: `
138138
import { ${asyncUtil} } from '@testing-library/dom';
139139
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -144,7 +144,7 @@ ruleTester.run(RULE_NAME, rule, {
144144
`,
145145
errors: [{ line: 5, messageId: 'noWaitForSnapshot' }],
146146
})),
147-
...ASYNC_UTILS.map(asyncUtil => ({
147+
...ASYNC_UTILS.map((asyncUtil) => ({
148148
code: `
149149
import * as asyncUtils from '@testing-library/dom';
150150
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -153,7 +153,7 @@ ruleTester.run(RULE_NAME, rule, {
153153
`,
154154
errors: [{ line: 4, messageId: 'noWaitForSnapshot' }],
155155
})),
156-
...ASYNC_UTILS.map(asyncUtil => ({
156+
...ASYNC_UTILS.map((asyncUtil) => ({
157157
code: `
158158
import * as asyncUtils from '@testing-library/dom';
159159
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -164,7 +164,7 @@ ruleTester.run(RULE_NAME, rule, {
164164
`,
165165
errors: [{ line: 5, messageId: 'noWaitForSnapshot' }],
166166
})),
167-
...ASYNC_UTILS.map(asyncUtil => ({
167+
...ASYNC_UTILS.map((asyncUtil) => ({
168168
code: `
169169
import { ${asyncUtil} } from '@testing-library/dom';
170170
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -173,7 +173,7 @@ ruleTester.run(RULE_NAME, rule, {
173173
`,
174174
errors: [{ line: 4, messageId: 'noWaitForSnapshot' }],
175175
})),
176-
...ASYNC_UTILS.map(asyncUtil => ({
176+
...ASYNC_UTILS.map((asyncUtil) => ({
177177
code: `
178178
import { ${asyncUtil} } from '@testing-library/dom';
179179
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -184,7 +184,7 @@ ruleTester.run(RULE_NAME, rule, {
184184
`,
185185
errors: [{ line: 5, messageId: 'noWaitForSnapshot' }],
186186
})),
187-
...ASYNC_UTILS.map(asyncUtil => ({
187+
...ASYNC_UTILS.map((asyncUtil) => ({
188188
code: `
189189
import * as asyncUtils from '@testing-library/dom';
190190
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -193,7 +193,7 @@ ruleTester.run(RULE_NAME, rule, {
193193
`,
194194
errors: [{ line: 4, messageId: 'noWaitForSnapshot' }],
195195
})),
196-
...ASYNC_UTILS.map(asyncUtil => ({
196+
...ASYNC_UTILS.map((asyncUtil) => ({
197197
code: `
198198
import * as asyncUtils from '@testing-library/dom';
199199
test('snapshot calls within ${asyncUtil} are not valid', async () => {

tests/lib/rules/prefer-find-by.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function createScenario<
3030
return WAIT_METHODS.reduce(
3131
(acc: T[], waitMethod) =>
3232
acc.concat(
33-
SYNC_QUERIES_COMBINATIONS.map(queryMethod =>
33+
SYNC_QUERIES_COMBINATIONS.map((queryMethod) =>
3434
callback(waitMethod, queryMethod)
3535
)
3636
),
@@ -40,19 +40,19 @@ function createScenario<
4040

4141
ruleTester.run(RULE_NAME, rule, {
4242
valid: [
43-
...ASYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
43+
...ASYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
4444
code: `
4545
const { ${queryMethod} } = setup()
4646
const submitButton = await ${queryMethod}('foo')
4747
`,
4848
})),
49-
...ASYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
49+
...ASYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
5050
code: `const submitButton = await screen.${queryMethod}('foo')`,
5151
})),
52-
...SYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
52+
...SYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
5353
code: `await waitForElementToBeRemoved(() => ${queryMethod}(baz))`,
5454
})),
55-
...SYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
55+
...SYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
5656
code: `await waitFor(function() {
5757
return ${queryMethod}('baz', { name: 'foo' })
5858
})`,
@@ -66,20 +66,20 @@ ruleTester.run(RULE_NAME, rule, {
6666
{
6767
code: `await waitForElementToBeRemoved(document.querySelector('foo'))`,
6868
},
69-
...SYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
69+
...SYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
7070
code: `
7171
await waitFor(() => {
7272
foo()
7373
return ${queryMethod}()
7474
})
7575
`,
7676
})),
77-
...SYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
77+
...SYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
7878
code: `
7979
await waitFor(() => expect(screen.${queryMethod}('baz')).toBeDisabled());
8080
`,
8181
})),
82-
...SYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
82+
...SYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
8383
code: `
8484
await waitFor(() => expect(${queryMethod}('baz')).toBeInTheDocument());
8585
`,

0 commit comments

Comments
 (0)