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.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-07-01 20:38:32 +0000
Seen: 12 times
Last updated: Jul 01 '23
What is the process for altering svn branches with git-svn?
What is the process to italicize certain keywords in visual studio code?
What is the process for developing a JTable that has both row and column headers?
What is the process for removing a dat.GUI element?
How to solve the issue "process is running" in Visual Studio Debugging?
What is the process of moving information from one tab to another in Excel by transposing it?
What is the process of dividing the WSD dataset (in CSV format) into tokens called?
What is the process of uploading a file using NextJS and formidable?
What is the process for using pnpm to build a single workspace only?