diff --git a/.prettierrc.js b/.prettierrc.js
new file mode 100644
index 00000000..e340799c
--- /dev/null
+++ b/.prettierrc.js
@@ -0,0 +1,3 @@
+module.exports = {
+ singleQuote: true,
+};
diff --git a/.prettierrc.json b/.prettierrc.json
deleted file mode 100644
index c6a1376d..00000000
--- a/.prettierrc.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "trailingComma": "es5",
- "singleQuote": true
-}
diff --git a/.travis.yml b/.travis.yml
index cdbae051..22591d65 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,12 +4,11 @@ env:
global:
- FORCE_COLOR=true
matrix:
- - ESLINT=5
- - ESLINT=6
+ - ESLINT=7.5
- ESLINT=7
node_js:
- - 10.12
+ - 10.22.1
- 10
- 12.0
- 12
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index 6249b2d8..ca41f9e2 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
+- Using welcoming and inclusive language
+- Being respectful of differing viewpoints and experiences
+- Gracefully accepting constructive criticism
+- Focusing on what is best for the community
+- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
-* The use of sexualized language or imagery and unwelcome sexual attention or
- advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or electronic
- address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a
- professional setting
+- The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+- Trolling, insulting/derogatory comments, and personal or political attacks
+- Public or private harassment
+- Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+- Other conduct which could reasonably be considered inappropriate in a
+ professional setting
## Our Responsibilities
diff --git a/docs/rules/await-async-utils.md b/docs/rules/await-async-utils.md
index 47f8f9b5..a44ed70b 100644
--- a/docs/rules/await-async-utils.md
+++ b/docs/rules/await-async-utils.md
@@ -54,7 +54,7 @@ test('something correctly', async () => {
// `then` chained method is correct
waitFor(() => {}, { timeout: 100 })
.then(() => console.log('DOM changed!'))
- .catch(err => console.log(`Error you need to deal with: ${err}`));
+ .catch((err) => console.log(`Error you need to deal with: ${err}`));
// return the promise within a function is correct too!
const makeCustomWait = () =>
diff --git a/docs/rules/consistent-data-testid.md b/docs/rules/consistent-data-testid.md
index de58f52b..4afc6860 100644
--- a/docs/rules/consistent-data-testid.md
+++ b/docs/rules/consistent-data-testid.md
@@ -9,17 +9,17 @@ Ensure `data-testid` values match a provided regex. This rule is un-opinionated,
Examples of **incorrect** code for this rule:
```js
-const foo = props =>
...
;
-const foo = props => ...
;
-const foo = props => ...
;
+const foo = (props) => ...
;
+const foo = (props) => ...
;
+const foo = (props) => ...
;
```
Examples of **correct** code for this rule:
```js
-const foo = props => ...
;
-const bar = props => ...
;
-const baz = props => ...
;
+const foo = (props) => ...
;
+const bar = (props) => ...
;
+const baz = (props) => ...
;
```
## Options
diff --git a/docs/rules/no-multiple-assertions-wait-for.md b/docs/rules/no-multiple-assertions-wait-for.md
index b1f946bf..78c5cf92 100644
--- a/docs/rules/no-multiple-assertions-wait-for.md
+++ b/docs/rules/no-multiple-assertions-wait-for.md
@@ -17,7 +17,7 @@ const foo = async () => {
});
// or
- await waitFor(function() {
+ await waitFor(function () {
expect(a).toEqual('a');
expect(b).toEqual('b');
});
@@ -32,7 +32,7 @@ const foo = async () => {
expect(b).toEqual('b');
// or
- await waitFor(function() {
+ await waitFor(function () {
expect(a).toEqual('a');
});
expect(b).toEqual('b');
diff --git a/docs/rules/no-wait-for-empty-callback.md b/docs/rules/no-wait-for-empty-callback.md
index d33bfa83..629d3ffa 100644
--- a/docs/rules/no-wait-for-empty-callback.md
+++ b/docs/rules/no-wait-for-empty-callback.md
@@ -11,11 +11,11 @@ Examples of **incorrect** code for this rule:
```js
const foo = async () => {
await waitFor(() => {});
- await waitFor(function() {});
+ await waitFor(function () {});
await waitFor(noop);
await waitForElementToBeRemoved(() => {});
- await waitForElementToBeRemoved(function() {});
+ await waitForElementToBeRemoved(function () {});
await waitForElementToBeRemoved(noop);
};
```
diff --git a/docs/rules/prefer-find-by.md b/docs/rules/prefer-find-by.md
index e24d585b..18b344b6 100644
--- a/docs/rules/prefer-find-by.md
+++ b/docs/rules/prefer-find-by.md
@@ -41,7 +41,7 @@ await waitForElementToBeRemoved(() => queryAllByLabel('my label'));
await waitForElementToBeRemoved(document.querySelector('foo'));
// using waitFor with a function
-await waitFor(function() {
+await waitFor(function () {
foo();
return getByText('name');
});
diff --git a/lib/node-utils.ts b/lib/node-utils.ts
index 8dd78e4e..d52752e1 100644
--- a/lib/node-utils.ts
+++ b/lib/node-utils.ts
@@ -173,7 +173,7 @@ export function isRenderFunction(
): boolean {
// returns true for `render` and e.g. `customRenderFn`
// as well as `someLib.render` and `someUtils.customRenderFn`
- return renderFunctions.some(name => {
+ return renderFunctions.some((name) => {
return (
(isIdentifier(callNode.callee) && name === callNode.callee.name) ||
(isMemberExpression(callNode.callee) &&
diff --git a/lib/rules/await-async-utils.ts b/lib/rules/await-async-utils.ts
index 8c41f27a..3c3cad56 100644
--- a/lib/rules/await-async-utils.ts
+++ b/lib/rules/await-async-utils.ts
@@ -73,7 +73,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
});
},
'Program:exit'() {
- const testingLibraryUtilUsage = asyncUtilsUsage.filter(usage => {
+ const testingLibraryUtilUsage = asyncUtilsUsage.filter((usage) => {
if (usage.node.type === 'MemberExpression') {
const object = usage.node.object as TSESTree.Identifier;
diff --git a/lib/rules/await-fire-event.ts b/lib/rules/await-fire-event.ts
index 71ea463e..1012e929 100644
--- a/lib/rules/await-fire-event.ts
+++ b/lib/rules/await-fire-event.ts
@@ -22,7 +22,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
},
defaultOptions: [],
- create: function(context) {
+ create: function (context) {
return {
'CallExpression > MemberExpression > Identifier[name=fireEvent]'(
node: TSESTree.Identifier
diff --git a/lib/rules/no-container.ts b/lib/rules/no-container.ts
index 9e02279d..b2d86c43 100644
--- a/lib/rules/no-container.ts
+++ b/lib/rules/no-container.ts
@@ -81,7 +81,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
if (isRenderVariableDeclarator(node, ['render', ...renderFunctions])) {
if (isObjectPattern(node.id)) {
const containerIndex = node.id.properties.findIndex(
- property =>
+ (property) =>
isProperty(property) &&
isIdentifier(property.key) &&
property.key.name === 'container'
@@ -93,7 +93,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
} else {
isObjectPattern(nodeValue) &&
nodeValue.properties.forEach(
- property =>
+ (property) =>
isProperty(property) &&
isIdentifier(property.key) &&
destructuredContainerPropNames.push(property.key.name)
diff --git a/lib/rules/no-debug.ts b/lib/rules/no-debug.ts
index de800e9e..cf512284 100644
--- a/lib/rules/no-debug.ts
+++ b/lib/rules/no-debug.ts
@@ -64,7 +64,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
if (
isObjectPattern(node.id) &&
node.id.properties.some(
- property =>
+ (property) =>
isProperty(property) &&
isIdentifier(property.key) &&
property.key.name === 'debug'
@@ -84,7 +84,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
const { arguments: args } = node.parent as TSESTree.CallExpression;
const literalNodeScreenModuleName = args.find(
- args =>
+ (args) =>
isLiteral(args) &&
typeof args.value === 'string' &&
LIBRARY_MODULES.includes(args.value)
@@ -100,7 +100,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
hasImportedScreen =
isObjectPattern(declaratorNode.id) &&
declaratorNode.id.properties.some(
- property =>
+ (property) =>
isProperty(property) &&
isIdentifier(property.key) &&
property.key.name === 'screen'
@@ -114,7 +114,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
}
hasImportedScreen = node.specifiers.some(
- s => isImportSpecifier(s) && s.imported.name === 'screen'
+ (s) => isImportSpecifier(s) && s.imported.name === 'screen'
);
},
// checks if import has shape:
@@ -171,11 +171,11 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
}
},
'Program:exit'() {
- renderVariableDeclarators.forEach(renderVar => {
+ renderVariableDeclarators.forEach((renderVar) => {
const renderVarReferences = context
.getDeclaredVariables(renderVar)[0]
.references.slice(1);
- renderVarReferences.forEach(ref => {
+ renderVarReferences.forEach((ref) => {
const parent = ref.identifier.parent;
if (
isMemberExpression(parent) &&
diff --git a/lib/rules/no-dom-import.ts b/lib/rules/no-dom-import.ts
index f104d134..09ad88ea 100644
--- a/lib/rules/no-dom-import.ts
+++ b/lib/rules/no-dom-import.ts
@@ -80,7 +80,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
ImportDeclaration(node) {
const value = node.source.value;
const domModuleName = DOM_TESTING_LIBRARY_MODULES.find(
- module => module === value
+ (module) => module === value
);
if (domModuleName) {
@@ -95,7 +95,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
const { arguments: args } = callExpression;
const literalNodeDomModuleName = args.find(
- args =>
+ (args) =>
isLiteral(args) &&
typeof args.value === 'string' &&
DOM_TESTING_LIBRARY_MODULES.includes(args.value)
diff --git a/lib/rules/no-manual-cleanup.ts b/lib/rules/no-manual-cleanup.ts
index 6907f56b..81bdab6c 100644
--- a/lib/rules/no-manual-cleanup.ts
+++ b/lib/rules/no-manual-cleanup.ts
@@ -44,7 +44,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function reportImportReferences(references: any[]) {
if (references && references.length > 0) {
- references.forEach(reference => {
+ references.forEach((reference) => {
const utilsUsage = reference.identifier.parent;
if (
isMemberExpression(utilsUsage) &&
@@ -75,7 +75,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
}
const cleanupSpecifier = node.specifiers.find(
- specifier =>
+ (specifier) =>
isImportSpecifier(specifier) &&
specifier.imported &&
specifier.imported.name === 'cleanup'
@@ -94,7 +94,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
const { arguments: args } = node.parent as TSESTree.CallExpression;
const literalNodeCleanupModuleName = args.find(
- args =>
+ (args) =>
isLiteral(args) &&
typeof args.value === 'string' &&
args.value.match(CLEANUP_LIBRARY_REGEX)
@@ -109,7 +109,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
if (isObjectPattern(declaratorNode.id)) {
const cleanupProperty = declaratorNode.id.properties.find(
- property =>
+ (property) =>
isProperty(property) &&
isIdentifier(property.key) &&
property.key.name === 'cleanup'
diff --git a/lib/rules/no-multiple-assertions-wait-for.ts b/lib/rules/no-multiple-assertions-wait-for.ts
index 405ba326..7c095894 100644
--- a/lib/rules/no-multiple-assertions-wait-for.ts
+++ b/lib/rules/no-multiple-assertions-wait-for.ts
@@ -30,7 +30,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
schema: [],
},
defaultOptions: [],
- create: function(context) {
+ create: function (context) {
function reportMultipleAssertion(node: TSESTree.BlockStatement) {
const totalExpect = (body: Array): Array =>
body.filter((node: TSESTree.ExpressionStatement) => {
diff --git a/lib/rules/no-promise-in-fire-event.ts b/lib/rules/no-promise-in-fire-event.ts
index 3221a3f1..d05d0605 100644
--- a/lib/rules/no-promise-in-fire-event.ts
+++ b/lib/rules/no-promise-in-fire-event.ts
@@ -36,7 +36,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
node: TSESTree.ImportDeclaration
) {
const fireEventImportNode = node.specifiers.find(
- specifier =>
+ (specifier) =>
isImportSpecifier(specifier) &&
specifier.imported &&
'fireEvent' === specifier.imported.name
@@ -58,7 +58,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
.property as TSESTree.Identifier).name;
if (
- ASYNC_QUERIES_VARIANTS.some(q => methodName.startsWith(q)) ||
+ ASYNC_QUERIES_VARIANTS.some((q) => methodName.startsWith(q)) ||
methodName === 'Promise'
) {
context.report({
diff --git a/lib/rules/no-render-in-setup.ts b/lib/rules/no-render-in-setup.ts
index e3cf4533..ecfce6d4 100644
--- a/lib/rules/no-render-in-setup.ts
+++ b/lib/rules/no-render-in-setup.ts
@@ -97,7 +97,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
'ImportDeclaration[source.value=/testing-library/]'(
node: TSESTree.ImportDeclaration
) {
- renderImportedFromTestingLib = node.specifiers.some(specifier => {
+ renderImportedFromTestingLib = node.specifiers.some((specifier) => {
return (
isImportSpecifier(specifier) && specifier.local.name === 'render'
);
@@ -110,7 +110,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
arguments: callExpressionArgs,
} = node.parent as TSESTree.CallExpression;
const testingLibImport = callExpressionArgs.find(
- args =>
+ (args) =>
isLiteral(args) &&
typeof args.value === 'string' &&
RegExp(/testing-library/, 'g').test(args.value)
@@ -124,7 +124,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
renderImportedFromTestingLib =
isObjectPattern(declaratorNode.id) &&
declaratorNode.id.properties.some(
- property =>
+ (property) =>
isProperty(property) &&
isIdentifier(property.key) &&
property.key.name === 'render'
@@ -134,7 +134,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
let testingFrameworkSetupHooksToFilter = TESTING_FRAMEWORK_SETUP_HOOKS;
if (allowTestingFrameworkSetupHook.length !== 0) {
testingFrameworkSetupHooksToFilter = TESTING_FRAMEWORK_SETUP_HOOKS.filter(
- hook => hook !== allowTestingFrameworkSetupHook
+ (hook) => hook !== allowTestingFrameworkSetupHook
);
}
const beforeHook = findClosestBeforeHook(
diff --git a/lib/rules/no-side-effects-wait-for.ts b/lib/rules/no-side-effects-wait-for.ts
index 29395dc9..9cd31111 100644
--- a/lib/rules/no-side-effects-wait-for.ts
+++ b/lib/rules/no-side-effects-wait-for.ts
@@ -32,7 +32,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
schema: [],
},
defaultOptions: [],
- create: function(context) {
+ create: function (context) {
let isImportingTestingLibrary = false;
function reportSideEffects(node: TSESTree.BlockStatement) {
diff --git a/lib/rules/no-wait-for-empty-callback.ts b/lib/rules/no-wait-for-empty-callback.ts
index 1c8f4b1a..6c53b88e 100644
--- a/lib/rules/no-wait-for-empty-callback.ts
+++ b/lib/rules/no-wait-for-empty-callback.ts
@@ -34,7 +34,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
// trimmed down implementation of https://github.com/eslint/eslint/blob/master/lib/rules/no-empty-function.js
// TODO: var referencing any of previously mentioned?
- create: function(context) {
+ create: function (context) {
function reportIfEmpty(
node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression
) {
diff --git a/lib/rules/no-wait-for-snapshot.ts b/lib/rules/no-wait-for-snapshot.ts
index b81a314a..039b4cdd 100644
--- a/lib/rules/no-wait-for-snapshot.ts
+++ b/lib/rules/no-wait-for-snapshot.ts
@@ -81,7 +81,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
snapshotUsage.push(node);
},
'Program:exit'() {
- const testingLibraryUtilUsage = asyncUtilsUsage.filter(usage => {
+ const testingLibraryUtilUsage = asyncUtilsUsage.filter((usage) => {
if (isMemberExpression(usage.node)) {
const object = usage.node.object as TSESTree.Identifier;
@@ -109,8 +109,8 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
return null;
}
- snapshotUsage.forEach(node => {
- testingLibraryUtilUsage.forEach(asyncUtilUsage => {
+ snapshotUsage.forEach((node) => {
+ testingLibraryUtilUsage.forEach((asyncUtilUsage) => {
const closestAsyncUtil = getClosestAsyncUtil(asyncUtilUsage, node);
if (closestAsyncUtil != null) {
let name;
diff --git a/lib/rules/prefer-explicit-assert.ts b/lib/rules/prefer-explicit-assert.ts
index 29b0e954..10349cee 100644
--- a/lib/rules/prefer-explicit-assert.ts
+++ b/lib/rules/prefer-explicit-assert.ts
@@ -14,7 +14,7 @@ type Options = [
];
const ALL_GET_BY_QUERIES = ALL_QUERIES_METHODS.map(
- queryMethod => `get${queryMethod}`
+ (queryMethod) => `get${queryMethod}`
);
const isValidQuery = (node: TSESTree.Identifier, customQueryNames: string[]) =>
@@ -62,7 +62,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
},
],
- create: function(context, [options]) {
+ create: function (context, [options]) {
const { customQueryNames, assertion } = options;
const getQueryCalls: TSESTree.Identifier[] = [];
@@ -73,7 +73,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
}
},
'Program:exit'() {
- getQueryCalls.forEach(queryCall => {
+ getQueryCalls.forEach((queryCall) => {
const node = isMemberExpression(queryCall.parent)
? queryCall.parent
: queryCall;
diff --git a/lib/rules/prefer-find-by.ts b/lib/rules/prefer-find-by.ts
index c3db9494..fcc609a7 100644
--- a/lib/rules/prefer-find-by.ts
+++ b/lib/rules/prefer-find-by.ts
@@ -39,8 +39,10 @@ function findRenderDefinitionDeclaration(
);
if (variable) {
- const def = variable.defs.find(({ name }) => name.name === query);
- return def.name;
+ return variable.defs
+ .map(({ name }) => name)
+ .filter(isIdentifier)
+ .find(({ name }) => name === query);
}
return findRenderDefinitionDeclaration(scope.upper, query);
@@ -135,7 +137,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
queryVariant,
fix(fixer) {
const newCode = `${caller}.${queryVariant}${queryMethod}(${callArguments
- .map(node => sourceCode.getText(node))
+ .map((node) => sourceCode.getText(node))
.join(', ')})`;
return fixer.replaceText(node, newCode);
},
@@ -160,7 +162,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
const allFixes: RuleFix[] = [];
// this updates waitFor with findBy*
const newCode = `${findByMethod}(${callArguments
- .map(node => sourceCode.getText(node))
+ .map((node) => sourceCode.getText(node))
.join(', ')})`;
allFixes.push(fixer.replaceText(node, newCode));
@@ -179,7 +181,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
// verify if the findBy* method was already declared
if (
allVariableDeclarations.properties.some(
- p =>
+ (p) =>
isProperty(p) &&
isIdentifier(p.key) &&
p.key.name === findByMethod
diff --git a/lib/rules/prefer-screen-queries.ts b/lib/rules/prefer-screen-queries.ts
index 3b78c26b..fbf717d3 100644
--- a/lib/rules/prefer-screen-queries.ts
+++ b/lib/rules/prefer-screen-queries.ts
@@ -24,7 +24,7 @@ function usesContainerOrBaseElement(node: TSESTree.CallExpression) {
return (
isObjectExpression(secondArgument) &&
secondArgument.properties.some(
- property =>
+ (property) =>
isProperty(property) &&
isIdentifier(property.key) &&
ALLOWED_RENDER_PROPERTIES_FOR_DESTRUCTURING.includes(property.key.name)
@@ -85,7 +85,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
// save the destructured query methods
const identifiers = node.id.properties
.filter(
- property =>
+ (property) =>
isProperty(property) &&
isIdentifier(property.key) &&
queriesRegex.test(property.key.name)
@@ -108,7 +108,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
) {
if (
!queriesDestructuredInWithinDeclaration.some(
- queryName => queryName === node.name
+ (queryName) => queryName === node.name
)
) {
reportInvalidUsage(node);
diff --git a/lib/rules/prefer-user-event.ts b/lib/rules/prefer-user-event.ts
index 9e3adc6e..b2018ea7 100644
--- a/lib/rules/prefer-user-event.ts
+++ b/lib/rules/prefer-user-event.ts
@@ -106,7 +106,8 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
return;
}
const fireEventImport = node.specifiers.find(
- node => isImportSpecifier(node) && node.imported.name === 'fireEvent'
+ (node) =>
+ isImportSpecifier(node) && node.imported.name === 'fireEvent'
);
hasNamedImportedFireEvent = !!fireEventImport;
if (!hasNamedImportedFireEvent) {
diff --git a/lib/rules/prefer-wait-for.ts b/lib/rules/prefer-wait-for.ts
index cf5b6967..00d1fd5a 100644
--- a/lib/rules/prefer-wait-for.ts
+++ b/lib/rules/prefer-wait-for.ts
@@ -44,7 +44,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
// get all import names excluding all testing library `wait*` utils...
const newImports = node.specifiers
.filter(
- specifier =>
+ (specifier) =>
isImportSpecifier(specifier) &&
!excludedImports.includes(specifier.imported.name)
)
@@ -65,9 +65,9 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
});
};
- const reportWait = (node: TSESTree.Identifier) => {
+ const reportWait = (node: TSESTree.Identifier | TSESTree.JSXIdentifier) => {
context.report({
- node: node,
+ node,
messageId: 'preferWaitForMethod',
data: {
methodName: node.name,
@@ -116,7 +116,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
node: TSESTree.ImportDeclaration
) {
const deprecatedImportSpecifiers = node.specifiers.filter(
- specifier =>
+ (specifier) =>
isImportSpecifier(specifier) &&
specifier.imported &&
DEPRECATED_METHODS.includes(specifier.imported.name)
@@ -129,8 +129,8 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
context
.getDeclaredVariables(importSpecifier)
- .forEach(variable =>
- variable.references.forEach(reference =>
+ .forEach((variable) =>
+ variable.references.forEach((reference) =>
reportWait(reference.identifier)
)
);
@@ -139,8 +139,8 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
'ImportDeclaration[source.value=/testing-library/] > ImportNamespaceSpecifier'(
node: TSESTree.ImportNamespaceSpecifier
) {
- context.getDeclaredVariables(node).forEach(variable =>
- variable.references.forEach(reference => {
+ context.getDeclaredVariables(node).forEach((variable) =>
+ variable.references.forEach((reference) => {
if (
isMemberExpression(reference.identifier.parent) &&
isIdentifier(reference.identifier.parent.property) &&
diff --git a/lib/rules/render-result-naming-convention.ts b/lib/rules/render-result-naming-convention.ts
index 86d974e8..5bfa9715 100644
--- a/lib/rules/render-result-naming-convention.ts
+++ b/lib/rules/render-result-naming-convention.ts
@@ -15,7 +15,7 @@ type Options = [{ renderFunctions?: string[] }];
const ALLOWED_VAR_NAMES = ['view', 'utils'];
const ALLOWED_VAR_NAMES_TEXT = ALLOWED_VAR_NAMES.map(
- name => `\`${name}\``
+ (name) => `\`${name}\``
).join(', ');
export default ESLintUtils.RuleCreator(getDocsUrl)({
@@ -60,7 +60,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
return;
}
const renderImport = node.specifiers.find(
- node => isImportSpecifier(node) && node.imported.name === 'render'
+ (node) => isImportSpecifier(node) && node.imported.name === 'render'
);
if (!renderImport) {
diff --git a/lib/utils.ts b/lib/utils.ts
index 6403087e..f90cf3e1 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -2,9 +2,9 @@ import { TSESTree } from '@typescript-eslint/experimental-utils';
const combineQueries = (variants: string[], methods: string[]) => {
const combinedQueries: string[] = [];
- variants.forEach(variant => {
+ variants.forEach((variant) => {
const variantPrefix = variant.replace('By', '');
- methods.forEach(method => {
+ methods.forEach((method) => {
combinedQueries.push(`${variantPrefix}${method}`);
});
});
diff --git a/package.json b/package.json
index ca6c2fe7..8ed48264 100644
--- a/package.json
+++ b/package.json
@@ -40,14 +40,14 @@
"semantic-release": "semantic-release"
},
"dependencies": {
- "@typescript-eslint/experimental-utils": "^3.10.1"
+ "@typescript-eslint/experimental-utils": "^4.1.1"
},
"devDependencies": {
- "@commitlint/cli": "^9.1.2",
- "@commitlint/config-conventional": "^9.1.2",
- "@types/jest": "^25.2.3",
- "@typescript-eslint/eslint-plugin": "^3.10.1",
- "@typescript-eslint/parser": "^3.10.1",
+ "@commitlint/cli": "^11.0.0",
+ "@commitlint/config-conventional": "^11.0.0",
+ "@types/jest": "^26.0.14",
+ "@typescript-eslint/eslint-plugin": "^4.1.1",
+ "@typescript-eslint/parser": "^4.1.1",
"cpy-cli": "^3.1.1",
"eslint": "^7.9.0",
"eslint-config-prettier": "^6.11.0",
@@ -61,18 +61,18 @@
"eslint-plugin-standard": "^4.0.1",
"husky": "^4.3.0",
"is-ci-cli": "^2.1.2",
- "jest": "^25.5.4",
- "lint-staged": "^9.5.0",
- "prettier": "1.19.1",
- "semantic-release": "^15.14.0",
- "ts-jest": "^25.5.1",
+ "jest": "^26.4.2",
+ "lint-staged": "^10.4.0",
+ "prettier": "2.1.2",
+ "semantic-release": "^17.1.2",
+ "ts-jest": "^26.4.0",
"typescript": "^4.0.3"
},
"peerDependencies": {
- "eslint": "^5 || ^6 || ^7"
+ "eslint": "^7.5.0"
},
"engines": {
- "node": "^10.12.0 || >=12.0.0",
+ "node": "^10.22.1 || >=12.0.0",
"npm": ">=6"
},
"license": "MIT"
diff --git a/tests/index.test.ts b/tests/index.test.ts
index ee1148c2..6e4eddae 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -6,17 +6,19 @@ import * as path from 'path';
const rulesModules = fs.readdirSync(path.join(__dirname, '../lib/rules'));
it('should export all available rules', () => {
- const availableRules = rulesModules.map(module => module.replace('.ts', ''));
+ const availableRules = rulesModules.map((module) =>
+ module.replace('.ts', '')
+ );
expect(Object.keys(rules)).toEqual(availableRules);
});
it.each(['dom', 'angular', 'react', 'vue'])(
'should export proper "%s" config',
- configName => {
+ (configName) => {
expect(configs[configName]).toMatchSnapshot();
// make sure all enabled rules start by "testing-library/" prefix
- Object.keys(configs[configName].rules).forEach(ruleEnabled => {
+ Object.keys(configs[configName].rules).forEach((ruleEnabled) => {
expect(ruleEnabled).toMatch(/^testing-library\/.+$/);
});
}
diff --git a/tests/lib/rules/await-async-query.test.ts b/tests/lib/rules/await-async-query.test.ts
index 8e666cf7..c4c4c07f 100644
--- a/tests/lib/rules/await-async-query.test.ts
+++ b/tests/lib/rules/await-async-query.test.ts
@@ -34,7 +34,7 @@ function createTestCase(
) => string | { code: string; errors?: TestCaseError<'awaitAsyncQuery'>[] },
{ combinations = ASYNC_QUERIES_COMBINATIONS, isAsync }: TestCaseParams = {}
) {
- return combinations.map(query => {
+ return combinations.map((query) => {
const test = getTest(query);
return typeof test === 'string'
@@ -49,16 +49,16 @@ function createTestCase(
ruleTester.run(RULE_NAME, rule, {
valid: [
// async queries declaration from render functions are valid
- ...createTestCase(query => `const { ${query} } = render()`, {
+ ...createTestCase((query) => `const { ${query} } = render()`, {
isAsync: false,
}),
// async screen queries declaration are valid
- ...createTestCase(query => `await screen.${query}('foo')`),
+ ...createTestCase((query) => `await screen.${query}('foo')`),
// async queries are valid with await operator
...createTestCase(
- query => `
+ (query) => `
doSomething()
await ${query}('foo')
`
@@ -66,7 +66,7 @@ ruleTester.run(RULE_NAME, rule, {
// async queries are valid when saved in a variable with await operator
...createTestCase(
- query => `
+ (query) => `
doSomething()
const foo = await ${query}('foo')
expect(foo).toBeInTheDocument();
@@ -75,7 +75,7 @@ ruleTester.run(RULE_NAME, rule, {
// async queries are valid when saved in a promise variable immediately resolved
...createTestCase(
- query => `
+ (query) => `
const promise = ${query}('foo')
await promise
`
@@ -83,7 +83,7 @@ ruleTester.run(RULE_NAME, rule, {
// async queries are valid when saved in a promise variable resolved by an await operator
...createTestCase(
- query => `
+ (query) => `
const promise = ${query}('foo')
await promise
`
@@ -91,7 +91,7 @@ ruleTester.run(RULE_NAME, rule, {
// async queries are valid when used with then method
...createTestCase(
- query => `
+ (query) => `
${query}('foo').then(() => {
done()
})
@@ -100,21 +100,23 @@ ruleTester.run(RULE_NAME, rule, {
// async queries are valid with promise in variable resolved by then method
...createTestCase(
- query => `
+ (query) => `
const promise = ${query}('foo')
promise.then((done) => done())
`
),
// async queries are valid with promise returned in arrow function
- ...createTestCase(query => `const anArrowFunction = () => ${query}('foo')`),
+ ...createTestCase(
+ (query) => `const anArrowFunction = () => ${query}('foo')`
+ ),
// async queries are valid with promise returned in regular function
- ...createTestCase(query => `function foo() { return ${query}('foo') }`),
+ ...createTestCase((query) => `function foo() { return ${query}('foo') }`),
// async queries are valid with promise in variable and returned in regular functio
...createTestCase(
- query => `
+ (query) => `
const promise = ${query}('foo')
return promise
`
@@ -122,7 +124,7 @@ ruleTester.run(RULE_NAME, rule, {
// sync queries are valid
...createTestCase(
- query => `
+ (query) => `
doSomething()
${query}('foo')
`,
@@ -131,7 +133,7 @@ ruleTester.run(RULE_NAME, rule, {
// async queries with resolves matchers are valid
...createTestCase(
- query => `
+ (query) => `
expect(${query}("foo")).resolves.toBe("bar")
expect(wrappedQuery(${query}("foo"))).resolves.toBe("bar")
`
@@ -139,7 +141,7 @@ ruleTester.run(RULE_NAME, rule, {
// async queries with rejects matchers are valid
...createTestCase(
- query => `
+ (query) => `
expect(${query}("foo")).rejects.toBe("bar")
expect(wrappedQuery(${query}("foo"))).rejects.toBe("bar")
`
@@ -154,7 +156,7 @@ ruleTester.run(RULE_NAME, rule, {
}),
// unresolved async queries are valid if there are no imports from a testing library module
- ...ASYNC_QUERIES_COMBINATIONS.map(query => ({
+ ...ASYNC_QUERIES_COMBINATIONS.map((query) => ({
code: `
import { render } from "another-library"
@@ -167,7 +169,7 @@ ruleTester.run(RULE_NAME, rule, {
invalid: [
// async queries without await operator or then method are not valid
- ...createTestCase(query => ({
+ ...createTestCase((query) => ({
code: `
doSomething()
const foo = ${query}('foo')
@@ -176,12 +178,12 @@ ruleTester.run(RULE_NAME, rule, {
})),
// async screen queries without await operator or then method are not valid
- ...createTestCase(query => ({
+ ...createTestCase((query) => ({
code: `screen.${query}('foo')`,
errors: [{ messageId: 'awaitAsyncQuery' }],
})),
- ...createTestCase(query => ({
+ ...createTestCase((query) => ({
code: `
const foo = ${query}('foo')
expect(foo).toBeInTheDocument()
diff --git a/tests/lib/rules/await-async-utils.test.ts b/tests/lib/rules/await-async-utils.test.ts
index 67a60451..c2b80750 100644
--- a/tests/lib/rules/await-async-utils.test.ts
+++ b/tests/lib/rules/await-async-utils.test.ts
@@ -6,7 +6,7 @@ const ruleTester = createRuleTester();
ruleTester.run(RULE_NAME, rule, {
valid: [
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('${asyncUtil} util directly waited with await operator is valid', async () => {
@@ -16,7 +16,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('${asyncUtil} util promise saved in var and waited with await operator is valid', async () => {
@@ -27,7 +27,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('${asyncUtil} util directly chained with then is valid', () => {
@@ -37,7 +37,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('${asyncUtil} util promise saved in var and chained with then is valid', () => {
@@ -48,7 +48,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('${asyncUtil} util directly returned in arrow function is valid', async () => {
@@ -60,7 +60,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('${asyncUtil} util explicitly returned in arrow function is valid', async () => {
@@ -73,7 +73,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('${asyncUtil} util returned in regular function is valid', async () => {
@@ -86,7 +86,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('${asyncUtil} util promise saved in var and returned in function is valid', async () => {
@@ -102,7 +102,7 @@ ruleTester.run(RULE_NAME, rule, {
});
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from 'some-other-library';
test('util "${asyncUtil}" which is not related to testing library is valid', async () => {
@@ -111,7 +111,7 @@ ruleTester.run(RULE_NAME, rule, {
});
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import * as asyncUtils from 'some-other-library';
test('util "asyncUtils.${asyncUtil}" which is not related to testing library is valid', async () => {
@@ -141,7 +141,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
invalid: [
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('${asyncUtil} util not waited', () => {
@@ -151,7 +151,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
errors: [{ line: 5, messageId: 'awaitAsyncUtil' }],
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import * as asyncUtil from '@testing-library/dom';
test('asyncUtil.${asyncUtil} util not waited', () => {
@@ -161,7 +161,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
errors: [{ line: 5, messageId: 'awaitAsyncUtil' }],
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('${asyncUtil} util promise saved not waited', () => {
@@ -171,7 +171,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
errors: [{ line: 5, column: 28, messageId: 'awaitAsyncUtil' }],
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('several ${asyncUtil} utils not waited', () => {
diff --git a/tests/lib/rules/no-await-sync-query.test.ts b/tests/lib/rules/no-await-sync-query.test.ts
index bd3e62f0..138cf5c9 100644
--- a/tests/lib/rules/no-await-sync-query.test.ts
+++ b/tests/lib/rules/no-await-sync-query.test.ts
@@ -10,7 +10,7 @@ const ruleTester = createRuleTester();
ruleTester.run(RULE_NAME, rule, {
valid: [
// sync queries without await are valid
- ...SYNC_QUERIES_COMBINATIONS.map(query => ({
+ ...SYNC_QUERIES_COMBINATIONS.map((query) => ({
code: `() => {
${query}('foo')
}
@@ -18,7 +18,7 @@ ruleTester.run(RULE_NAME, rule, {
})),
// async queries with await operator are valid
- ...ASYNC_QUERIES_COMBINATIONS.map(query => ({
+ ...ASYNC_QUERIES_COMBINATIONS.map((query) => ({
code: `async () => {
await ${query}('foo')
}
@@ -26,7 +26,7 @@ ruleTester.run(RULE_NAME, rule, {
})),
// async queries with then method are valid
- ...ASYNC_QUERIES_COMBINATIONS.map(query => ({
+ ...ASYNC_QUERIES_COMBINATIONS.map((query) => ({
code: `() => {
${query}('foo').then(() => {});
}
@@ -36,7 +36,7 @@ ruleTester.run(RULE_NAME, rule, {
invalid: [
// sync queries with await operator are not valid
- ...SYNC_QUERIES_COMBINATIONS.map(query => ({
+ ...SYNC_QUERIES_COMBINATIONS.map((query) => ({
code: `async () => {
await ${query}('foo')
}
@@ -49,7 +49,7 @@ ruleTester.run(RULE_NAME, rule, {
})),
// sync queries in screen with await operator are not valid
- ...SYNC_QUERIES_COMBINATIONS.map(query => ({
+ ...SYNC_QUERIES_COMBINATIONS.map((query) => ({
code: `async () => {
await screen.${query}('foo')
}
diff --git a/tests/lib/rules/no-manual-cleanup.test.ts b/tests/lib/rules/no-manual-cleanup.test.ts
index bd02fb42..69c4f933 100644
--- a/tests/lib/rules/no-manual-cleanup.test.ts
+++ b/tests/lib/rules/no-manual-cleanup.test.ts
@@ -13,22 +13,22 @@ const ALL_TESTING_LIBRARIES_WITH_CLEANUP = [
ruleTester.run(RULE_NAME, rule, {
valid: [
- ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map(lib => ({
+ ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map((lib) => ({
code: `import { render } from "${lib}"`,
})),
{
code: `import { cleanup } from "any-other-library"`,
},
- ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map(lib => ({
+ ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map((lib) => ({
code: `import utils from "${lib}"`,
})),
- ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map(lib => ({
+ ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map((lib) => ({
code: `
import utils from "${lib}"
utils.render()
`,
})),
- ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map(lib => ({
+ ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map((lib) => ({
code: `const { render, within } = require("${lib}")`,
})),
{
@@ -49,7 +49,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
invalid: [
- ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map(lib => ({
+ ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map((lib) => ({
code: `import { render, cleanup } from "${lib}"`,
errors: [
{
@@ -59,7 +59,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map(lib => ({
+ ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map((lib) => ({
code: `import { cleanup as myCustomCleanup } from "${lib}"`,
errors: [
{
@@ -69,7 +69,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map(lib => ({
+ ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map((lib) => ({
code: `import utils, { cleanup } from "${lib}"`,
errors: [
{
@@ -79,7 +79,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map(lib => ({
+ ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map((lib) => ({
code: `
import utils from "${lib}"
afterEach(() => utils.cleanup())
@@ -92,7 +92,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map(lib => ({
+ ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map((lib) => ({
code: `
import utils from "${lib}"
afterEach(utils.cleanup)
@@ -105,7 +105,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map(lib => ({
+ ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map((lib) => ({
code: `const { cleanup } = require("${lib}")`,
errors: [
{
@@ -115,7 +115,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map(lib => ({
+ ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map((lib) => ({
code: `
const utils = require("${lib}")
afterEach(() => utils.cleanup())
@@ -128,7 +128,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map(lib => ({
+ ...ALL_TESTING_LIBRARIES_WITH_CLEANUP.map((lib) => ({
code: `
const utils = require("${lib}")
afterEach(utils.cleanup)
diff --git a/tests/lib/rules/no-render-in-setup.test.ts b/tests/lib/rules/no-render-in-setup.test.ts
index 1f4a529d..3c8fbc57 100644
--- a/tests/lib/rules/no-render-in-setup.test.ts
+++ b/tests/lib/rules/no-render-in-setup.test.ts
@@ -19,7 +19,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
},
// test config options
- ...TESTING_FRAMEWORK_SETUP_HOOKS.map(setupHook => ({
+ ...TESTING_FRAMEWORK_SETUP_HOOKS.map((setupHook) => ({
code: `
import { renderWithRedux } from '../test-utils';
${setupHook}(() => {
@@ -34,7 +34,7 @@ ruleTester.run(RULE_NAME, rule, {
],
})),
// test usage of a non-Testing Library render fn
- ...TESTING_FRAMEWORK_SETUP_HOOKS.map(setupHook => ({
+ ...TESTING_FRAMEWORK_SETUP_HOOKS.map((setupHook) => ({
code: `
import { render } from 'imNoTestingLibrary';
${setupHook}(() => {
@@ -42,9 +42,9 @@ ruleTester.run(RULE_NAME, rule, {
})
`,
})),
- ...TESTING_FRAMEWORK_SETUP_HOOKS.map(allowedSetupHook => {
+ ...TESTING_FRAMEWORK_SETUP_HOOKS.map((allowedSetupHook) => {
const [disallowedHook] = TESTING_FRAMEWORK_SETUP_HOOKS.filter(
- setupHook => setupHook !== allowedSetupHook
+ (setupHook) => setupHook !== allowedSetupHook
);
return {
code: `
@@ -65,7 +65,7 @@ ruleTester.run(RULE_NAME, rule, {
],
};
}),
- ...TESTING_FRAMEWORK_SETUP_HOOKS.map(setupHook => ({
+ ...TESTING_FRAMEWORK_SETUP_HOOKS.map((setupHook) => ({
code: `
const { render } = require('imNoTestingLibrary')
@@ -82,7 +82,7 @@ ruleTester.run(RULE_NAME, rule, {
],
invalid: [
- ...TESTING_FRAMEWORK_SETUP_HOOKS.map(setupHook => ({
+ ...TESTING_FRAMEWORK_SETUP_HOOKS.map((setupHook) => ({
code: `
import { render } from '@testing-library/foo';
${setupHook}(() => {
@@ -95,7 +95,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...TESTING_FRAMEWORK_SETUP_HOOKS.map(setupHook => ({
+ ...TESTING_FRAMEWORK_SETUP_HOOKS.map((setupHook) => ({
code: `
import { render } from '@testing-library/foo';
${setupHook}(function() {
@@ -109,7 +109,7 @@ ruleTester.run(RULE_NAME, rule, {
],
})),
// custom render function
- ...TESTING_FRAMEWORK_SETUP_HOOKS.map(setupHook => ({
+ ...TESTING_FRAMEWORK_SETUP_HOOKS.map((setupHook) => ({
code: `
import { renderWithRedux } from '../test-utils';
${setupHook}(() => {
@@ -128,7 +128,7 @@ ruleTester.run(RULE_NAME, rule, {
],
})),
// call render within a wrapper function
- ...TESTING_FRAMEWORK_SETUP_HOOKS.map(setupHook => ({
+ ...TESTING_FRAMEWORK_SETUP_HOOKS.map((setupHook) => ({
code: `
import { render } from '@testing-library/foo';
${setupHook}(() => {
@@ -144,9 +144,9 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...TESTING_FRAMEWORK_SETUP_HOOKS.map(allowedSetupHook => {
+ ...TESTING_FRAMEWORK_SETUP_HOOKS.map((allowedSetupHook) => {
const [disallowedHook] = TESTING_FRAMEWORK_SETUP_HOOKS.filter(
- setupHook => setupHook !== allowedSetupHook
+ (setupHook) => setupHook !== allowedSetupHook
);
return {
code: `
@@ -167,7 +167,7 @@ ruleTester.run(RULE_NAME, rule, {
],
};
}),
- ...TESTING_FRAMEWORK_SETUP_HOOKS.map(setupHook => ({
+ ...TESTING_FRAMEWORK_SETUP_HOOKS.map((setupHook) => ({
code: `
import * as testingLibrary from '@testing-library/foo';
${setupHook}(() => {
@@ -180,7 +180,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...TESTING_FRAMEWORK_SETUP_HOOKS.map(setupHook => ({
+ ...TESTING_FRAMEWORK_SETUP_HOOKS.map((setupHook) => ({
code: `
import { render } from 'imNoTestingLibrary';
import * as testUtils from '../test-utils';
@@ -202,7 +202,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...TESTING_FRAMEWORK_SETUP_HOOKS.map(setupHook => ({
+ ...TESTING_FRAMEWORK_SETUP_HOOKS.map((setupHook) => ({
code: `
const { render } = require('@testing-library/foo')
diff --git a/tests/lib/rules/no-wait-for-empty-callback.test.ts b/tests/lib/rules/no-wait-for-empty-callback.test.ts
index a6edaf2f..17d8de07 100644
--- a/tests/lib/rules/no-wait-for-empty-callback.test.ts
+++ b/tests/lib/rules/no-wait-for-empty-callback.test.ts
@@ -7,12 +7,12 @@ const ALL_WAIT_METHODS = ['waitFor', 'waitForElementToBeRemoved'];
ruleTester.run(RULE_NAME, rule, {
valid: [
- ...ALL_WAIT_METHODS.map(m => ({
+ ...ALL_WAIT_METHODS.map((m) => ({
code: `${m}(() => {
screen.getByText(/submit/i)
})`,
})),
- ...ALL_WAIT_METHODS.map(m => ({
+ ...ALL_WAIT_METHODS.map((m) => ({
code: `${m}(function() {
screen.getByText(/submit/i)
})`,
@@ -32,7 +32,7 @@ ruleTester.run(RULE_NAME, rule, {
],
invalid: [
- ...ALL_WAIT_METHODS.map(m => ({
+ ...ALL_WAIT_METHODS.map((m) => ({
code: `${m}(() => {})`,
errors: [
{
@@ -40,7 +40,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_WAIT_METHODS.map(m => ({
+ ...ALL_WAIT_METHODS.map((m) => ({
code: `${m}((a, b) => {})`,
errors: [
{
@@ -48,7 +48,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_WAIT_METHODS.map(m => ({
+ ...ALL_WAIT_METHODS.map((m) => ({
code: `${m}(() => { /* I'm empty anyway */ })`,
errors: [
{
@@ -57,7 +57,7 @@ ruleTester.run(RULE_NAME, rule, {
],
})),
- ...ALL_WAIT_METHODS.map(m => ({
+ ...ALL_WAIT_METHODS.map((m) => ({
code: `${m}(function() {
})`,
@@ -67,7 +67,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_WAIT_METHODS.map(m => ({
+ ...ALL_WAIT_METHODS.map((m) => ({
code: `${m}(function(a) {
})`,
@@ -77,7 +77,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_WAIT_METHODS.map(m => ({
+ ...ALL_WAIT_METHODS.map((m) => ({
code: `${m}(function() {
// another empty callback
})`,
@@ -88,7 +88,7 @@ ruleTester.run(RULE_NAME, rule, {
],
})),
- ...ALL_WAIT_METHODS.map(m => ({
+ ...ALL_WAIT_METHODS.map((m) => ({
code: `${m}(noop)`,
errors: [
{
diff --git a/tests/lib/rules/no-wait-for-snapshot.test.ts b/tests/lib/rules/no-wait-for-snapshot.test.ts
index 5f489513..522bf12d 100644
--- a/tests/lib/rules/no-wait-for-snapshot.test.ts
+++ b/tests/lib/rules/no-wait-for-snapshot.test.ts
@@ -6,7 +6,7 @@ const ruleTester = createRuleTester();
ruleTester.run(RULE_NAME, rule, {
valid: [
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('snapshot calls outside of ${asyncUtil} are valid', () => {
@@ -16,7 +16,7 @@ ruleTester.run(RULE_NAME, rule, {
})
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('snapshot calls outside of ${asyncUtil} are valid', () => {
@@ -28,7 +28,7 @@ ruleTester.run(RULE_NAME, rule, {
})
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import * as asyncUtils from '@testing-library/dom';
test('snapshot calls outside of ${asyncUtil} are valid', () => {
@@ -38,7 +38,7 @@ ruleTester.run(RULE_NAME, rule, {
})
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import * as asyncUtils from '@testing-library/dom';
test('snapshot calls outside of ${asyncUtil} are valid', () => {
@@ -50,7 +50,7 @@ ruleTester.run(RULE_NAME, rule, {
})
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from 'some-other-library';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -58,7 +58,7 @@ ruleTester.run(RULE_NAME, rule, {
});
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from 'some-other-library';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -68,7 +68,7 @@ ruleTester.run(RULE_NAME, rule, {
});
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import * as asyncUtils from 'some-other-library';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -76,7 +76,7 @@ ruleTester.run(RULE_NAME, rule, {
});
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import * as asyncUtils from 'some-other-library';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -86,7 +86,7 @@ ruleTester.run(RULE_NAME, rule, {
});
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from 'some-other-library';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -94,7 +94,7 @@ ruleTester.run(RULE_NAME, rule, {
});
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from 'some-other-library';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -104,7 +104,7 @@ ruleTester.run(RULE_NAME, rule, {
});
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import * as asyncUtils from 'some-other-library';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -112,7 +112,7 @@ ruleTester.run(RULE_NAME, rule, {
});
`,
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import * as asyncUtils from 'some-other-library';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -124,7 +124,7 @@ ruleTester.run(RULE_NAME, rule, {
})),
],
invalid: [
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -133,7 +133,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
errors: [{ line: 4, messageId: 'noWaitForSnapshot' }],
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -144,7 +144,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
errors: [{ line: 5, messageId: 'noWaitForSnapshot' }],
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import * as asyncUtils from '@testing-library/dom';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -153,7 +153,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
errors: [{ line: 4, messageId: 'noWaitForSnapshot' }],
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import * as asyncUtils from '@testing-library/dom';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -164,7 +164,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
errors: [{ line: 5, messageId: 'noWaitForSnapshot' }],
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -173,7 +173,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
errors: [{ line: 4, messageId: 'noWaitForSnapshot' }],
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import { ${asyncUtil} } from '@testing-library/dom';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -184,7 +184,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
errors: [{ line: 5, messageId: 'noWaitForSnapshot' }],
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import * as asyncUtils from '@testing-library/dom';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
@@ -193,7 +193,7 @@ ruleTester.run(RULE_NAME, rule, {
`,
errors: [{ line: 4, messageId: 'noWaitForSnapshot' }],
})),
- ...ASYNC_UTILS.map(asyncUtil => ({
+ ...ASYNC_UTILS.map((asyncUtil) => ({
code: `
import * as asyncUtils from '@testing-library/dom';
test('snapshot calls within ${asyncUtil} are not valid', async () => {
diff --git a/tests/lib/rules/prefer-explicit-assert.test.ts b/tests/lib/rules/prefer-explicit-assert.test.ts
index 5715d134..936c4770 100644
--- a/tests/lib/rules/prefer-explicit-assert.test.ts
+++ b/tests/lib/rules/prefer-explicit-assert.test.ts
@@ -77,7 +77,7 @@ ruleTester.run(RULE_NAME, rule, {
],
invalid: [
- ...ALL_QUERIES_METHODS.map(queryMethod => ({
+ ...ALL_QUERIES_METHODS.map((queryMethod) => ({
code: `get${queryMethod}('foo')`,
errors: [
{
@@ -85,7 +85,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_QUERIES_METHODS.map(queryMethod => ({
+ ...ALL_QUERIES_METHODS.map((queryMethod) => ({
code: `const utils = render()
utils.get${queryMethod}('foo')`,
@@ -97,7 +97,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_QUERIES_METHODS.map(queryMethod => ({
+ ...ALL_QUERIES_METHODS.map((queryMethod) => ({
code: `() => {
get${queryMethod}('foo')
doSomething()
diff --git a/tests/lib/rules/prefer-find-by.test.ts b/tests/lib/rules/prefer-find-by.test.ts
index 2e64829e..eacef738 100644
--- a/tests/lib/rules/prefer-find-by.test.ts
+++ b/tests/lib/rules/prefer-find-by.test.ts
@@ -30,7 +30,7 @@ function createScenario<
return WAIT_METHODS.reduce(
(acc: T[], waitMethod) =>
acc.concat(
- SYNC_QUERIES_COMBINATIONS.map(queryMethod =>
+ SYNC_QUERIES_COMBINATIONS.map((queryMethod) =>
callback(waitMethod, queryMethod)
)
),
@@ -40,19 +40,19 @@ function createScenario<
ruleTester.run(RULE_NAME, rule, {
valid: [
- ...ASYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ASYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `
const { ${queryMethod} } = setup()
const submitButton = await ${queryMethod}('foo')
`,
})),
- ...ASYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ASYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `const submitButton = await screen.${queryMethod}('foo')`,
})),
- ...SYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...SYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `await waitForElementToBeRemoved(() => ${queryMethod}(baz))`,
})),
- ...SYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...SYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `await waitFor(function() {
return ${queryMethod}('baz', { name: 'foo' })
})`,
@@ -66,7 +66,7 @@ ruleTester.run(RULE_NAME, rule, {
{
code: `await waitForElementToBeRemoved(document.querySelector('foo'))`,
},
- ...SYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...SYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `
await waitFor(() => {
foo()
@@ -74,12 +74,12 @@ ruleTester.run(RULE_NAME, rule, {
})
`,
})),
- ...SYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...SYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `
await waitFor(() => expect(screen.${queryMethod}('baz')).toBeDisabled());
`,
})),
- ...SYNC_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...SYNC_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `
await waitFor(() => expect(${queryMethod}('baz')).toBeInTheDocument());
`,
diff --git a/tests/lib/rules/prefer-presence-queries.test.ts b/tests/lib/rules/prefer-presence-queries.test.ts
index 2a5dd09c..fbc26df0 100644
--- a/tests/lib/rules/prefer-presence-queries.test.ts
+++ b/tests/lib/rules/prefer-presence-queries.test.ts
@@ -7,11 +7,11 @@ import { ALL_QUERIES_METHODS } from '../../../lib/utils';
const ruleTester = createRuleTester();
-const getByQueries = ALL_QUERIES_METHODS.map(method => `get${method}`);
-const getAllByQueries = ALL_QUERIES_METHODS.map(method => `getAll${method}`);
-const queryByQueries = ALL_QUERIES_METHODS.map(method => `query${method}`);
+const getByQueries = ALL_QUERIES_METHODS.map((method) => `get${method}`);
+const getAllByQueries = ALL_QUERIES_METHODS.map((method) => `getAll${method}`);
+const queryByQueries = ALL_QUERIES_METHODS.map((method) => `query${method}`);
const queryAllByQueries = ALL_QUERIES_METHODS.map(
- method => `queryAll${method}`
+ (method) => `queryAll${method}`
);
const allQueryUseInAssertion = (queryName: string) => [
@@ -20,7 +20,7 @@ const allQueryUseInAssertion = (queryName: string) => [
];
const getValidAssertion = (query: string, matcher: string) =>
- allQueryUseInAssertion(query).map(query => ({
+ allQueryUseInAssertion(query).map((query) => ({
code: `expect(${query}('Hello'))${matcher}`,
}));
@@ -29,7 +29,7 @@ const getInvalidAssertion = (
matcher: string,
messageId: MessageIds
) =>
- allQueryUseInAssertion(query).map(query => ({
+ allQueryUseInAssertion(query).map((query) => ({
code: `expect(${query}('Hello'))${matcher}`,
errors: [{ messageId }],
}));
diff --git a/tests/lib/rules/prefer-screen-queries.test.ts b/tests/lib/rules/prefer-screen-queries.test.ts
index b9124570..cbaa0e44 100644
--- a/tests/lib/rules/prefer-screen-queries.test.ts
+++ b/tests/lib/rules/prefer-screen-queries.test.ts
@@ -9,7 +9,7 @@ ruleTester.run(RULE_NAME, rule, {
{
code: `const baz = () => 'foo'`,
},
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `screen.${queryMethod}()`,
})),
{
@@ -18,19 +18,19 @@ ruleTester.run(RULE_NAME, rule, {
{
code: `component.otherFunctionShouldNotThrow()`,
},
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `within(component).${queryMethod}()`,
})),
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `within(screen.${queryMethod}()).${queryMethod}()`,
})),
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `
const { ${queryMethod} } = within(screen.getByText('foo'))
${queryMethod}(baz)
`,
})),
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `
const myWithinVariable = within(foo)
myWithinVariable.${queryMethod}('baz')
@@ -128,7 +128,7 @@ ruleTester.run(RULE_NAME, rule, {
],
invalid: [
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `
const { ${queryMethod} } = render(foo)
${queryMethod}()`,
@@ -141,7 +141,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `render().${queryMethod}()`,
errors: [
{
@@ -152,7 +152,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `render(foo, { hydrate: true }).${queryMethod}()`,
errors: [
{
@@ -163,7 +163,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `component.${queryMethod}()`,
errors: [
{
@@ -174,7 +174,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `
const { ${queryMethod} } = render()
${queryMethod}(baz)
@@ -188,7 +188,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `
const myRenderVariable = render()
myRenderVariable.${queryMethod}(baz)
@@ -202,7 +202,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `
const [myVariable] = render()
myVariable.${queryMethod}(baz)
@@ -216,7 +216,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `
const { ${queryMethod} } = render(baz, { hydrate: true })
${queryMethod}(baz)
@@ -230,7 +230,7 @@ ruleTester.run(RULE_NAME, rule, {
},
],
})),
- ...ALL_QUERIES_COMBINATIONS.map(queryMethod => ({
+ ...ALL_QUERIES_COMBINATIONS.map((queryMethod) => ({
code: `
const [myVariable] = within()
myVariable.${queryMethod}(baz)
diff --git a/tests/lib/rules/prefer-user-event.test.ts b/tests/lib/rules/prefer-user-event.test.ts
index 3f6555d2..1ff87da0 100644
--- a/tests/lib/rules/prefer-user-event.test.ts
+++ b/tests/lib/rules/prefer-user-event.test.ts
@@ -20,7 +20,7 @@ function createScenarioWithImport<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(acc: any, libraryModule) =>
acc.concat(
- Object.keys(MappingToUserEvent).map(fireEventMethod =>
+ Object.keys(MappingToUserEvent).map((fireEventMethod) =>
callback(libraryModule, fireEventMethod)
)
),
@@ -44,7 +44,7 @@ ruleTester.run(RULE_NAME, rule, {
const element = utils.getByText(foo)
`,
},
- ...UserEventMethods.map(userEventMethod => ({
+ ...UserEventMethods.map((userEventMethod) => ({
code: `
import userEvent from '@testing-library/user-event'
const node = document.createElement(elementType)
@@ -80,7 +80,7 @@ ruleTester.run(RULE_NAME, rule, {
options: [{ allowedMethods: [fireEventMethod] }],
})
),
- ...LIBRARY_MODULES.map(libraryModule => ({
+ ...LIBRARY_MODULES.map((libraryModule) => ({
// imported fireEvent and not used,
code: `
import { fireEvent } from '${libraryModule}'
@@ -88,7 +88,7 @@ ruleTester.run(RULE_NAME, rule, {
foo.baz()
`,
})),
- ...LIBRARY_MODULES.map(libraryModule => ({
+ ...LIBRARY_MODULES.map((libraryModule) => ({
// imported dom, but not using fireEvent
code: `
import * as dom from '${libraryModule}'
@@ -96,7 +96,7 @@ ruleTester.run(RULE_NAME, rule, {
const foo = dom.screen.container.querySelector('baz')
`,
})),
- ...LIBRARY_MODULES.map(libraryModule => ({
+ ...LIBRARY_MODULES.map((libraryModule) => ({
code: `
import { fireEvent as aliasedFireEvent } from '${libraryModule}'
function fireEvent() {