Bump the npm group with 2 updates (#2045)
* Bump the npm group with 2 updates Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import). Updates `eslint` from 8.55.0 to 8.56.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.55.0...v8.56.0) Updates `eslint-plugin-import` from 2.29.0 to 2.29.1 - [Release notes](https://github.com/import-js/eslint-plugin-import/releases) - [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md) - [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.29.0...v2.29.1) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: eslint-plugin-import dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
511f073971
commit
144b7d5b16
32 changed files with 618 additions and 251 deletions
41
node_modules/eslint/lib/rules/no-restricted-properties.js
generated
vendored
41
node_modules/eslint/lib/rules/no-restricted-properties.js
generated
vendored
|
|
@ -142,40 +142,27 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks property accesses in a destructuring assignment expression, e.g. `var foo; ({foo} = bar);`
|
||||
* @param {ASTNode} node An AssignmentExpression or AssignmentPattern node
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function checkDestructuringAssignment(node) {
|
||||
if (node.right.type === "Identifier") {
|
||||
const objectName = node.right.name;
|
||||
|
||||
if (node.left.type === "ObjectPattern") {
|
||||
node.left.properties.forEach(property => {
|
||||
checkPropertyAccess(node.left, objectName, astUtils.getStaticPropertyName(property));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
MemberExpression(node) {
|
||||
checkPropertyAccess(node, node.object && node.object.name, astUtils.getStaticPropertyName(node));
|
||||
},
|
||||
VariableDeclarator(node) {
|
||||
if (node.init && node.init.type === "Identifier") {
|
||||
const objectName = node.init.name;
|
||||
ObjectPattern(node) {
|
||||
let objectName = null;
|
||||
|
||||
if (node.id.type === "ObjectPattern") {
|
||||
node.id.properties.forEach(property => {
|
||||
checkPropertyAccess(node.id, objectName, astUtils.getStaticPropertyName(property));
|
||||
});
|
||||
if (node.parent.type === "VariableDeclarator") {
|
||||
if (node.parent.init && node.parent.init.type === "Identifier") {
|
||||
objectName = node.parent.init.name;
|
||||
}
|
||||
} else if (node.parent.type === "AssignmentExpression" || node.parent.type === "AssignmentPattern") {
|
||||
if (node.parent.right.type === "Identifier") {
|
||||
objectName = node.parent.right.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
AssignmentExpression: checkDestructuringAssignment,
|
||||
AssignmentPattern: checkDestructuringAssignment
|
||||
|
||||
node.properties.forEach(property => {
|
||||
checkPropertyAccess(node, objectName, astUtils.getStaticPropertyName(property));
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue