Consider adding typescript faq, recommended-typescript config
See original GitHub issueThis is a reopening of https://github.com/mysticatea/eslint-plugin-node/issues/205.
Typescript is usually (IMHO) configured, when used with node, to translate what look like ECMA imports and exports down to CommonJS. I know that’s evolving, but only the brave and those without other dependencies are going all in. In this config, what look like ECMA imports and exports in the .ts source really aren’t.
The plugin:node/recommended-typescript-commonjs
config should probably include something like:
"rules": {
"node/no-unsupported-features/es-syntax": [
"error",
{
"ignores": [
"modules"
]
}
],
"node/no-missing-import": ["error", {
"tryExtensions": [".js", ".ts"]
}]
}
It probably makes sense to also soon have another plugin:node/recommended-typescript-esm
for when typescript is set up to emit ecmascript modules.
Also, it would be helpful if the doc specified whether node
should come before or after typescript
in extends
.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:22
- Comments:5
node/no-missing-import would also need to take into account
import type
here are a couple of commented configs for eslint and tsconfig (eslintrc.json is fine with comments):
eslintrc.json
tsconfig.json