Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefer-spread is triggering on non-array concat() methods #6034

Closed
tylerlaprade opened this issue Sep 24, 2024 · 4 comments
Closed

prefer-spread is triggering on non-array concat() methods #6034

tylerlaprade opened this issue Sep 24, 2024 · 4 comments
Labels
A-linter Area - Linter C-bug Category - Bug X-wontfix Close Reason - wontfix

Comments

@tylerlaprade
Copy link

This is my RTK (Redux Toolkit) store. prefer-spread is complaining about concat, but this isn't an array, it's a custom util type called Tuple from here that implements its own concat() method. There is no way to use a spread here.

const store = configureStore({
  reducer,
  middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(baseApi.middleware, rtkQueryErrorLogger)
});
@tylerlaprade tylerlaprade added the C-bug Category - Bug label Sep 24, 2024
@DonIsaac
Copy link
Contributor

Unfortunately, without type information, Oxlint is unable to tell .concat() is a custom, non-array method. Consider disabling it with // oxlint-disable-next-lline prefer-spread.

@DonIsaac DonIsaac added X-wontfix Close Reason - wontfix A-linter Area - Linter labels Sep 24, 2024
@tylerlaprade
Copy link
Author

I see, thank you. Is there a plan to incorporate type information in the future?

@DonIsaac
Copy link
Contributor

Not right now. It's an almost impossible task. swc-project/swc#571

@tylerlaprade
Copy link
Author

Interesting, I hadn't thought about that! I wonder if it makes sense to collaborate with Biome and/or QuickLint to develop a shared minimal type-parser for linting purposes...
biomejs/biome#3187

@tylerlaprade tylerlaprade closed this as not planned Won't fix, can't repro, duplicate, stale Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug X-wontfix Close Reason - wontfix
Projects
None yet
Development

No branches or pull requests

2 participants