Skip to content

Commit be4eb34

Browse files
committed
Assign parameters to variables defined within the jsx-no-bind.js file
1 parent a3ad878 commit be4eb34

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/rules/jsx-closing-bracket-location.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ module.exports = {
165165
* @return {String} The characters used for indentation
166166
*/
167167
function getIndentation(tokens, expectedLocation, correctColumn) {
168-
correctColumn = correctColumn || 0;
168+
const newColumn = correctColumn || 0;
169169
let indentation;
170170
let spaces = [];
171171
switch (expectedLocation) {
@@ -179,7 +179,7 @@ module.exports = {
179179
default:
180180
indentation = '';
181181
}
182-
if (indentation.length + 1 < correctColumn) {
182+
if (indentation.length + 1 < newColumn) {
183183
// Non-whitespace characters were included in the column offset
184184
spaces = new Array(+correctColumn + 1 - indentation.length);
185185
}

lib/rules/jsx-no-bind.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ module.exports = {
6969
// bind expression or an arrow function in different block statements
7070
const blockVariableNameSets = {};
7171

72+
/**
73+
* @param {string | number} blockStart
74+
*/
7275
function setBlockVariableNameSet(blockStart) {
7376
blockVariableNameSets[blockStart] = {
7477
arrowFunc: new Set(),
@@ -80,7 +83,6 @@ module.exports = {
8083

8184
function getNodeViolationType(node) {
8285
const nodeType = node.type;
83-
8486
if (
8587
!configuration.allowBind
8688
&& nodeType === 'CallExpression'
@@ -111,6 +113,11 @@ module.exports = {
111113
return null;
112114
}
113115

116+
/**
117+
* @param {string | number} violationType
118+
* @param {any} variableName
119+
* @param {string | number} blockStart
120+
*/
114121
function addVariableNameToSet(violationType, variableName, blockStart) {
115122
blockVariableNameSets[blockStart][violationType].add(variableName);
116123
}

0 commit comments

Comments
 (0)