I need the VScode extension to find the un-used public function in my Nodejs application.
Answer is already accepted. If someone is looking for more detailed steps then read below:
STEP 1: Add this ESLint plugin to your VS code.
STEP 2: Install eslint
and eslint-plugin-node
as dev dependencies using below command.
npm install eslint eslint-plugin-node --save-dev
STEP 3: Add below json file in your project root directory where package.json
file sits. (Below configuration in JSON file is what I am using. You can customize/rewrite it to your requirement).
File name: .eslintrc.json
{
"extends": [
"eslint:recommended",
"plugin:node/recommended"
],
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"no-console": "warn",
"no-self-assign": "warn",
"no-self-compare":"warn",
"complexity": ["error", { "max": 15 }],
"indent": ["error", 2, { "SwitchCase": 1 }],
"no-dupe-keys": "error",
"no-invalid-regexp": "error",
"no-undef": "error",
"no-return-assign": "error",
"no-redeclare": "error",
"no-empty": "error",
"no-await-in-loop": "error",
"node/exports-style": ["error", "module.exports"],
"node/file-extension-in-import": ["error", "always"],
"node/prefer-global/buffer": ["error", "always"],
"node/prefer-global/console": ["error", "always"],
"node/prefer-global/process": ["error", "always"],
"node/prefer-global/url-search-params": ["error", "always"],
"node/prefer-global/url": ["error", "always"],
"node/prefer-promises/dns": "error",
"node/prefer-promises/fs": "error"
}
}
STEP 4: Whenever you open a file you will see below errors in PROBLEMS tab
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With