Skip to content

Commit 092ce8c

Browse files
committed
Issue #444 Rule typecheck-object is failed for simple comparing with 'object'
1 parent b561aa4 commit 092ce8c

File tree

6 files changed

+6
-0
lines changed

6 files changed

+6
-0
lines changed

test/typecheck-array.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ eslintTester.run('typecheck-array', rule, {
1919
].concat(commonFalsePositives),
2020
invalid: [
2121
{code: 'Object.prototype.toString.call([]) === "[object Array]"', errors: [{message: 'You should use the angular.isArray method'}]},
22+
{code: 'function name(){return variable === "[object Array]";}', errors: [{message: 'You should use the angular.isArray method'}]},
2223
{code: '"[object Array]" === Object.prototype.toString.call([])', errors: [{message: 'You should use the angular.isArray method'}]},
2324
{code: 'variable === "[object Array]"', errors: [{message: 'You should use the angular.isArray method'}]},
2425
{code: '"[object Array]" === variable', errors: [{message: 'You should use the angular.isArray method'}]},

test/typecheck-date.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ eslintTester.run('typecheck-date', rule, {
1919
].concat(commonFalsePositives),
2020
invalid: [
2121
{code: 'Object.prototype.toString.call(variable) === "[object Date]"', errors: [{message: 'You should use the angular.isDate method'}]},
22+
{code: 'function name(){return variable === "[object Date]";}', errors: [{message: 'You should use the angular.isDate method'}]},
2223
{code: '"[object Date]" === Object.prototype.toString.call(variable)', errors: [{message: 'You should use the angular.isDate method'}]},
2324
{code: 'variable === "[object Date]"', errors: [{message: 'You should use the angular.isDate method'}]},
2425
{code: '"[object Date]" === variable', errors: [{message: 'You should use the angular.isDate method'}]},

test/typecheck-function.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ eslintTester.run('typecheck-function', rule, {
1919
].concat(commonFalsePositives),
2020
invalid: [
2121
{code: 'typeof variable === "function"', errors: [{message: 'You should use the angular.isFunction method'}]},
22+
{code: 'function name(){return variable === "function";}', errors: [{message: 'You should use the angular.isFunction method'}]},
2223
{code: '"function" === typeof variable', errors: [{message: 'You should use the angular.isFunction method'}]},
2324
{code: 'variable === "function"', errors: [{message: 'You should use the angular.isFunction method'}]},
2425
{code: '"function" === variable', errors: [{message: 'You should use the angular.isFunction method'}]},

test/typecheck-number.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ eslintTester.run('typecheck-number', rule, {
1919
].concat(commonFalsePositives),
2020
invalid: [
2121
{code: 'Object.prototype.toString.call(variable) === "[object Number]"', errors: [{message: 'You should use the angular.isNumber method'}]},
22+
{code: 'function name(){return variable === "[object Number]";}', errors: [{message: 'You should use the angular.isNumber method'}]},
2223
{code: '"[object Number]" === Object.prototype.toString.call(variable)', errors: [{message: 'You should use the angular.isNumber method'}]},
2324
{code: 'variable === "[object Number]"', errors: [{message: 'You should use the angular.isNumber method'}]},
2425
{code: '"[object Number]" === variable', errors: [{message: 'You should use the angular.isNumber method'}]},

test/typecheck-object.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ eslintTester.run('typecheck-object', rule, {
1919
].concat(commonFalsePositives),
2020
invalid: [
2121
{code: 'typeof variable === "object"', errors: [{message: 'You should use the angular.isObject method'}]},
22+
{code: 'function name(){return variable === "object";}', errors: [{message: 'You should use the angular.isObject method'}]},
2223
{code: '"object" === typeof variable', errors: [{message: 'You should use the angular.isObject method'}]},
2324
{code: 'variable === "object"', errors: [{message: 'You should use the angular.isObject method'}]},
2425
{code: '"object" === variable', errors: [{message: 'You should use the angular.isObject method'}]},

test/typecheck-string.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ eslintTester.run('typecheck-string', rule, {
1919
].concat(commonFalsePositives),
2020
invalid: [
2121
{code: 'Object.prototype.toString.call(variable) === "[object String]"', errors: [{message: 'You should use the angular.isString method'}]},
22+
{code: 'function name(){return variable === "[object String]";}', errors: [{message: 'You should use the angular.isString method'}]},
2223
{code: '"[object String]" === Object.prototype.toString.call(variable)', errors: [{message: 'You should use the angular.isString method'}]},
2324
{code: 'variable === "[object String]"', errors: [{message: 'You should use the angular.isString method'}]},
2425
{code: '"[object String]" === variable', errors: [{message: 'You should use the angular.isString method'}]},

0 commit comments

Comments
 (0)