![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mets.corals.io/wp-content/themes/metras/node_modules/eslint/lib/rules/ |
/** * @fileoverview Rule to disallow use of the new operator with the `Symbol` object * @author Alberto RodrÃguez */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = { meta: { type: "problem", docs: { description: "disallow `new` operators with the `Symbol` object", category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/no-new-symbol" }, schema: [] }, create(context) { return { "Program:exit"() { const globalScope = context.getScope(); const variable = globalScope.set.get("Symbol"); if (variable && variable.defs.length === 0) { variable.references.forEach(ref => { const node = ref.identifier; if (node.parent && node.parent.type === "NewExpression") { context.report({ node, message: "`Symbol` cannot be called as a constructor." }); } }); } } }; } };