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

eslint-plugin-react-native

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 1.1.0 to 1.2.0

1

index.js

@@ -0,1 +1,2 @@

/* eslint-disable global-require */
'use strict'

@@ -2,0 +3,0 @@

6

lib/rules/no-unused-styles.js

@@ -16,3 +16,3 @@ /**

function reportUnusedStyles(unusedStyles) {
for (const key in unusedStyles) {
Object.keys(unusedStyles).forEach((key) => {
if (unusedStyles.hasOwnProperty(key)) {

@@ -31,3 +31,3 @@ const styles = unusedStyles[key];

}
}
});
}

@@ -55,3 +55,3 @@

'Program:exit': function () {
const list = components.list();
const list = components.all();
if (Object.keys(list).length > 0) {

@@ -58,0 +58,0 @@ styleReferences.forEach((reference) => {

@@ -7,4 +7,2 @@ /**

const util = require('util');
/**

@@ -15,4 +13,4 @@ * Components

function Components() {
this._list = {};
this._getId = function (node) {
this.list = {};
this.getId = function (node) {
return node && node.range.join(':');

@@ -29,12 +27,12 @@ };

Components.prototype.add = function (node, confidence) {
const id = this._getId(node);
if (this._list[id]) {
if (confidence === 0 || this._list[id].confidence === 0) {
this._list[id].confidence = 0;
const id = this.getId(node);
if (this.list[id]) {
if (confidence === 0 || this.list[id].confidence === 0) {
this.list[id].confidence = 0;
} else {
this._list[id].confidence = Math.max(this._list[id].confidence, confidence);
this.list[id].confidence = Math.max(this.list[id].confidence, confidence);
}
return;
}
this._list[id] = {
this.list[id] = {
node: node,

@@ -52,4 +50,4 @@ confidence: confidence,

Components.prototype.get = function (node) {
const id = this._getId(node);
return this._list[id];
const id = this.getId(node);
return this.list[id];
};

@@ -65,3 +63,3 @@

let currentNode = node;
while (currentNode && !this._list[this._getId(currentNode)]) {
while (currentNode && !this.list[this.getId(currentNode)]) {
currentNode = node.parent;

@@ -72,4 +70,4 @@ }

}
const id = this._getId(currentNode);
this._list[id] = util._extend(this._list[id], props);
const id = this.getId(currentNode);
this.list[id] = Object.assign({}, this.list[id], props);
};

@@ -83,10 +81,9 @@

*/
Components.prototype.list = function () {
Components.prototype.all = function () {
const list = {};
for (const i in this._list) {
if (!this._list.hasOwnProperty(i) || this._list[i].confidence < 2) {
continue;
Object.keys(this.list).forEach((i) => {
if (this.list.hasOwnProperty(i) && this.list[i].confidence >= 2) {
list[i] = this.list[i];
}
list[i] = this._list[i];
}
});
return list;

@@ -103,8 +100,7 @@ };

let length = 0;
for (const i in this._list) {
if (!this._list.hasOwnProperty(i) || this._list[i].confidence < 2) {
continue;
Object.keys(this.list).forEach((i) => {
if (this.list.hasOwnProperty(i) && this.list[i].confidence >= 2) {
length++;
}
length++;
}
});
return length;

@@ -406,3 +402,3 @@ };

const ruleInstructions = rule(context, components, utils);
const updatedRuleInstructions = util._extend({}, ruleInstructions);
const updatedRuleInstructions = Object.assign({}, ruleInstructions);
Object.keys(detectionInstructions).forEach((instruction) => {

@@ -409,0 +405,0 @@ updatedRuleInstructions[instruction] = (node) => {

@@ -7,3 +7,3 @@ 'use strict';

function StyleSheets() {
this._styleSheets = {};
this.styleSheets = {};
}

@@ -18,3 +18,3 @@

StyleSheets.prototype.add = function (styleSheetName, properties) {
this._styleSheets[styleSheetName] = properties;
this.styleSheets[styleSheetName] = properties;
};

@@ -34,5 +34,5 @@

if (this._styleSheets[styleSheetName]) {
this._styleSheets[styleSheetName] = this
._styleSheets[styleSheetName]
if (this.styleSheets[styleSheetName]) {
this.styleSheets[styleSheetName] = this
.styleSheets[styleSheetName]
.filter((property) => property.key.name !== styleSheetProperty);

@@ -47,3 +47,3 @@ }

StyleSheets.prototype.getUnusedReferences = function () {
return this._styleSheets;
return this.styleSheets;
};

@@ -57,6 +57,6 @@

StyleSheets.prototype.addColorLiterals = function (expressions) {
if (!this._colorLiterals) {
this._colorLiterals = [];
if (!this.colorLiterals) {
this.colorLiterals = [];
}
this._colorLiterals = this._colorLiterals.concat(expressions);
this.colorLiterals = this.colorLiterals.concat(expressions);
};

@@ -69,3 +69,3 @@

StyleSheets.prototype.getColorLiterals = function () {
return this._colorLiterals;
return this.colorLiterals;
};

@@ -79,6 +79,6 @@

StyleSheets.prototype.addObjectExpressions = function (expressions) {
if (!this._objectExpressions) {
this._objectExpressions = [];
if (!this.objectExpressions) {
this.objectExpressions = [];
}
this._objectExpressions = this._objectExpressions.concat(expressions);
this.objectExpressions = this.objectExpressions.concat(expressions);
};

@@ -91,11 +91,10 @@

StyleSheets.prototype.getObjectExpressions = function () {
return this._objectExpressions;
return this.objectExpressions;
};
let _context;
const _getSourceCode = node => _context
let currentContent;
const getSourceCode = node => currentContent
.getSourceCode(node)
.getText(node)
;
.getText(node);

@@ -180,3 +179,3 @@ const astHelpers = {

collectStyleObjectExpressions: function (node, context) {
_context = context;
currentContent = context;
if (astHelpers.hasArrayOfStyleReferences(node)) {

@@ -196,3 +195,3 @@ const styleReferenceContainers = node

collectColorLiterals: function (node, context) {
_context = context;
currentContent = context;
if (astHelpers.hasArrayOfStyleReferences(node)) {

@@ -356,3 +355,3 @@ const styleReferenceContainers = node

invalid = true;
obj[p.key.name] = _getSourceCode(innerNode);
obj[p.key.name] = getSourceCode(innerNode);
}

@@ -376,3 +375,3 @@ } else if (p.value.type === 'UnaryExpression' && p.value.operator === '-') {

node.properties.forEach(p => {
if (p.key.name.toLowerCase().indexOf('color') !== -1) {
if (p.key.name && p.key.name.toLowerCase().indexOf('color') !== -1) {
if (p.value.type === 'Literal') {

@@ -385,3 +384,3 @@ invalid = true;

invalid = true;
obj[p.key.name] = _getSourceCode(innerNode);
obj[p.key.name] = getSourceCode(innerNode);
}

@@ -388,0 +387,0 @@ }

{
"name": "eslint-plugin-react-native",
"version": "1.1.0",
"version": "1.2.0",
"author": "Tom Hastjarjanto <tom@intellicode.nl>",

@@ -26,9 +26,11 @@ "description": "React Native specific linting rules for ESLint",

"devDependencies": {
"babel-eslint": "6.0.0",
"coveralls": "2.11.4",
"eslint": "2.5.1",
"eslint-config-airbnb": "6.2.0",
"eslint-plugin-react": "4.2.3",
"istanbul": "0.4.0",
"mocha": "2.3.3"
"babel-eslint": "6.1.2",
"coveralls": "2.11.11",
"eslint": "2.13.1",
"eslint-config-airbnb": "9.0.1",
"eslint-plugin-import": "^1.9.2",
"eslint-plugin-jsx-a11y": "^1.5.3",
"eslint-plugin-react": "5.2.2",
"istanbul": "0.4.4",
"mocha": "2.5.3"
},

@@ -35,0 +37,0 @@ "keywords": [

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