]>
git.proxmox.com Git - pve-eslint.git/blob - eslint/lib/rules/no-ex-assign.js
2 * @fileoverview Rule to flag assignment of the exception parameter
3 * @author Stephen Murray <spmurrayzzz>
8 const astUtils
= require("./utils/ast-utils");
10 //------------------------------------------------------------------------------
12 //------------------------------------------------------------------------------
19 description
: "disallow reassigning exceptions in `catch` clauses",
21 url
: "https://eslint.org/docs/rules/no-ex-assign"
27 unexpected
: "Do not assign to the exception parameter."
34 * Finds and reports references that are non initializer and writable.
35 * @param {Variable} variable A variable to check.
38 function checkVariable(variable
) {
39 astUtils
.getModifyingReferences(variable
.references
).forEach(reference
=> {
40 context
.report({ node
: reference
.identifier
, messageId
: "unexpected" });
46 context
.getDeclaredVariables(node
).forEach(checkVariable
);