eslint-plugin-code-style 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +13 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1874,15 +1874,26 @@ const functionNamingConvention = {
|
|
|
1874
1874
|
if (!variable) return fixer.replaceText(identifierNode, newName);
|
|
1875
1875
|
|
|
1876
1876
|
const fixes = [];
|
|
1877
|
+
const fixedRanges = new Set();
|
|
1878
|
+
|
|
1879
|
+
// Helper to add fix only if not already fixed (avoid overlapping fixes)
|
|
1880
|
+
const addFixHandler = (nodeToFix) => {
|
|
1881
|
+
const rangeKey = `${nodeToFix.range[0]}-${nodeToFix.range[1]}`;
|
|
1882
|
+
|
|
1883
|
+
if (!fixedRanges.has(rangeKey)) {
|
|
1884
|
+
fixedRanges.add(rangeKey);
|
|
1885
|
+
fixes.push(fixer.replaceText(nodeToFix, newName));
|
|
1886
|
+
}
|
|
1887
|
+
};
|
|
1877
1888
|
|
|
1878
1889
|
// Fix the definition
|
|
1879
1890
|
variable.defs.forEach((def) => {
|
|
1880
|
-
|
|
1891
|
+
addFixHandler(def.name);
|
|
1881
1892
|
});
|
|
1882
1893
|
|
|
1883
1894
|
// Fix all references
|
|
1884
1895
|
variable.references.forEach((ref) => {
|
|
1885
|
-
|
|
1896
|
+
addFixHandler(ref.identifier);
|
|
1886
1897
|
});
|
|
1887
1898
|
|
|
1888
1899
|
return fixes;
|
package/package.json
CHANGED