Answer the question
In order to leave comments, you need to log in
Can I use only "eslint --fix" to format code? Or is prettier still necessary?
I'm trying to set up a linter for the project, as well as automatic error correction.
For js, as usual, there is the well-known Eslint, which highlights errors, and Prettier, which formats the code depending on the settings of prettier and Eslint itself.
At the same time, Eslint itself has a command - "eslint --fix" which, at first glance, did a good job of automatically fixing errors. But then I do not quite understand why prettier is needed if Eslint has the same functionality?
Should I use Prettier in 2019 then? Or does Prettier complement Eslint's functionality?
"scripts": {
"format": "prettier --single-quote --semi=false --write \"{src,server,webpack}/**/*.js\" && eslint --fix src server webpack",
"lint:css": "stylelint src/**/*.scss",
"lint-css:fix": "stylelint src/**/*.scss --fix && prettier --write src/**/*.scss",
"lint:js": "eslint src src/**/*.js",
"lint-js:fix": "eslint src src/**/*.js --fix",
},
Answer the question
In order to leave comments, you need to log in
For Angular, they usually use TSLint - an analogue of ESLint, only for TypeScript. And, accordingly, TSLint rules are configured for Angular projects in the tslint.json file, or they use a ready-made set of rules right away, for example https://www.npmjs.com/package/angular-tslint-rules .
Personally, for example, I don't use Prettier at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question