@wordpress/eslint-plugin 17.13.0 → 18.1.0

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.
package/configs/react.js CHANGED
@@ -37,7 +37,7 @@ module.exports = {
37
37
  'react-hooks/exhaustive-deps': [
38
38
  'warn',
39
39
  {
40
- additionalHooks: '(useSelect|useSuspenseSelect)',
40
+ additionalHooks: '^(useSelect|useSuspenseSelect)$',
41
41
  },
42
42
  ],
43
43
  'react-hooks/rules-of-hooks': 'error',
@@ -25,6 +25,12 @@ if ( isPackageInstalled( 'prettier' ) ) {
25
25
  const prettierConfig = { ...defaultPrettierConfig, ...localPrettierConfig };
26
26
  config.rules = {
27
27
  'prettier/prettier': [ 'error', prettierConfig ],
28
+ // Prettier _disables_ this rule, but we want it!
29
+ // See https://github.com/prettier/eslint-config-prettier?tab=readme-ov-file#curly
30
+ // > This rule requires certain options.
31
+ // > …
32
+ // > If you like this rule, it can be used just fine with Prettier as long as you don’t use the "multi-line" or "multi-or-nest" option.
33
+ curly: [ 'error', 'all' ],
28
34
  };
29
35
  }
30
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/eslint-plugin",
3
- "version": "17.13.0",
3
+ "version": "18.1.0",
4
4
  "description": "ESLint plugin for WordPress development.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -34,8 +34,8 @@
34
34
  "@babel/eslint-parser": "^7.16.0",
35
35
  "@typescript-eslint/eslint-plugin": "^6.4.1",
36
36
  "@typescript-eslint/parser": "^6.4.1",
37
- "@wordpress/babel-preset-default": "^7.40.0",
38
- "@wordpress/prettier-config": "^3.13.0",
37
+ "@wordpress/babel-preset-default": "^7.42.0",
38
+ "@wordpress/prettier-config": "^3.15.0",
39
39
  "cosmiconfig": "^7.0.0",
40
40
  "eslint-config-prettier": "^8.3.0",
41
41
  "eslint-plugin-import": "^2.25.2",
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "280403b4c1cf6cc2c55a6c4d56f9ef91145e4191"
69
+ "gitHead": "42f38f287506a6b3ed8ccba839b18ad066821044"
70
70
  }
@@ -23,7 +23,7 @@ ruleTester.run( 'dependency-group', rule, {
23
23
  * External dependencies
24
24
  */
25
25
  import { camelCase } from 'change-case';
26
- import classnames from 'classnames';
26
+ import clsx from 'clsx';;
27
27
 
28
28
  /**
29
29
  * WordPress dependencies
@@ -41,7 +41,7 @@ import edit from './edit';`,
41
41
  * External dependencies
42
42
  */
43
43
  const { camelCase } = require( 'change-case' );
44
- const classnames = require( 'classnames' );
44
+ const clsx = require( 'clsx' );
45
45
 
46
46
  /**
47
47
  * WordPress dependencies
@@ -58,7 +58,7 @@ const edit = require( './edit' );`,
58
58
  {
59
59
  code: `
60
60
  import { camelCase } from 'change-case';
61
- import classnames from 'classnames';
61
+ import clsx from 'clsx';;
62
62
  /*
63
63
  * wordpress dependencies.
64
64
  */
@@ -83,7 +83,7 @@ import edit from './edit';`,
83
83
  * External dependencies
84
84
  */
85
85
  import { camelCase } from 'change-case';
86
- import classnames from 'classnames';
86
+ import clsx from 'clsx';;
87
87
  /**
88
88
  * WordPress dependencies
89
89
  */
@@ -96,7 +96,7 @@ import edit from './edit';`,
96
96
  {
97
97
  code: `
98
98
  const { camelCase } = require( 'change-case' );
99
- const classnames = require( 'classnames' );
99
+ const clsx = require( 'clsx' );
100
100
  /*
101
101
  * wordpress dependencies.
102
102
  */
@@ -121,7 +121,7 @@ const edit = require( './edit' );`,
121
121
  * External dependencies
122
122
  */
123
123
  const { camelCase } = require( 'change-case' );
124
- const classnames = require( 'classnames' );
124
+ const clsx = require( 'clsx' );
125
125
  /**
126
126
  * WordPress dependencies
127
127
  */
@@ -34,6 +34,23 @@ sprintf(
34
34
  // translators: %s: Color
35
35
  i18n.sprintf( i18n.__( 'Color: %s' ), color );`,
36
36
  },
37
+ {
38
+ code: `
39
+ sprintf(
40
+ /*
41
+ * translators: %s is the name of the city we couldn't locate.
42
+ * Replace the examples with cities related to your locale. Test that
43
+ * they match the expected location and have upcoming events before
44
+ * including them. If no cities related to your locale have events,
45
+ * then use cities related to your locale that would be recognizable
46
+ * to most users. Use only the city name itself, without any region
47
+ * or country. Use the endonym (native locale name) instead of the
48
+ * English name if possible.
49
+ */
50
+ __( 'We couldn’t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
51
+ templateParams.unknownCity
52
+ );`,
53
+ },
37
54
  ],
38
55
  invalid: [
39
56
  {
@@ -78,7 +78,7 @@ module.exports = {
78
78
  const {
79
79
  value: commentText,
80
80
  loc: {
81
- start: { line: commentLine },
81
+ end: { line: commentLine },
82
82
  },
83
83
  } = comment;
84
84