diff --git a/rules/di.js b/rules/di.js index 30b79b48..2c0973f5 100644 --- a/rules/di.js +++ b/rules/di.js @@ -11,7 +11,7 @@ var utils = require('./utils/utils'); module.exports = function(context) { - var angularNamedObjectList = ['value', 'factory', 'service', 'provider', 'controller', 'filter', 'directive']; + var angularNamedObjectList = ['factory', 'service', 'provider', 'controller', 'filter', 'directive']; function report(node, syntax) { context.report(node, 'You should use the {{syntax}} syntax for DI', { diff --git a/test/di.js b/test/di.js index 6adcb922..24883425 100644 --- a/test/di.js +++ b/test/di.js @@ -9,7 +9,7 @@ var RuleTester = require('eslint').RuleTester; var commonFalsePositives = require('./utils/commonFalsePositives'); -var angularNamedObjectList = ['value', 'factory', 'service', 'provider', 'controller', 'filter', 'directive']; +var angularNamedObjectList = ['factory', 'service', 'provider', 'controller', 'filter', 'directive']; var angularObjectList = ['run', 'config']; @@ -153,7 +153,19 @@ valid.push({ }, { code: 'mocha.run();', options: ['array'] +}, { + code: 'mocha.run();', + options: ['array'] +}, { + // value false positive with function + code: 'angular.module("") .value("", function () {});', + options: ['array'] +}, { + // value false positive with array (example from issue #99) + code: 'angular.module("") .value("", [{ }, { }]);', + options: ['function'] }); + // ------------------------------------------------------------------------------ // Tests // ------------------------------------------------------------------------------