Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-testing-library

Package Overview
Dependencies
Maintainers
3
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-testing-library - npm Package Compare versions

Comparing version 5.5.0 to 5.5.1

2

package.json
{
"name": "eslint-plugin-testing-library",
"version": "5.5.0",
"version": "5.5.1",
"description": "ESLint rules for Testing Library",

@@ -5,0 +5,0 @@ "keywords": [

@@ -403,2 +403,3 @@ <div align="center">

<td align="center"><a href="https://github.com/themagickoala"><img src="https://avatars.githubusercontent.com/u/48416253?v=4?s=100" width="100px;" alt=""/><br /><sub><b>themagickoala</b></sub></a><br /><a href="https://github.com/testing-library/eslint-plugin-testing-library/commits?author=themagickoala" title="Code">💻</a> <a href="https://github.com/testing-library/eslint-plugin-testing-library/commits?author=themagickoala" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/PrashantAshok"><img src="https://avatars.githubusercontent.com/u/5200733?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Prashant Ashok</b></sub></a><br /><a href="https://github.com/testing-library/eslint-plugin-testing-library/commits?author=PrashantAshok" title="Code">💻</a> <a href="https://github.com/testing-library/eslint-plugin-testing-library/commits?author=PrashantAshok" title="Tests">⚠️</a></td>
</tr>

@@ -405,0 +406,0 @@ </table>

@@ -23,4 +23,4 @@ "use strict";

messages: {
awaitFireEvent: 'Promise returned from `fireEvent.{{ methodName }}` must be handled',
fireEventWrapper: 'Promise returned from `fireEvent.{{ wrapperName }}` wrapper over fire event method must be handled',
awaitFireEvent: 'Promise returned from `fireEvent.{{ name }}` must be handled',
fireEventWrapper: 'Promise returned from `{{ name }}` wrapper over fire event method must be handled',
},

@@ -27,0 +27,0 @@ schema: [],

@@ -11,2 +11,8 @@ "use strict";

];
const correctModuleNameByFramework = {
angular: '@testing-library/angular',
marko: '@marko/testing-library',
};
const getCorrectModuleName = (moduleName, framework) => correctModuleNameByFramework[framework] ||
moduleName.replace('dom', framework);
exports.default = (0, create_testing_library_rule_1.createTestingLibraryRule)({

@@ -31,7 +37,3 @@ name: exports.RULE_NAME,

fixable: 'code',
schema: [
{
type: 'string',
},
],
schema: [{ type: 'string' }],
},

@@ -41,30 +43,24 @@ defaultOptions: [''],

function report(node, moduleName) {
if (framework) {
const correctModuleName = framework === 'marko'
? moduleName.replace('dom-', `@${framework}/`)
: moduleName.replace('dom', framework);
context.report({
if (!framework) {
return context.report({
node,
messageId: 'noDomImportFramework',
data: {
module: correctModuleName,
},
fix(fixer) {
if ((0, node_utils_1.isCallExpression)(node)) {
const name = node.arguments[0];
return fixer.replaceText(name, name.raw.replace(moduleName, correctModuleName));
}
else {
const name = node.source;
return fixer.replaceText(name, name.raw.replace(moduleName, correctModuleName));
}
},
});
}
else {
context.report({
node,
messageId: 'noDomImport',
});
}
const correctModuleName = getCorrectModuleName(moduleName, framework);
context.report({
data: { module: correctModuleName },
fix(fixer) {
if ((0, node_utils_1.isCallExpression)(node)) {
const name = node.arguments[0];
return fixer.replaceText(name, name.raw.replace(moduleName, correctModuleName));
}
else {
const name = node.source;
return fixer.replaceText(name, name.raw.replace(moduleName, correctModuleName));
}
},
messageId: 'noDomImportFramework',
node,
});
}

@@ -71,0 +67,0 @@ return {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc