Skip to content

Commit 9c2072d

Browse files
chore: update dependencies + run prettier on codebase (#234)
BREAKING CHANGE: Minimum node version required is v10.22.1 BREAKING CHANGE: Minimum ESLint version required is 7.5.0. Support for ESLint between v5 and v7.4 has been dropped
1 parent 4b7300e commit 9c2072d

Some content is hidden

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

43 files changed

+235
-230
lines changed

.prettierrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
singleQuote: true,
3+
};

.prettierrc.json

-4
This file was deleted.

.travis.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ env:
44
global:
55
- FORCE_COLOR=true
66
matrix:
7-
- ESLINT=5
8-
- ESLINT=6
7+
- ESLINT=7.5
98
- ESLINT=7
109

1110
node_js:
12-
- 10.12
11+
- 10.22.1
1312
- 10
1413
- 12.0
1514
- 12

CODE_OF_CONDUCT.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
3333

3434
## Our Responsibilities
3535

docs/rules/await-async-utils.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ test('something correctly', async () => {
5454
// `then` chained method is correct
5555
waitFor(() => {}, { timeout: 100 })
5656
.then(() => console.log('DOM changed!'))
57-
.catch(err => console.log(`Error you need to deal with: ${err}`));
57+
.catch((err) => console.log(`Error you need to deal with: ${err}`));
5858

5959
// return the promise within a function is correct too!
6060
const makeCustomWait = () =>

docs/rules/consistent-data-testid.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ Ensure `data-testid` values match a provided regex. This rule is un-opinionated,
99
Examples of **incorrect** code for this rule:
1010

1111
```js
12-
const foo = props => <div data-testid="my-test-id">...</div>;
13-
const foo = props => <div data-testid="myTestId">...</div>;
14-
const foo = props => <div data-testid="TestIdEXAMPLE">...</div>;
12+
const foo = (props) => <div data-testid="my-test-id">...</div>;
13+
const foo = (props) => <div data-testid="myTestId">...</div>;
14+
const foo = (props) => <div data-testid="TestIdEXAMPLE">...</div>;
1515
```
1616

1717
Examples of **correct** code for this rule:
1818

1919
```js
20-
const foo = props => <div data-testid="TestId__EXAMPLE">...</div>;
21-
const bar = props => <div data-testid="TestId">...</div>;
22-
const baz = props => <div>...</div>;
20+
const foo = (props) => <div data-testid="TestId__EXAMPLE">...</div>;
21+
const bar = (props) => <div data-testid="TestId">...</div>;
22+
const baz = (props) => <div>...</div>;
2323
```
2424

2525
## Options

docs/rules/no-multiple-assertions-wait-for.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const foo = async () => {
1717
});
1818

1919
// or
20-
await waitFor(function() {
20+
await waitFor(function () {
2121
expect(a).toEqual('a');
2222
expect(b).toEqual('b');
2323
});
@@ -32,7 +32,7 @@ const foo = async () => {
3232
expect(b).toEqual('b');
3333

3434
// or
35-
await waitFor(function() {
35+
await waitFor(function () {
3636
expect(a).toEqual('a');
3737
});
3838
expect(b).toEqual('b');

docs/rules/no-wait-for-empty-callback.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ Examples of **incorrect** code for this rule:
1111
```js
1212
const foo = async () => {
1313
await waitFor(() => {});
14-
await waitFor(function() {});
14+
await waitFor(function () {});
1515
await waitFor(noop);
1616

1717
await waitForElementToBeRemoved(() => {});
18-
await waitForElementToBeRemoved(function() {});
18+
await waitForElementToBeRemoved(function () {});
1919
await waitForElementToBeRemoved(noop);
2020
};
2121
```

docs/rules/prefer-find-by.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ await waitForElementToBeRemoved(() => queryAllByLabel('my label'));
4141
await waitForElementToBeRemoved(document.querySelector('foo'));
4242

4343
// using waitFor with a function
44-
await waitFor(function() {
44+
await waitFor(function () {
4545
foo();
4646
return getByText('name');
4747
});

lib/node-utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export function isRenderFunction(
173173
): boolean {
174174
// returns true for `render` and e.g. `customRenderFn`
175175
// as well as `someLib.render` and `someUtils.customRenderFn`
176-
return renderFunctions.some(name => {
176+
return renderFunctions.some((name) => {
177177
return (
178178
(isIdentifier(callNode.callee) && name === callNode.callee.name) ||
179179
(isMemberExpression(callNode.callee) &&

lib/rules/await-async-utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
7373
});
7474
},
7575
'Program:exit'() {
76-
const testingLibraryUtilUsage = asyncUtilsUsage.filter(usage => {
76+
const testingLibraryUtilUsage = asyncUtilsUsage.filter((usage) => {
7777
if (usage.node.type === 'MemberExpression') {
7878
const object = usage.node.object as TSESTree.Identifier;
7979

lib/rules/await-fire-event.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
2222
},
2323
defaultOptions: [],
2424

25-
create: function(context) {
25+
create: function (context) {
2626
return {
2727
'CallExpression > MemberExpression > Identifier[name=fireEvent]'(
2828
node: TSESTree.Identifier

lib/rules/no-container.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
8181
if (isRenderVariableDeclarator(node, ['render', ...renderFunctions])) {
8282
if (isObjectPattern(node.id)) {
8383
const containerIndex = node.id.properties.findIndex(
84-
property =>
84+
(property) =>
8585
isProperty(property) &&
8686
isIdentifier(property.key) &&
8787
property.key.name === 'container'
@@ -93,7 +93,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
9393
} else {
9494
isObjectPattern(nodeValue) &&
9595
nodeValue.properties.forEach(
96-
property =>
96+
(property) =>
9797
isProperty(property) &&
9898
isIdentifier(property.key) &&
9999
destructuredContainerPropNames.push(property.key.name)

lib/rules/no-debug.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
6464
if (
6565
isObjectPattern(node.id) &&
6666
node.id.properties.some(
67-
property =>
67+
(property) =>
6868
isProperty(property) &&
6969
isIdentifier(property.key) &&
7070
property.key.name === 'debug'
@@ -84,7 +84,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
8484
const { arguments: args } = node.parent as TSESTree.CallExpression;
8585

8686
const literalNodeScreenModuleName = args.find(
87-
args =>
87+
(args) =>
8888
isLiteral(args) &&
8989
typeof args.value === 'string' &&
9090
LIBRARY_MODULES.includes(args.value)
@@ -100,7 +100,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
100100
hasImportedScreen =
101101
isObjectPattern(declaratorNode.id) &&
102102
declaratorNode.id.properties.some(
103-
property =>
103+
(property) =>
104104
isProperty(property) &&
105105
isIdentifier(property.key) &&
106106
property.key.name === 'screen'
@@ -114,7 +114,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
114114
}
115115

116116
hasImportedScreen = node.specifiers.some(
117-
s => isImportSpecifier(s) && s.imported.name === 'screen'
117+
(s) => isImportSpecifier(s) && s.imported.name === 'screen'
118118
);
119119
},
120120
// checks if import has shape:
@@ -171,11 +171,11 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
171171
}
172172
},
173173
'Program:exit'() {
174-
renderVariableDeclarators.forEach(renderVar => {
174+
renderVariableDeclarators.forEach((renderVar) => {
175175
const renderVarReferences = context
176176
.getDeclaredVariables(renderVar)[0]
177177
.references.slice(1);
178-
renderVarReferences.forEach(ref => {
178+
renderVarReferences.forEach((ref) => {
179179
const parent = ref.identifier.parent;
180180
if (
181181
isMemberExpression(parent) &&

lib/rules/no-dom-import.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
8080
ImportDeclaration(node) {
8181
const value = node.source.value;
8282
const domModuleName = DOM_TESTING_LIBRARY_MODULES.find(
83-
module => module === value
83+
(module) => module === value
8484
);
8585

8686
if (domModuleName) {
@@ -95,7 +95,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
9595
const { arguments: args } = callExpression;
9696

9797
const literalNodeDomModuleName = args.find(
98-
args =>
98+
(args) =>
9999
isLiteral(args) &&
100100
typeof args.value === 'string' &&
101101
DOM_TESTING_LIBRARY_MODULES.includes(args.value)

lib/rules/no-manual-cleanup.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
4444
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4545
function reportImportReferences(references: any[]) {
4646
if (references && references.length > 0) {
47-
references.forEach(reference => {
47+
references.forEach((reference) => {
4848
const utilsUsage = reference.identifier.parent;
4949
if (
5050
isMemberExpression(utilsUsage) &&
@@ -75,7 +75,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
7575
}
7676

7777
const cleanupSpecifier = node.specifiers.find(
78-
specifier =>
78+
(specifier) =>
7979
isImportSpecifier(specifier) &&
8080
specifier.imported &&
8181
specifier.imported.name === 'cleanup'
@@ -94,7 +94,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
9494
const { arguments: args } = node.parent as TSESTree.CallExpression;
9595

9696
const literalNodeCleanupModuleName = args.find(
97-
args =>
97+
(args) =>
9898
isLiteral(args) &&
9999
typeof args.value === 'string' &&
100100
args.value.match(CLEANUP_LIBRARY_REGEX)
@@ -109,7 +109,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
109109

110110
if (isObjectPattern(declaratorNode.id)) {
111111
const cleanupProperty = declaratorNode.id.properties.find(
112-
property =>
112+
(property) =>
113113
isProperty(property) &&
114114
isIdentifier(property.key) &&
115115
property.key.name === 'cleanup'

lib/rules/no-multiple-assertions-wait-for.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
3030
schema: [],
3131
},
3232
defaultOptions: [],
33-
create: function(context) {
33+
create: function (context) {
3434
function reportMultipleAssertion(node: TSESTree.BlockStatement) {
3535
const totalExpect = (body: Array<TSESTree.Node>): Array<TSESTree.Node> =>
3636
body.filter((node: TSESTree.ExpressionStatement) => {

lib/rules/no-promise-in-fire-event.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
3636
node: TSESTree.ImportDeclaration
3737
) {
3838
const fireEventImportNode = node.specifiers.find(
39-
specifier =>
39+
(specifier) =>
4040
isImportSpecifier(specifier) &&
4141
specifier.imported &&
4242
'fireEvent' === specifier.imported.name
@@ -58,7 +58,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
5858
.property as TSESTree.Identifier).name;
5959

6060
if (
61-
ASYNC_QUERIES_VARIANTS.some(q => methodName.startsWith(q)) ||
61+
ASYNC_QUERIES_VARIANTS.some((q) => methodName.startsWith(q)) ||
6262
methodName === 'Promise'
6363
) {
6464
context.report({

lib/rules/no-render-in-setup.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
9797
'ImportDeclaration[source.value=/testing-library/]'(
9898
node: TSESTree.ImportDeclaration
9999
) {
100-
renderImportedFromTestingLib = node.specifiers.some(specifier => {
100+
renderImportedFromTestingLib = node.specifiers.some((specifier) => {
101101
return (
102102
isImportSpecifier(specifier) && specifier.local.name === 'render'
103103
);
@@ -110,7 +110,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
110110
arguments: callExpressionArgs,
111111
} = node.parent as TSESTree.CallExpression;
112112
const testingLibImport = callExpressionArgs.find(
113-
args =>
113+
(args) =>
114114
isLiteral(args) &&
115115
typeof args.value === 'string' &&
116116
RegExp(/testing-library/, 'g').test(args.value)
@@ -124,7 +124,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
124124
renderImportedFromTestingLib =
125125
isObjectPattern(declaratorNode.id) &&
126126
declaratorNode.id.properties.some(
127-
property =>
127+
(property) =>
128128
isProperty(property) &&
129129
isIdentifier(property.key) &&
130130
property.key.name === 'render'
@@ -134,7 +134,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
134134
let testingFrameworkSetupHooksToFilter = TESTING_FRAMEWORK_SETUP_HOOKS;
135135
if (allowTestingFrameworkSetupHook.length !== 0) {
136136
testingFrameworkSetupHooksToFilter = TESTING_FRAMEWORK_SETUP_HOOKS.filter(
137-
hook => hook !== allowTestingFrameworkSetupHook
137+
(hook) => hook !== allowTestingFrameworkSetupHook
138138
);
139139
}
140140
const beforeHook = findClosestBeforeHook(

lib/rules/no-side-effects-wait-for.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
3232
schema: [],
3333
},
3434
defaultOptions: [],
35-
create: function(context) {
35+
create: function (context) {
3636
let isImportingTestingLibrary = false;
3737

3838
function reportSideEffects(node: TSESTree.BlockStatement) {

lib/rules/no-wait-for-empty-callback.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
3434

3535
// trimmed down implementation of https://github.com/eslint/eslint/blob/master/lib/rules/no-empty-function.js
3636
// TODO: var referencing any of previously mentioned?
37-
create: function(context) {
37+
create: function (context) {
3838
function reportIfEmpty(
3939
node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression
4040
) {

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
8181
snapshotUsage.push(node);
8282
},
8383
'Program:exit'() {
84-
const testingLibraryUtilUsage = asyncUtilsUsage.filter(usage => {
84+
const testingLibraryUtilUsage = asyncUtilsUsage.filter((usage) => {
8585
if (isMemberExpression(usage.node)) {
8686
const object = usage.node.object as TSESTree.Identifier;
8787

@@ -109,8 +109,8 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
109109
return null;
110110
}
111111

112-
snapshotUsage.forEach(node => {
113-
testingLibraryUtilUsage.forEach(asyncUtilUsage => {
112+
snapshotUsage.forEach((node) => {
113+
testingLibraryUtilUsage.forEach((asyncUtilUsage) => {
114114
const closestAsyncUtil = getClosestAsyncUtil(asyncUtilUsage, node);
115115
if (closestAsyncUtil != null) {
116116
let name;

0 commit comments

Comments
 (0)