xo icon indicating copy to clipboard operation
xo copied to clipboard

`xo --fix --quiet` does not save changes on TypeScript files

Open fregante opened this issue 4 years ago • 2 comments

xo --quiet reports the errors, but xo --quiet --fix acts like it fixes them, but it doesn't:

Repro

npm init -y
npm install xo
echo "console.log('hello')" > file.ts
npx xo --quiet --fix

What happens

No error is outputted, but no files are changed. This is confirmed by another run of xo

$ xo

  file.ts:1:21
  ✖  1:21  Missing semicolon.  @typescript-eslint/semi

  1 error

Omitting --quiet will fix it:

$ xo --fix
// no error

$ xo
// no error

Notes

The same ESLint version is able to save those changes when running:

npx eslint file.ts \
--rule '{"@typescript-eslint/semi": "error"}' \
--parser-options '{"sourceType": "module", ecmaVersion:2015}' \
--parser "@typescript-eslint/parser" \
--plugin "@typescript-eslint" \
--fix \
--quiet
  • Can still be reproduced in XO in 0.51.0

fregante avatar Jun 20 '21 07:06 fregante

Does not seem to be limited to TypeScript files. I have the same behaviour on regular .js files with npx xo --fix --quiet.

groenroos avatar Mar 21 '22 23:03 groenroos

https://github.com/xojs/xo/blob/7da6311abcd069bea561a9be0f9b7aa220784a34/index.js#L105

Wrong options.isQuiet, should be the outer options.

fisker avatar Mar 23 '22 12:03 fisker