nfour / eslint-config-standard-typescript-prettier

A simple eslint config for modern TypeScript projects.
MIT License
22 stars 8 forks source link

Fix prettier config for formats other than TS. #16

Open momocow opened 2 years ago

momocow commented 2 years ago

What change has been made in this PR

Use override instead of putting the parser option at the top level of the configuration to avoid disabling Prettier’s automatic file extension based parser inference.

See https://stackoverflow.com/a/68088956/8579025

Use cases:

// .lintstagedrc.js
module.exports = {
  '*.ts': ['prettier --write', 'eslint --fix'],
  '*.json': ['prettier --write'] // this will throw SyntaxError if using 'parser' option in prettier.js
};