New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-react-native-require-testid

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-react-native-require-testid - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

41

lib/index.js

@@ -12,20 +12,29 @@ module.exports = {

},
create(context) {
return {
JSXOpeningElement(node) {
const elementName = node.name.name;
const hasTestIDAttribute = node.attributes.some(
(attr) =>
attr.type === "JSXAttribute" &&
attr.name.name === "testID"
);
if(!hasTestIDAttribute) {
context.report({
node,
message: `React Native component <${elementName}> should have a testID attribute.`,
});
}
rules: {
"testid-missing": {
create(context) {
return {
JSXOpeningElement(node) {
const { name, attributes } = node;
if (!name || !name.name) {
return; // Return early if name or name.name is undefined
}
const componentName = name.name;
const hasTestIDAttribute = attributes.some(
(attribute) =>
attribute.name && attribute.name.name === "testID" // Check if attribute.name is defined before accessing its name property
);
if (!hasTestIDAttribute) {
context.report({
node: name,
message: `React Native component <${componentName}> should have a testID attribute.`,
});
}
},
};
},
};
},
},
};
{
"name": "eslint-plugin-react-native-require-testid",
"version": "1.3.0",
"version": "1.4.0",
"main": "index.js",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -16,7 +16,7 @@ # eslint-plugin-react-native-require-testid

{
"plugins": ["react-native-enforce-testid"],
"plugins": ["react-native-require-testid"],
"rules": {
"react-native-enforce-testid/testid-missing": "error"
"react-native-require-testid/testid-missing": "error"
}
}
```
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