From 22caa4e0a0f36d8c069276a2ccf568c89679c6e5 Mon Sep 17 00:00:00 2001 From: Tilman Potthof Date: Sun, 6 Dec 2015 21:35:16 +0100 Subject: [PATCH 1/2] add tests for di false positives (#99) --- test/di.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 // ------------------------------------------------------------------------------ From 217e3891d8ef4568e8d41339547777e8e7444eda Mon Sep 17 00:00:00 2001 From: Tilman Potthof Date: Sun, 6 Dec 2015 21:35:47 +0100 Subject: [PATCH 2/2] remove value from di checks (fixes #99) --- rules/di.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/di.js b/rules/di.js index 3c92416b..669437a6 100644 --- a/rules/di.js +++ b/rules/di.js @@ -11,7 +11,7 @@ module.exports = function(context) { var utils = require('./utils/utils'); - 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', {