eslint-plugin-testing-library
Advanced tools
Comparing version 6.0.0-alpha.4 to 6.0.0-alpha.5
{ | ||
"name": "eslint-plugin-testing-library", | ||
"version": "6.0.0-alpha.4", | ||
"version": "6.0.0-alpha.5", | ||
"description": "ESLint rules for Testing Library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -209,3 +209,3 @@ <div align="center"> | ||
| ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- | --- | ---------------------------------------------------------------------------------- | | ||
| [`await-async-event`](./docs/rules/await-async-event.md) | Enforce promises from async event methods are handled | | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] | | ||
| [`await-async-event`](./docs/rules/await-async-event.md) | Enforce promises from async event methods are handled | 🔧 | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] | | ||
| [`await-async-query`](./docs/rules/await-async-query.md) | Enforce promises from async queries to be handled | | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] | | ||
@@ -212,0 +212,0 @@ | [`await-async-utils`](./docs/rules/await-async-utils.md) | Enforce promises from async utils to be awaited properly | | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] | |
@@ -29,2 +29,3 @@ "use strict"; | ||
}, | ||
fixable: 'code', | ||
schema: [ | ||
@@ -63,8 +64,9 @@ { | ||
const functionWrappersNames = []; | ||
function reportUnhandledNode(node, closestCallExpressionNode, messageId = 'awaitAsyncEvent') { | ||
function reportUnhandledNode({ node, closestCallExpression, messageId = 'awaitAsyncEvent', fix, }) { | ||
if (!(0, node_utils_1.isPromiseHandled)(node)) { | ||
context.report({ | ||
node: closestCallExpressionNode.callee, | ||
node: closestCallExpression.callee, | ||
messageId, | ||
data: { name: node.name }, | ||
fix, | ||
}); | ||
@@ -95,3 +97,12 @@ } | ||
if (references.length === 0) { | ||
reportUnhandledNode(node, closestCallExpression); | ||
reportUnhandledNode({ | ||
node, | ||
closestCallExpression, | ||
fix: (fixer) => { | ||
if ((0, node_utils_1.isMemberExpression)(node.parent)) { | ||
return fixer.insertTextBefore(node.parent, 'await '); | ||
} | ||
return null; | ||
}, | ||
}); | ||
} | ||
@@ -101,3 +112,6 @@ else { | ||
if (utils_1.ASTUtils.isIdentifier(reference.identifier)) { | ||
reportUnhandledNode(reference.identifier, closestCallExpression); | ||
reportUnhandledNode({ | ||
node: reference.identifier, | ||
closestCallExpression, | ||
}); | ||
} | ||
@@ -112,3 +126,10 @@ } | ||
} | ||
reportUnhandledNode(node, closestCallExpression, 'awaitAsyncEventWrapper'); | ||
reportUnhandledNode({ | ||
node, | ||
closestCallExpression, | ||
messageId: 'awaitAsyncEventWrapper', | ||
fix: (fixer) => { | ||
return fixer.insertTextBefore(node, 'await '); | ||
}, | ||
}); | ||
} | ||
@@ -115,0 +136,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
230813
4079