I want to include the rule no-unpublished-import from eslint-plugin-node, however, it is conflicting with my current .eslintrc
because I am using typescript-eslint and eslint-import-resolver-typescript.
It is my current configuration:
{
"parser": "@typescript-eslint/parser", // Specifies the ESLint parser
"extends": [
"airbnb-base",
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
"prettier", // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array
"prettier/@typescript-eslint" // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
],
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 6, // Allows for the parsing of modern ECMAScript features
"sourceType": "module" // Allows for the use of imports
},
"rules": {
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ts"]
},
// use <root>/tsconfig.json
"typescript": {
"alwaysTryTypes": true // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
}
}
},
"root": true
}
The code compiles correctly, however, if I add to the extends option the plugin:node/recommended
the compilation process will fail:
1:1 error Import and export declarations are not supported yet node/no-unsupported-features/es-syntax
1:43 error "express" is not found node/no-missing-import
2:1 error Import and export declarations are not supported yet node/no-unsupported-features/es-syntax
My package.json
includes the node": ">=12.0.0
. Also, this rule should be ignored because I am using typescript. On the other hand, I am just exporting types from express
because the module don't use it.
According to this issue the conflict should be resolved by eslint-plugin-node
.
How can I accomplish the merge of both plugins? Do I have to go disabling rules one by one?
UPDATED:
It seems it was asked in this issue on the eslint-plugin-node
repository. It works for no-unsupported-features
and no-missing-import
, however, it is still failing with the import definition of express
with no-extraneous-import
.
UPDATED 2:
It seems eslint-plugin-node
is working on a enhancement to accomplish it. Issue here