1 | initial version |
To configure ESLint to format the js files produced by tsc, you can follow these steps:
npm install eslint eslint-config-prettier eslint-plugin-prettier prettier --save-dev
.eslintrc.json
file in the root directory of your project with the following configuration:{
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
}
}
prettier.config.js
file in the root directory of your project with the following configuration:module.exports = {
semi: true,
trailingComma: "all",
singleQuote: true,
printWidth: 80,
tabWidth: 2
};
lint
command to your package.json
file, which runs ESLint and formats your code:"scripts": {
"lint": "eslint 'src/**/*.{js,ts}' --fix"
}
lint
command to format your code:npm run lint
This will run ESLint and format your JS files produced by tsc.