@automattic/eslint-plugin-wpvip 0.5.4 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ module.exports = {
24
24
  /**
25
25
  * Note: We must explicitly add this plugin to use our custom rules.
26
26
  */
27
- plugins: [ '@automattic/wpvip', 'import' ],
27
+ plugins: [ '@automattic/wpvip', 'import', 'promise' ],
28
28
 
29
29
  /**
30
30
  * Please include a short description of the rule. For rules that downgrade or
@@ -202,6 +202,22 @@ module.exports = {
202
202
  ],
203
203
 
204
204
  'wrap-iife': [ 'error', 'any' ],
205
+
206
+ 'promise/always-return': 'off',
207
+ 'promise/avoid-new': 'off',
208
+ 'promise/catch-or-return': 'off',
209
+ 'promise/no-callback-in-promise': 'warn',
210
+ 'promise/no-multiple-resolved': 'error',
211
+ 'promise/no-native': 'off',
212
+ 'promise/no-nesting': 'warn',
213
+ 'promise/no-new-statics': 'error',
214
+ 'promise/no-promise-in-callback': 'warn',
215
+ 'promise/no-return-in-finally': 'error',
216
+ 'promise/no-return-wrap': 'error',
217
+ 'promise/param-names': 'error',
218
+ 'promise/prefer-await-to-callbacks': 'off',
219
+ 'promise/prefer-await-to-then': 'off',
220
+ 'promise/valid-params': 'error',
205
221
  },
206
222
 
207
223
  settings: {
@@ -52,6 +52,13 @@ module.exports = {
52
52
  'one-var': 'warn',
53
53
 
54
54
  radix: 'warn',
55
+
56
+ 'promise/no-multiple-resolved': 'warn',
57
+ 'promise/no-new-statics': 'warn',
58
+ 'promise/no-return-in-finally': 'warn',
59
+ 'promise/no-return-wrap': 'warn',
60
+ 'promise/param-names': 'warn',
61
+ 'promise/valid-params': 'warn',
55
62
  },
56
63
  },
57
64
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/eslint-plugin-wpvip",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "ESLint plugin for internal WordPress VIP projects",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -39,6 +39,7 @@
39
39
  "eslint-plugin-json": "3.1.0",
40
40
  "eslint-plugin-jsx-a11y": "6.7.1",
41
41
  "eslint-plugin-prettier": "4.2.1",
42
+ "eslint-plugin-promise": "6.1.1",
42
43
  "eslint-plugin-react": "7.32.2",
43
44
  "eslint-plugin-react-hooks": "4.6.0",
44
45
  "eslint-plugin-security": "1.7.1",
package/prettierrc.js CHANGED
@@ -6,6 +6,6 @@ module.exports = {
6
6
  printWidth: 100,
7
7
  semi: true,
8
8
  singleQuote: true,
9
- trailingComma: 'all',
9
+ trailingComma: 'es5',
10
10
  useTabs: true,
11
11
  };
@@ -11,7 +11,7 @@ module.exports = {
11
11
  create( context ) {
12
12
  return {
13
13
  'CallExpression[callee.object.callee.property.name="getSelection"][callee.property.name="getRangeAt"]'(
14
- node,
14
+ node
15
15
  ) {
16
16
  context.report( {
17
17
  node,
@@ -1,8 +1,7 @@
1
1
  const debugLog = require( './debug-log' );
2
2
  const findPackageJson = require( 'find-package-json' );
3
3
 
4
- const packages = [ ...findPackageJson( __dirname ) ];
5
- const parent = packages.pop() || {};
4
+ const parent = findPackageJson( __dirname ).next()?.value || {};
6
5
 
7
6
  debugLog( `Found package.json: ${ parent.__path || 'none' }` );
8
7