eslint-plugin-hammerhead
Advanced tools
Comparing version 0.0.8 to 0.1.0
@@ -1,16 +0,47 @@ | ||
"use strict"; | ||
'use strict'; | ||
module.exports = { | ||
rules: { | ||
'proto-methods': require('./rules/proto-methods'), | ||
'use-hh-promise': require('./rules/use-hh-promise'), | ||
'proto-methods': require('./rules/proto-methods'), | ||
'use-hh-promise': require('./rules/use-hh-promise'), | ||
'use-native-methods': require('./rules/use-native-methods'), | ||
'no-window-self': require('./rules/no-window-self') | ||
'no-window-self': require('./rules/no-window-self') | ||
}, | ||
rulesConfig: { | ||
'proto-methods': 0, | ||
'use-hh-promise': 0, | ||
'proto-methods': 0, | ||
'use-hh-promise': 0, | ||
'use-native-methods': 0, | ||
'no-window-self': 0 | ||
'no-window-self': 0 | ||
}, | ||
configs: { | ||
recommended: { | ||
rules: { | ||
'no-restricted-globals': [2, 'Object', 'JSON'], | ||
'no-restricted-properties': [2, | ||
{ | ||
'object': 'childNodes', | ||
'property': 'length', | ||
'message': 'Please use the "nodeListLengthGetter" from native methods instead.' | ||
}, | ||
{ | ||
'object': 'children', | ||
'property': 'length', | ||
'message': 'Please use the "htmlCollectionLengthGetter" from native methods instead.' | ||
}, | ||
{ | ||
'property': 'childElementCount', | ||
'message': 'Please use the "elementChildElementCountGetter" from native methods instead.' | ||
}, | ||
{ | ||
'property': 'files', | ||
'message': 'Please use the "inputFilesGetter" from native methods instead.' | ||
}, | ||
{ | ||
'property': 'value', | ||
'message': 'Please use getters and setters for input and textarea elements from native methods instead.' | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}; |
@@ -5,3 +5,2 @@ module.exports = function (context) { | ||
var ILLEGAL_ARRAY_FUNC_NAMES = ['filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight']; | ||
var ILLEGAL_REGEXP_FUNC_NAMES = ['test', 'exec']; | ||
@@ -22,5 +21,2 @@ return { | ||
return context.report(node, module.exports.USING_OBJECT_PROTO_DIRECTLY_ERR_MSG); | ||
if (childNode.object.name === 'RegExp') | ||
return context.report(node, module.exports.USING_REGEXP_PROTO_DIRECTLY_ERR_MSG); | ||
} | ||
@@ -32,5 +28,2 @@ } | ||
if (ILLEGAL_REGEXP_FUNC_NAMES.indexOf(property.name) !== -1) | ||
return context.report(node, module.exports.USING_ILLEGAL_REGEXP_FUNC_ERR_MSG.replace('%s', property.name)); | ||
if (property.name === 'bind') | ||
@@ -45,5 +38,3 @@ return context.report(node, module.exports.USING_BIND_FUNCTION_ERR_MSG); | ||
module.exports.USING_OBJECT_PROTO_DIRECTLY_ERR_MSG = 'Forbidden to call a function directly from the prototype Object (GH-245)'; | ||
module.exports.USING_REGEXP_PROTO_DIRECTLY_ERR_MSG = 'Forbidden to call a function directly from the prototype RegExp (GH-1098)'; | ||
module.exports.USING_ILLEGAL_ARRAY_FUNC_ERR_MSG = 'Forbidden to use the "%s" function because it is slower than inline code and may be replaced by any framework (GH-245)'; | ||
module.exports.USING_ILLEGAL_REGEXP_FUNC_ERR_MSG = 'Forbidden to use the "%s" function because it may be replaced by any framework (GH-1098)'; | ||
module.exports.USING_BIND_FUNCTION_ERR_MSG = 'Forbidden to use the "bind" function because it is slower than "call" or "apply" (GH-359)'; |
{ | ||
"name": "eslint-plugin-hammerhead", | ||
"version": "0.0.8", | ||
"version": "0.1.0", | ||
"description": "Specific rules for the hammerhead.", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/LavrovArtem/eslint-plugin-hammerhead.git" | ||
}, | ||
"keywords": [ | ||
@@ -13,3 +17,3 @@ "eslint", | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "mocha tests --recursive" | ||
}, | ||
@@ -20,8 +24,9 @@ "dependencies": { | ||
"devDependencies": { | ||
"eslint": "^2.13.1" | ||
"eslint": "~3.9.1", | ||
"mocha": "^3.1.2" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">= 4.0.0" | ||
}, | ||
"license": "ISC" | ||
} |
@@ -16,5 +16,3 @@ 'use strict'; | ||
'savedObjectMethod.apply(x, [y]);', | ||
'filter();', | ||
'storedTest.call(re, str);', | ||
'exec(re, "abc")' | ||
'filter();' | ||
], | ||
@@ -40,10 +38,2 @@ | ||
{ | ||
code: 'RegExp.prototype.method.call(x);', | ||
errors: [{ message: rule.USING_REGEXP_PROTO_DIRECTLY_ERR_MSG }] | ||
}, | ||
{ | ||
code: 'RegExp.prototype.method.apply(x, []);', | ||
errors: [{ message: rule.USING_REGEXP_PROTO_DIRECTLY_ERR_MSG }] | ||
}, | ||
{ | ||
code: 'arr.filter()', | ||
@@ -79,12 +69,4 @@ errors: [{ message: rule.USING_ILLEGAL_ARRAY_FUNC_ERR_MSG.replace('%s', 'filter') }] | ||
errors: [{ message: rule.USING_BIND_FUNCTION_ERR_MSG }] | ||
}, | ||
{ | ||
code: '/abc/.test("abcd")', | ||
errors: [{ message: rule.USING_ILLEGAL_REGEXP_FUNC_ERR_MSG.replace('%s', 'test') }] | ||
}, | ||
{ | ||
code: '/123/.exec(str)', | ||
errors: [{ message: rule.USING_ILLEGAL_REGEXP_FUNC_ERR_MSG.replace('%s', 'exec') }] | ||
} | ||
] | ||
}); |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
0
20414
2
11
423