no-obj-calls

禁止将全局对象属性作为函数调用

配置文件 中的 "extends": "eslint:recommended" 属性启用了该规则

ECMAScript 提供了几个旨在按原样使用的全局对象。其中一些对象看起来好像是构造函数,因为它们的大小写(例如 MathJSON),但如果您尝试将它们作为函数执行,则会引发错误。

ECMAScript 5 规范 明确表示不能调用 MathJSON

Math 对象没有 [[Call]] 内部属性;不能将 Math 对象作为函数调用。

qIjEy8EY8ulzeaxUZ/l62F+Xud3xyUROwlHNc2OYeBsb7DBrMT857EDf8PWfvpEU20LN7inJRerDeib2pTldVtZ/F9AGpd0YHJGEXos3ExtEenW0ybNdUkf2IBU4KoZMzi9YcqLV5DNfo8oa4wPTrrbrR2QgbI3k3H+zR0y37gI=

r7QTWWl/TsxbU+JjfPGsUE4Iaq+inUXPP51W7dzo6vehJubcphSC9r3cm2teIqk4bbpWu3abBSdyfZhFZ8RCygJvmSHYQoM0PPV2TJ4J9uRPn5e4zxAjDSyN6YGljtg1rpgLcgi2qCNMsBaXDLDfNg==

U4zHOZL6Pep43EwNZVUhw+zZ5hk7NQvGo7NVAjVGuwm58j4pKvaH9CXOzyBvGzarw0mAb1cv7+UZcbm0fPSs3xTekgfohuSpsezA6KFr59tiVlbNAmS0Jizzvj7w1pX+DcQED/l8oq11HL7NlQcprRIJLk1dUtjLUqyK7rSv76w=

srRaOHXFRFLf5b9PmfkrUl1bOyHIT8B5h22wJujuXmtMssDkILOQgcwCtU2x7DLkvGf10W9Qprun06oNkTS1dtBNoL3eLQLQRSkL0ZDWohwOqYmZx2khmo/zpU2Ln2883xlHXUJXDC1+l+H8yUdA/w==

X2GCSheJjloMm4KnrQ4AJNJAcFwpYn7CyfUaYTHexyxpDV3Y+HnjA0RmngWzKwbPmHy78X/OGRPVkOo3dFZvJRTrfia+T2prN3jJ8f7EDAmosYV2cwgl2qf3pCo2PN3djwi5Ku43m7WpG7mZE1ciAeVBdvDomdG70r544sN9waCKDoIgBfoDbYc2d7yK8tiP

ak6FiUUMKiM8snJ2LBaQyDVEW52XwZXQWgkeejcR8UTwWVEVFcKo8yUI7MKaNL4tnLBCces/G1KIsVXX9Q2eRJXRb+xwArJzYlkA8CdWx5rGyPq7qHN7pLA/vTgiOkbXxh/sGJRixT2ju7fpkCUbtA==

规则详情

ZM+7UkzS+Zxu8bvSqSbq6KR4+MjCPZ7UxI85DJCpvqjdS8gN1cJmDFnUVZk/q4U7hgsSZXXvx/3fz780KDsw5LOMKbt81KneHwtNK4f8dT5zgtJO0JTPKwpfSH5NvIlPy/e0bDAtaycTl7l+fFGHO3d+nYefaYhP0ue1Fh2PwNA4f3EwQQg8k5q7A0AUrwfu9Qi6G+6Y4YTgGJOjC35oDA==

xcnedys6KQcQHxzmbQxa7oBtoNGwuCTjj9dVXem4SH3bZusOVhltKZN+j1xP8rt1K8NRmicu0EeAkd+BfLLJHydyRnXuw8e8cgYc7PjBveFFLc3P3gW+3DsqBGoznIRs

k7HkpyhTRoT9T3bsrVJ1W9IUT56r3GvYicL0qS8XjwbDvDXG9eGk/CkswpMjh9k+

/*eslint no-obj-calls: "error"*/
/*eslint-env es2017, browser */

var math = Math();

var newMath = new Math();

var json = JSON();

var newJSON = new JSON();

var reflect = Reflect();

var newReflect = new Reflect();

var atomics = Atomics();

var newAtomics = new Atomics();

var intl = Intl();

var newIntl = new Intl();

f/g6SKVZdhoBiPVtnee0m+uPEv1T4kMgIaFUpxdtFwzAZHGBqJ5dJxRHxHHP/cP8

/*eslint no-obj-calls: "error"*/
/*eslint-env es2017, browser*/

function area(r) {
    return Math.PI * r * r;
}

var object = JSON.parse("{}");

var value = Reflect.get({ x: 1, y: 2 }, "x");

var first = Atomics.load(foo, 0);

var segmenterFr = new Intl.Segmenter("fr", { granularity: "word" });