node typescript eslint code example
Example 1: node eslint
"devDependencies": {
"eslint": "^7.2.0",
"eslint-plugin-node": "^11.1.0"
}
{
"extends": [
"eslint:recommended",
"plugin:node/recommended"
],
"parserOptions": {
"ecmaVersion": 2020
},
"rules": {
"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"
}
}
Example 2: prettier eslint typescript
1yarn add eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin --dev