Running prettier via eslint vs standalone will result in different outcomes

Viewed 97

I have configured my eslint to use prettier like this in my .eslintrc.js:

  extends: [
    'plugin:@typescript-eslint/recommended',
    'plugin:prettier/recommended',
  ],

But when I run the command ./node_modules/.bin/prettier -w src/ It reformats three files that ./node_modules/.bin/eslint --fix is not changing them or when run without --fix it is not nagging about them being wrongly formatted.

One of the differences is that running prettier standalone will add an empty line at the end of one file which eslint is not.

Another difference is that running prettier standalone will break:

    await knex.raw(changeSequenceToRandom({ column: 'id', lowerBound: 1, higherBound: 25 }));

to

     await knex.raw(
             changeSequenceToRandom({ column: 'id', lowerBound: 1, higherBound: 25 }),
     );

in two other files, which eslint is not nagging about them being wrongly formatted again. why is that? am I doing something wrong?

1 Answers

Seems like you are missing the target file/folder. Try eslint ./src --fix.

Related