Closed amourzenkov-sc closed 5 years ago
Erroneous handling of CLI --rule option.
--rule
Command: npx esw --rule 'indent: [2, tab]' src
npx esw --rule 'indent: [2, tab]' src
Output:
Invalid value for option 'rule' - expected type Object, received value: [object Object].
After some eslint-watch debugging I figured out that the command
triggers eslint-watch's src/eslint/index.js line 17
const result = await execa('eslint', args);
with args equal to
args
[ '--rule', { indent: [ 2, 'tab' ] }, '--eslintrc', '--ignore', '--inline-config', 'src' ]
So { indent: [ 2, 'tab' ] } gets changed to [object Object] string.
{ indent: [ 2, 'tab' ] }
[object Object]
Just for the sake of debugging, if I manually hardcode eslint-watch's src/eslint/index.js line 17 with args equal to
[ '--rule', 'indent: [2, tab]', '--eslintrc', '--ignore', '--inline-config', 'src' ]
everything works as expected and without throwing errors.
This should have been fixed with #151 but I can verify. (Has not been released yet.)
This should be fixed with v5.1.0
Environment
Basic Description of the problem
Erroneous handling of CLI
--rule
option.How to reproduce it
Command:
npx esw --rule 'indent: [2, tab]' src
Output:
Details
After some eslint-watch debugging I figured out that the command
triggers eslint-watch's src/eslint/index.js line 17
with
args
equal toSo
{ indent: [ 2, 'tab' ] }
gets changed to[object Object]
string.Just for the sake of debugging, if I manually hardcode eslint-watch's src/eslint/index.js line 17 with
args
equal toeverything works as expected and without throwing errors.