Bump packages to fix linter
This commit is contained in:
parent
ed9506bbaf
commit
0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions
50
node_modules/eslint/lib/rules/require-atomic-updates.js
generated
vendored
50
node_modules/eslint/lib/rules/require-atomic-updates.js
generated
vendored
|
|
@ -79,6 +79,9 @@ function isLocalVariableWithoutEscape(variable, isMemberAccess) {
|
|||
reference.from.variableScope === functionScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents segment information.
|
||||
*/
|
||||
class SegmentInfo {
|
||||
constructor() {
|
||||
this.info = new WeakMap();
|
||||
|
|
@ -162,26 +165,39 @@ class SegmentInfo {
|
|||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "problem",
|
||||
|
||||
docs: {
|
||||
description: "disallow assignments that can lead to race conditions due to usage of `await` or `yield`",
|
||||
category: "Possible Errors",
|
||||
description: "Disallow assignments that can lead to race conditions due to usage of `await` or `yield`",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/rules/require-atomic-updates"
|
||||
},
|
||||
|
||||
fixable: null,
|
||||
schema: [],
|
||||
|
||||
schema: [{
|
||||
type: "object",
|
||||
properties: {
|
||||
allowProperties: {
|
||||
type: "boolean",
|
||||
default: false
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
}],
|
||||
|
||||
messages: {
|
||||
nonAtomicUpdate: "Possible race condition: `{{value}}` might be reassigned based on an outdated value of `{{value}}`."
|
||||
nonAtomicUpdate: "Possible race condition: `{{value}}` might be reassigned based on an outdated value of `{{value}}`.",
|
||||
nonAtomicObjectUpdate: "Possible race condition: `{{value}}` might be assigned based on an outdated state of `{{object}}`."
|
||||
}
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const allowProperties = !!context.options[0] && context.options[0].allowProperties;
|
||||
|
||||
const sourceCode = context.getSourceCode();
|
||||
const assignmentReferences = new Map();
|
||||
const segmentInfo = new SegmentInfo();
|
||||
|
|
@ -273,13 +289,25 @@ module.exports = {
|
|||
const variable = reference.resolved;
|
||||
|
||||
if (segmentInfo.isOutdated(codePath.currentSegments, variable)) {
|
||||
context.report({
|
||||
node: node.parent,
|
||||
messageId: "nonAtomicUpdate",
|
||||
data: {
|
||||
value: sourceCode.getText(node.parent.left)
|
||||
}
|
||||
});
|
||||
if (node.parent.left === reference.identifier) {
|
||||
context.report({
|
||||
node: node.parent,
|
||||
messageId: "nonAtomicUpdate",
|
||||
data: {
|
||||
value: variable.name
|
||||
}
|
||||
});
|
||||
} else if (!allowProperties) {
|
||||
context.report({
|
||||
node: node.parent,
|
||||
messageId: "nonAtomicObjectUpdate",
|
||||
data: {
|
||||
value: sourceCode.getText(node.parent.left),
|
||||
object: variable.name
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue