Browse Source

Enable ESLint Promise plugin defaults (#22229)

Nick Schonning 1 year ago
parent
commit
5e1c0c3d94
2 changed files with 6 additions and 1 deletions
  1. 5 0
      .eslintrc.js
  2. 1 1
      app/javascript/mastodon/utils/notifications.js

+ 5 - 0
.eslintrc.js

@@ -6,6 +6,7 @@ module.exports = {
     'plugin:react/recommended',
     'plugin:jsx-a11y/recommended',
     'plugin:import/recommended',
+    'plugin:promise/recommended',
   ],
 
   env: {
@@ -199,11 +200,15 @@ module.exports = {
     ],
     'import/no-webpack-loader-syntax': 'error',
 
+    'promise/always-return': 'off',
     'promise/catch-or-return': [
       'error',
       {
         allowFinally: true,
       },
     ],
+    'promise/no-callback-in-promise': 'off',
+    'promise/no-nesting': 'off',
+    'promise/no-promise-in-callback': 'off',
   },
 };

+ 1 - 1
app/javascript/mastodon/utils/notifications.js

@@ -3,7 +3,7 @@
 
 const checkNotificationPromise = () => {
   try {
-    // eslint-disable-next-line promise/catch-or-return
+    // eslint-disable-next-line promise/catch-or-return, promise/valid-params
     Notification.requestPermission().then();
   } catch(e) {
     return false;