@wordpress/eslint-plugin 22.1.0 → 22.2.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/eslint-plugin",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.2.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.25.7",
|
|
35
35
|
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
|
36
36
|
"@typescript-eslint/parser": "^6.4.1",
|
|
37
|
-
"@wordpress/babel-preset-default": "^8.
|
|
38
|
-
"@wordpress/prettier-config": "^4.
|
|
37
|
+
"@wordpress/babel-preset-default": "^8.16.0",
|
|
38
|
+
"@wordpress/prettier-config": "^4.16.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": "
|
|
69
|
+
"gitHead": "f48b9f56629e400891abb5ae491504de475237ff"
|
|
70
70
|
}
|
|
@@ -71,6 +71,18 @@ sprintf(
|
|
|
71
71
|
{
|
|
72
72
|
code: `sprintf( '%(greeting)s %(toWhom)s', 'Hello', 'World' )`,
|
|
73
73
|
},
|
|
74
|
+
{
|
|
75
|
+
code: `sprintf( 'Rotated at %d %% degrees', 90 )`,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
code: `sprintf( 'Rotated at %d%% degrees', 90 )`,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
code: `sprintf( __( 'Rotated at %d%% degrees' ), 90 )`,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
code: `sprintf( 'Rotated at %1$d %% degrees, %2$d %% angles', 90, 180 )`,
|
|
85
|
+
},
|
|
74
86
|
],
|
|
75
87
|
invalid: [
|
|
76
88
|
{
|
|
@@ -17,7 +17,7 @@ module.exports = {
|
|
|
17
17
|
useGlobalThis:
|
|
18
18
|
'`{{ name }}` should not be accessed from process.env. Use `globalThis.{{name}}`.',
|
|
19
19
|
noGutenbergPhase:
|
|
20
|
-
'The GUTENBERG_PHASE
|
|
20
|
+
'The GUTENBERG_PHASE environment variable is no longer available. Use IS_GUTENBERG_PLUGIN (boolean).',
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
create( context ) {
|
package/rules/wp-global-usage.js
CHANGED
|
@@ -25,7 +25,7 @@ function isUsedInConditional( node ) {
|
|
|
25
25
|
/** @type {import('estree').Node|undefined} */
|
|
26
26
|
let current = node;
|
|
27
27
|
|
|
28
|
-
// Simple negation is the only
|
|
28
|
+
// Simple negation is the only expression allowed in the conditional:
|
|
29
29
|
// if ( ! globalThis.SCRIPT_DEBUG ) {}
|
|
30
30
|
// const D = ! globalThis.SCRIPT_DEBUG ? 'yes' : 'no';
|
|
31
31
|
if (
|
package/utils/constants.js
CHANGED
|
@@ -37,13 +37,13 @@ const TRANSLATION_FUNCTIONS = new Set( [ '__', '_x', '_n', '_nx' ] );
|
|
|
37
37
|
* @type {RegExp}
|
|
38
38
|
*/
|
|
39
39
|
const REGEXP_SPRINTF_PLACEHOLDER =
|
|
40
|
-
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
40
|
+
/(?<!%)%(((\d+)\$)|(\(([$_a-zA-Z][$_a-zA-Z0-9]*)\)))?[ +0#-]*\d*(\.(\d+|\*))?(ll|[lhqL])?([cduxXefgsp])/g;
|
|
41
|
+
// ▲ ▲ ▲ ▲ ▲ ▲ ▲ type
|
|
42
|
+
// │ │ │ │ │ └ Length (unsupported)
|
|
43
|
+
// │ │ │ │ └ Precision / max width
|
|
44
|
+
// │ │ │ └ Min width (unsupported)
|
|
45
|
+
// │ │ └ Flags (unsupported)
|
|
46
|
+
// └ Index └ Name (for named arguments)
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* "Unordered" means there's no position specifier: '%s', not '%2$s'.
|