Skip to content

Conversation

@vmasek
Copy link
Contributor

@vmasek vmasek commented May 12, 2025

It seems that recently mutation to new Set() or new Map() has started to be reported.
eslint-functional/eslint-plugin-functional#935

Resulting in many new lint errors in projects that considered following code as quite clean

export function extractAllDirectories(files: string[]): string[] {
  const allDirs = new Set<string>();
  files.forEach(file => {
    const dirs = pathPrefixes(file).filter(f => f !== file);
    dirs.forEach(dir => {
      allDirs.add(dir);
    });
  });
  return [...allDirs.values()].sort();
}
  const prevItemMap = new Map<T, T>();
  const currItemMap = new Map<T, T>();

  for (const curr of after) {
    for (const prev of before) {
      if (equals(prev, curr)) {
        prevItemMap.set(curr, prev);
        currItemMap.set(prev, curr);
        break;
      }
    }
  }

@vmasek vmasek requested a review from matejchalk May 12, 2025 14:38
@vmasek
Copy link
Contributor Author

vmasek commented May 12, 2025

@matejchalk do you know what is the problem with docs? Locally it do les not generate difference

@matejchalk
Copy link
Contributor

matejchalk commented May 13, 2025

do you know what is the problem with docs? Locally it do les not generate difference

In react.md, the no-children-prop rule is moved to a different position in your branch. When I run npm run docs locally, it puts it back to original position. So reverting this change should fix the CI check.

@vmasek
Copy link
Contributor Author

vmasek commented May 13, 2025

do you know what is the problem with docs? Locally it do les not generate difference

In react.md, the no-children-prop rule is moved to a different position in your branch. When I run npm run docs locally, it puts it back to original position. So reverting this change should fix the CI check.

I see, classic localeCompare & sort issue 😅

@vmasek vmasek force-pushed the allow-set-map-mutation branch from 1a45f81 to c8d1c65 Compare May 27, 2025 16:10
Co-authored-by: Matěj Chalk <[email protected]>
@vmasek vmasek merged commit 50bb7b2 into main May 28, 2025
5 checks passed
@vmasek vmasek deleted the allow-set-map-mutation branch May 28, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants