C
C
camradee2022-03-18 18:57:32
typescript
camradee, 2022-03-18 18:57:32

Should I use Eslint with Prettier for typescript?

I created two projects (typescript) according to the official nuxtjs instructions. I connected Eslint in one, Eslint and Prettier in the other. Found that Prettier disables some rules. For example, in the first project, Eslint complains about commas after the last element {{},{},} (the comma-dangle rule) or the absence of a space after the somefunc() function name (the space-before-function-paren rule); about these rules in Prettier are off. For the first time I deal with all this and I don’t know how best to proceed - on the one hand, prettier can format beautifully, on the other hand, it cuts off some of the rules. Maybe it was not necessary to install Eslint at all, but it was necessary to choose Tslint, there was such a choice there too. How to be?

"devDependencies": {
    "@babel/eslint-parser": "^7.16.3",
    "@nuxt/types": "^2.15.8",
    "@nuxt/typescript-build": "^2.1.0",
    "@nuxtjs/eslint-config-typescript": "^8.0.0",
    "@nuxtjs/eslint-module": "^3.0.2",
    "eslint": "^8.4.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-nuxt": "^3.1.0",
    "eslint-plugin-vue": "^8.2.0",
    "prettier": "^2.5.1"
  }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2022-03-18
@Aleksandr-JS-Developer

Prettier and ESLint solve slightly different tasks.
Prettier - formatting.
ESLint - formatting, error detection, code quality improvement.
And both do their job a little differently.
It is better, I think, to think about what tool you need and use it already. And not necessary, respectively, do not use.

V
Vasily Bannikov, 2022-03-18
@vabka

Personally, I see no reason to combine them.
Much easier to set up just eslint.
Tslint is deprecated

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question