I have several tsconfigs in my project (one for server-side code, and another for client-side). When I lint using ts-standard
, I receive no errors (as expected). To lint from the terminal:
ts-standard assets/scripts/ --project ./assets/scripts/tsconfig.json & ts-standard src/ --project ./src/tsconfig.json
No issue there. However, in my editor (VS Code), the JavaScript Standard Style extension shows the following two problems at the top of the file (i.e. at the first import
statement):
This rule requires the
strictNullChecks
compiler option to be turned on to function correctly. (@typescript-eslint/prefer-nullish-coalescing)ts-standard(@typescript-eslint/prefer-nullish-coalescing)
This rule requires the
strictNullChecks
compiler option to be turned on to function correctly. (@typescript-eslint/strict-boolean-expressions)ts-standard(@typescript-eslint/strict-boolean-expressions)
I have searched on DuckDuckGo and asked ChatGPT and Copilot, but found no solution. It works fine with just one tsconfig, but having two seems to be causing the issue.
I solved my problem by installing ESLint along a few other packages:
bun i -D eslint eslint-config-standard-with-typescript @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import eslint-plugin-n eslint-plugin-promise
Then configuring ESLint in package.json
:
"eslintConfig": {
"extends": [
"standard-with-typescript",
],
"ignorePatterns": [
"*.d.ts"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": [
"assets/scripts/tsconfig.json",
"src/tsconfig.json"
]
},
"plugins": [
"@typescript-eslint"
]
}
Now, when using the ESLint extension for VS Code, the reported problems are consistent between command-line and in the editor.