eslint-plugin-richlab
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -7,4 +7,4 @@ 'use strict'; | ||
var message = { | ||
width: "Use document.documentElement.clientWidth instead of window.innerHeight", | ||
height: "Use document.documentElement.clientHeight instead of window.innerHeight" | ||
width: 'Use document.documentElement.clientWidth instead of window.innerHeight', | ||
height: 'Use document.documentElement.clientHeight instead of window.innerHeight' | ||
}; | ||
@@ -18,5 +18,19 @@ | ||
if (object.name === 'window' && property.name.match(/^inner(Width|Height)$/)) { | ||
if (object.name === 'window' && /^inner(Width|Height)$/.test(property.name)) { | ||
context.report(node, message[RegExp.$1.toLowerCase()]); | ||
} | ||
}, | ||
VariableDeclarator: function VariableDeclarator(node) { | ||
var id = node.id; | ||
var init = node.init; | ||
if (!(init.type === 'Identifier' && init.name === 'window' && id.type === 'ObjectPattern')) { | ||
return; | ||
} | ||
id.properties.forEach(function (property) { | ||
if (/^inner(Width|Height)$/.test(property.key.name)) { | ||
context.report(property, message[RegExp.$1.toLowerCase()]); | ||
} | ||
}); | ||
} | ||
@@ -23,0 +37,0 @@ }; |
{ | ||
"name": "eslint-plugin-richlab", | ||
"description": "An ESLint plugin created by RichLab", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"author": "Hiroyuki ANAI<pirosikick@gmail.com>", | ||
@@ -14,2 +14,7 @@ "bugs": { | ||
"url": "https://github.com/bonegollira" | ||
}, | ||
{ | ||
"name": "Kojiro Ozaki", | ||
"email": "koujirou0111@gmail.com", | ||
"url": "https://github.com/koozaki" | ||
} | ||
@@ -49,6 +54,7 @@ ], | ||
"prepublish": "npm build && npm test && npm run build", | ||
"test": "mocha --compilers js:babel-core/register tests/**/*.js", | ||
"test": "npm run build && mocha tests --recursive --compilers js:babel-core/register", | ||
"watch": "npm run watch-build & npm run watch-test", | ||
"watch-build": "babel -w src -d lib", | ||
"watch-test": "mocha -w --compilers js:babel-core/register tests/**/*.js" | ||
"watch-test": "mocha -w tests --recursive --compilers js:babel-core/register" | ||
} | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5002
54
0