Goal: To create a strict TypeScript linter script
eslint checks for poor JavaScript code patterns.
The docs suggests initialising eslint with npm init @eslint/config@latest
This also installs typescript-eslint
But why use typescript-eslint?
According to the docs it:
enables
esLintto run on TypeScript code
But, after removing typescript-eslint, esLint appears to function normally.
Further testing shows that typescript-eslint does not pick up the undefined error, even though tsc does:
// Type "pink" is undefined
const apple: pink = 'apple'
console.log(apple)
My understanding is that tsc compiles TypeScript to JavaScript unless --noEmit tag is added. With options like "strict": true, it's possible to configure TypeScript rules to check.
So is typescript-eslint useless for linting?
It appears as if typescript-eslint does nothing and should be removed. While tsc can actually detect errors.
tsc.typescript-eslintallows ESLint rules for TypeScript code.