Update checked-in dependencies
This commit is contained in:
parent
4fad06f438
commit
40a500c743
4168 changed files with 298222 additions and 374905 deletions
16
node_modules/eslint/lib/rules/no-new-native-nonconstructor.js
generated
vendored
16
node_modules/eslint/lib/rules/no-new-native-nonconstructor.js
generated
vendored
|
|
@ -23,7 +23,7 @@ module.exports = {
|
|||
docs: {
|
||||
description: "Disallow `new` operators with global non-constructor functions",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/rules/no-new-native-nonconstructor"
|
||||
url: "https://eslint.org/docs/latest/rules/no-new-native-nonconstructor"
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
|
@ -35,21 +35,23 @@ module.exports = {
|
|||
|
||||
create(context) {
|
||||
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
return {
|
||||
"Program:exit"() {
|
||||
const globalScope = context.getScope();
|
||||
"Program:exit"(node) {
|
||||
const globalScope = sourceCode.getScope(node);
|
||||
|
||||
for (const nonConstructorName of nonConstructorGlobalFunctionNames) {
|
||||
const variable = globalScope.set.get(nonConstructorName);
|
||||
|
||||
if (variable && variable.defs.length === 0) {
|
||||
variable.references.forEach(ref => {
|
||||
const node = ref.identifier;
|
||||
const parent = node.parent;
|
||||
const idNode = ref.identifier;
|
||||
const parent = idNode.parent;
|
||||
|
||||
if (parent && parent.type === "NewExpression" && parent.callee === node) {
|
||||
if (parent && parent.type === "NewExpression" && parent.callee === idNode) {
|
||||
context.report({
|
||||
node,
|
||||
node: idNode,
|
||||
messageId: "noNewNonconstructor",
|
||||
data: { name: nonConstructorName }
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue