Skip to content

Commit

Permalink
add node and promise plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ASafaeirad committed May 31, 2021
1 parent 05a5df0 commit 5ea05bd
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ If you need more advanced `typescript-eslint` rules, then you can extend from `"
* eslint-plugin-react-hooks
* eslint-plugin-simple-import-sort
* eslint-plugin-fp
* eslint-plugin-node
* eslint-plugin-promise

That's all. Feel free to use 💛

Expand Down
4 changes: 3 additions & 1 deletion base.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
plugins: ['prettier', 'import', 'simple-import-sort', 'fp'],
plugins: ['prettier', 'import', 'simple-import-sort', 'promise', 'node', 'fp'],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
Expand Down Expand Up @@ -27,6 +27,8 @@ module.exports = {
'./rules/style',
'./rules/variables',
'./rules/fp',
'./rules/promise',
'./rules/node',
'prettier',
],
};
42 changes: 41 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
"eslint-plugin-import": "2.23.3",
"eslint-plugin-jest": "24.3.6",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "3.4.0",
"eslint-plugin-promise": "5.1.0",
"eslint-plugin-react": "7.23.2",
"eslint-plugin-react-hooks": "4.2.0",
"eslint-plugin-simple-import-sort": "7.0.0",
Expand Down
43 changes: 43 additions & 0 deletions rules/node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
module.exports = {
rules: {
'node/no-unsupported-features/es-builtins': 'error',
'node/no-unsupported-features/es-syntax': 'error',
'node/no-unsupported-features/node-builtins': 'error',
'node/prefer-global/buffer': 'warn',
'node/prefer-global/console': 'warn',
'node/prefer-global/process': 'warn',
'node/prefer-global/text-decoder': 'warn',
'node/prefer-global/text-encoder': 'warn',
'node/prefer-global/url-search-params': 'warn',
'node/prefer-global/url': 'warn',
'node/prefer-promises/dns': 'warn',
'node/prefer-promises/fs': 'warn',
'node/callback-return': 'off',
'node/exports-style': ['error', 'module.exports', { allowBatchAssign: false }],
'node/file-extension-in-import': 'off', // import plugin
'node/global-require': 'error',
'node/handle-callback-err': 'warn',
'node/no-callback-literal': 'off',
'node/no-deprecated-api': 'error',
'node/no-exports-assign': 'error',
'node/no-extraneous-import': 'off', // import plugin
'node/no-extraneous-require': 'off', // import plugin
'node/no-hide-core-modules': 'error',
'node/no-missing-import': 'off', // import plugin
'node/no-missing-require': 'off', // import plugin
'node/no-mixed-requires': 'warn',
'node/no-new-require': 'error',
'node/no-path-concat': 'off',
'node/no-process-env': 'off',
'node/no-process-exit': 'off',
'node/no-restricted-import': 'off',
'node/no-restricted-require': 'off',
'node/no-sync': 'off',
'node/no-unpublished-bin': 'off',
'node/no-unpublished-import': 'off',
'node/no-unpublished-require': 'off',
'node/no-unsupported-features': 'off',
'node/process-exit-as-throw': 'off',
'node/shebang': 'off',
},
};
18 changes: 18 additions & 0 deletions rules/promise.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
rules: {
'promise/always-return': 'error',
'promise/avoid-new': 'off',
'promise/catch-or-return': 'off',
'promise/no-callback-in-promise': 'off',
'promise/no-native': 'off',
'promise/no-nesting': 'off',
'promise/no-new-statics': 'error',
'promise/no-promise-in-callback': 'error',
'promise/no-return-in-finally': 'warn',
'promise/no-return-wrap': 'error',
'promise/param-names': 'warn',
'promise/prefer-await-to-callbacks': 'off',
'promise/prefer-await-to-then': 'off',
'promise/valid-params': 'warn',
},
};

0 comments on commit 5ea05bd

Please sign in to comment.