Skip to content

chore: update dependencies + run prettier on codebase #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
singleQuote: true,
};
4 changes: 0 additions & 4 deletions .prettierrc.json

This file was deleted.

5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/await-async-utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () =>
Expand Down
12 changes: 6 additions & 6 deletions docs/rules/consistent-data-testid.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 => <div data-testid="my-test-id">...</div>;
const foo = props => <div data-testid="myTestId">...</div>;
const foo = props => <div data-testid="TestIdEXAMPLE">...</div>;
const foo = (props) => <div data-testid="my-test-id">...</div>;
const foo = (props) => <div data-testid="myTestId">...</div>;
const foo = (props) => <div data-testid="TestIdEXAMPLE">...</div>;
```

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

```js
const foo = props => <div data-testid="TestId__EXAMPLE">...</div>;
const bar = props => <div data-testid="TestId">...</div>;
const baz = props => <div>...</div>;
const foo = (props) => <div data-testid="TestId__EXAMPLE">...</div>;
const bar = (props) => <div data-testid="TestId">...</div>;
const baz = (props) => <div>...</div>;
```

## Options
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-multiple-assertions-wait-for.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const foo = async () => {
});

// or
await waitFor(function() {
await waitFor(function () {
expect(a).toEqual('a');
expect(b).toEqual('b');
});
Expand All @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-wait-for-empty-callback.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
```
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-find-by.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand Down
2 changes: 1 addition & 1 deletion lib/node-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/await-async-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
});
},
'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;

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/await-fire-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
},
defaultOptions: [],

create: function(context) {
create: function (context) {
return {
'CallExpression > MemberExpression > Identifier[name=fireEvent]'(
node: TSESTree.Identifier
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
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'
Expand All @@ -93,7 +93,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
} else {
isObjectPattern(nodeValue) &&
nodeValue.properties.forEach(
property =>
(property) =>
isProperty(property) &&
isIdentifier(property.key) &&
destructuredContainerPropNames.push(property.key.name)
Expand Down
12 changes: 6 additions & 6 deletions lib/rules/no-debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
if (
isObjectPattern(node.id) &&
node.id.properties.some(
property =>
(property) =>
isProperty(property) &&
isIdentifier(property.key) &&
property.key.name === 'debug'
Expand All @@ -84,7 +84,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
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)
Expand All @@ -100,7 +100,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
hasImportedScreen =
isObjectPattern(declaratorNode.id) &&
declaratorNode.id.properties.some(
property =>
(property) =>
isProperty(property) &&
isIdentifier(property.key) &&
property.key.name === 'screen'
Expand All @@ -114,7 +114,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
}

hasImportedScreen = node.specifiers.some(
s => isImportSpecifier(s) && s.imported.name === 'screen'
(s) => isImportSpecifier(s) && s.imported.name === 'screen'
);
},
// checks if import has shape:
Expand Down Expand Up @@ -171,11 +171,11 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
}
},
'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) &&
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-dom-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
ImportDeclaration(node) {
const value = node.source.value;
const domModuleName = DOM_TESTING_LIBRARY_MODULES.find(
module => module === value
(module) => module === value
);

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

const literalNodeDomModuleName = args.find(
args =>
(args) =>
isLiteral(args) &&
typeof args.value === 'string' &&
DOM_TESTING_LIBRARY_MODULES.includes(args.value)
Expand Down
8 changes: 4 additions & 4 deletions lib/rules/no-manual-cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
// 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) &&
Expand Down Expand Up @@ -75,7 +75,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
}

const cleanupSpecifier = node.specifiers.find(
specifier =>
(specifier) =>
isImportSpecifier(specifier) &&
specifier.imported &&
specifier.imported.name === 'cleanup'
Expand All @@ -94,7 +94,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
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)
Expand All @@ -109,7 +109,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({

if (isObjectPattern(declaratorNode.id)) {
const cleanupProperty = declaratorNode.id.properties.find(
property =>
(property) =>
isProperty(property) &&
isIdentifier(property.key) &&
property.key.name === 'cleanup'
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-multiple-assertions-wait-for.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
schema: [],
},
defaultOptions: [],
create: function(context) {
create: function (context) {
function reportMultipleAssertion(node: TSESTree.BlockStatement) {
const totalExpect = (body: Array<TSESTree.Node>): Array<TSESTree.Node> =>
body.filter((node: TSESTree.ExpressionStatement) => {
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/no-promise-in-fire-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
node: TSESTree.ImportDeclaration
) {
const fireEventImportNode = node.specifiers.find(
specifier =>
(specifier) =>
isImportSpecifier(specifier) &&
specifier.imported &&
'fireEvent' === specifier.imported.name
Expand All @@ -58,7 +58,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
.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({
Expand Down
8 changes: 4 additions & 4 deletions lib/rules/no-render-in-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
'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'
);
Expand All @@ -110,7 +110,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
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)
Expand All @@ -124,7 +124,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
renderImportedFromTestingLib =
isObjectPattern(declaratorNode.id) &&
declaratorNode.id.properties.some(
property =>
(property) =>
isProperty(property) &&
isIdentifier(property.key) &&
property.key.name === 'render'
Expand All @@ -134,7 +134,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
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(
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-side-effects-wait-for.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
schema: [],
},
defaultOptions: [],
create: function(context) {
create: function (context) {
let isImportingTestingLibrary = false;

function reportSideEffects(node: TSESTree.BlockStatement) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-wait-for-empty-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({

// 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
) {
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/no-wait-for-snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
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;

Expand Down Expand Up @@ -109,8 +109,8 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
return null;
}

snapshotUsage.forEach(node => {
testingLibraryUtilUsage.forEach(asyncUtilUsage => {
snapshotUsage.forEach((node) => {
testingLibraryUtilUsage.forEach((asyncUtilUsage) => {
const closestAsyncUtil = getClosestAsyncUtil(asyncUtilUsage, node);
if (closestAsyncUtil != null) {
let name;
Expand Down
Loading