IanVS / eslint-filtered-fix

Control how ESLint fixes your files
MIT License
15 stars 4 forks source link

Allow specifying array argument multiple times #21

Closed RedMser closed 2 years ago

RedMser commented 2 years ago

This is already mentioned in the readme, but the "concatRepeatedArrays" flag of optionator is set to false by default, so this feature did not work.

IanVS commented 2 years ago

Hi, thanks for this. Can you share the syntax that you're using which is not working correctly? What is shown in the readme should work without a problem, if I understand concatRepeatedArrays correctly. It's intended to merge multiple arrays together, like --ext js,jsx --ext ts,tsx would use all the values (four extensions). That seems like an odd thing to support, why not combine them all into one array, --ext js,jsx,ts,tsx?

RedMser commented 2 years ago

Hi, for testing I added console.log(fixOptions) as the first line of async function fix.

Running npx eslint-filtered-fix . --ext .js --rule a --rule b causes it to print { rules: [ 'b' ], warnings: true } whereas I expected both a and b to be included. This got fixed by adding concatRepeatedArrays: true.

IanVS commented 2 years ago

Ah, I see. That is how eslint itself works, so it's a reasonable expectation to have here as well. Thanks for contributing!