Objective: Developing a rigorous TypeScript linter script
eslint
scans for problematic JavaScript code patterns.
The documentation recommends initiating eslint
with npm init @eslint/config@latest
This process also installs typescript-eslint
But what is the purpose of using typescript-eslint
?
As per the information on the official website, it:
enables
esLint
to analyze TypeScript code
However, upon removing typescript-eslint
, esLint
seems to function properly.
Further examination reveals that typescript-eslint
fails to identify an undefined error, which is caught by tsc
:
// Type "pink" is undefined
const apple: pink = 'apple'
console.log(apple)
My understanding is that tsc
converts TypeScript into JavaScript unless specified with the --noEmit flag. By utilizing configurations like "strict": true
, TypeScript rules can be set up for validation.
Is typescript-eslint
essentially irrelevant for linting purposes?
It appears that typescript-eslint
may not serve its intended function and might need to be eliminated. Meanwhile, tsc
proves effective in detecting errors.