]> git.proxmox.com Git - pve-eslint.git/blobdiff - eslint/lib/rules/prefer-const.js
import 8.41.0 source
[pve-eslint.git] / eslint / lib / rules / prefer-const.js
index e3d2db7aeb952a9665c881ff0488ccfc3ec4c28b..b43975e9bae3ef6d7938b933cd0a07c06dd9447f 100644 (file)
@@ -334,7 +334,7 @@ module.exports = {
         docs: {
             description: "Require `const` declarations for variables that are never reassigned after declared",
             recommended: false,
-            url: "https://eslint.org/docs/rules/prefer-const"
+            url: "https://eslint.org/docs/latest/rules/prefer-const"
         },
 
         fixable: "code",
@@ -356,7 +356,7 @@ module.exports = {
 
     create(context) {
         const options = context.options[0] || {};
-        const sourceCode = context.getSourceCode();
+        const sourceCode = context.sourceCode;
         const shouldMatchAnyDestructuredVariable = options.destructuring !== "all";
         const ignoreReadBeforeAssign = options.ignoreReadBeforeAssign === true;
         const variables = [];
@@ -493,7 +493,7 @@ module.exports = {
 
             VariableDeclaration(node) {
                 if (node.kind === "let" && !isInitOfForStatement(node)) {
-                    variables.push(...context.getDeclaredVariables(node));
+                    variables.push(...sourceCode.getDeclaredVariables(node));
                 }
             }
         };