eslint-plugin-angular
Advanced tools
Comparing version 3.3.0 to 4.0.0
{ | ||
"name": "eslint-plugin-angular", | ||
"version": "3.3.0", | ||
"version": "4.0.0", | ||
"description": "ESLint rules for AngularJS projects", | ||
@@ -24,15 +24,15 @@ "main": "index.js", | ||
"devDependencies": { | ||
"chai": "4.1.2", | ||
"chai": "4.2.0", | ||
"chai-spies": "1.0.0", | ||
"coveralls": "3.0.0", | ||
"eslint": "4.17.0", | ||
"espree": "3.5.3", | ||
"coveralls": "3.0.2", | ||
"eslint": "5.7.0", | ||
"espree": "4.1.0", | ||
"gulp": "4.0.0", | ||
"gulp-eslint": "4.0.2", | ||
"gulp-eslint": "5.0.0", | ||
"gulp-istanbul": "1.1.3", | ||
"gulp-mocha": "5.0.0", | ||
"gulp-mocha": "6.0.0", | ||
"istanbul": "0.4.5", | ||
"mocha": "5.0.1", | ||
"mocha": "5.2.0", | ||
"parse-comments": "0.4.3", | ||
"shelljs": "0.8.1", | ||
"shelljs": "0.8.2", | ||
"shelljs-nodecli": "0.1.1" | ||
@@ -39,0 +39,0 @@ }, |
@@ -27,3 +27,3 @@ /** | ||
function check(node, name) { | ||
if (bad.indexOf(name) >= 0 && scope.indexOf(node.parent.object.name) >= 0) { | ||
if (bad.indexOf(name) >= 0 && node && node.parent && node.parent.object && scope.indexOf(node.parent.object.name) >= 0) { | ||
context.report(node, `The ${name} method should be replaced by $${name}, or you should rename it in order to avoid confusions`, {}); | ||
@@ -30,0 +30,0 @@ } |
@@ -26,3 +26,3 @@ /** | ||
// This collects the variable scopes for the injectible functions which have been collected. | ||
// This collects the variable scopes for the injectable functions which have been collected. | ||
function collectAngularScopes(scope) { | ||
@@ -45,2 +45,7 @@ if (visitedScopes.indexOf(scope) === -1) { | ||
} | ||
if (scope.type === 'function-expression-name') { | ||
return; | ||
} | ||
scope.variables.forEach(function(variable) { | ||
@@ -76,3 +81,2 @@ if (variable.name === 'arguments') { | ||
// Actually find and report unused injected variables. | ||
'Program:exit': function() { | ||
@@ -79,0 +83,0 @@ var globalScope = context.getScope(); |
@@ -8,2 +8,3 @@ /** | ||
* The options 'ignoreTypeSuffix' ignores camel cased suffixes like 'someController' or 'myService' and 'ignorePrefix' ignores namespace prefixes like 'ui'. | ||
* It's possible to specify a regexp for ignorePrefix. Example RegExp: "/^ui./". | ||
* | ||
@@ -113,2 +114,6 @@ * The naming scheme is <componentName><typeSeparator><componentType>.js | ||
removePrefix: function(name, options) { | ||
if (utils.isStringRegexp(options.ignorePrefix)) { | ||
return this.firstToLower(name.replace(utils.convertStringToRegex(options.ignorePrefix), '')); | ||
} | ||
var regName = '^' + options.ignorePrefix.replace(/[\.]/g, '\\$&'); | ||
@@ -115,0 +120,0 @@ regName += options.ignorePrefix.indexOf('\.') === -1 ? '[A-Z]' : '[a-zA-z]'; |
@@ -37,3 +37,3 @@ /** | ||
var angularObjectList = ['animation', 'config', 'constant', 'controller', 'directive', 'factory', 'filter', 'provider', 'service', 'value', 'decorator']; | ||
var configType = context.options[0] || 'anonymous'; | ||
var configType = context.options[0] || 'named'; | ||
var messageByConfigType = { | ||
@@ -40,0 +40,0 @@ anonymous: 'Use anonymous functions instead of named function', |
@@ -54,6 +54,13 @@ /** | ||
} | ||
fnNode.body.body.forEach(function(statement) { | ||
if (statement.type === 'ReturnStatement') { | ||
var body = fnNode.body.body ? fnNode.body.body : [fnNode.body]; | ||
body.forEach(function(statement) { | ||
if (statement.type === 'ReturnStatement' || statement.type === 'ObjectExpression') { | ||
// get potential replace node by argument name of empty string for object expressions | ||
var potentialNodes = potentialReplaceNodes[statement.argument.name || '']; | ||
var potentialNodes = potentialReplaceNodes['']; | ||
if (statement.argument) { | ||
potentialNodes = potentialReplaceNodes[statement.argument.name || '']; | ||
} | ||
if (!potentialNodes) { | ||
@@ -63,4 +70,6 @@ return; | ||
potentialNodes.forEach(function(report) { | ||
var block = statement.parent.type === 'ArrowFunctionExpression' ? statement : statement.parent; | ||
// only reports nodes that belong to the same expression | ||
if (report.block === statement.parent) { | ||
if (report.block === block) { | ||
context.report(report.node, 'Directive definition property replace is deprecated.'); | ||
@@ -107,2 +116,7 @@ } | ||
} | ||
// report directly if object is part of a arrow function and inside a directive body | ||
if (objectExpressionParent.type === 'ArrowFunctionExpression') { | ||
addPotentialReplaceNode('', node); | ||
} | ||
} | ||
@@ -109,0 +123,0 @@ }; |
@@ -113,3 +113,3 @@ 'use strict'; | ||
if (string[0] === '/' && string[string.length - 1] === '/') { | ||
string = string.substring(1, string.length - 2); | ||
string = string.substring(1, string.length - 1); | ||
} | ||
@@ -277,3 +277,3 @@ return new RegExp(string); | ||
isLiteralType(node.arguments[0]) && | ||
node.arguments[1].type === 'ObjectExpression' && | ||
(node.arguments[1].type === 'ObjectExpression' || isIdentifierType(node.arguments[1])) && | ||
isMemberExpression(node.callee) && | ||
@@ -280,0 +280,0 @@ node.callee.property.name === 'component'; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
295310
4894