Error parsing '--rule' CLI option
Closed this issue · 2 comments
amourzenkov-sc commented
Environment
- Node Version: 10.15.3
- Eslint-Watch Version: 5.0.1
- Eslint Version: 5.16.0
Basic Description of the problem
Erroneous handling of CLI --rule
option.
How to reproduce it
Command: npx esw --rule 'indent: [2, tab]' src
Output:
Invalid value for option 'rule' - expected type Object, received value: [object Object].
Details
After some eslint-watch debugging I figured out that the command
npx esw --rule 'indent: [2, tab]' src
triggers eslint-watch's src/eslint/index.js line 17
const result = await execa('eslint', args);
with args
equal to
[
'--rule',
{ indent: [ 2, 'tab' ] },
'--eslintrc',
'--ignore',
'--inline-config',
'src'
]
So { 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 to
[
'--rule',
'indent: [2, tab]',
'--eslintrc',
'--ignore',
'--inline-config',
'src'
]
everything works as expected and without throwing errors.
rizowski commented
This should have been fixed with #151 but I can verify. (Has not been released yet.)
rizowski commented
This should be fixed with v5.1.0