@wordpress/eslint-plugin 9.3.0 → 10.0.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/CHANGELOG.md +20 -0
- package/LICENSE.md +1 -1
- package/configs/custom.js +0 -5
- package/configs/esnext.js +25 -4
- package/configs/react.js +3 -1
- package/configs/recommended-with-formatting.js +13 -2
- package/configs/recommended.js +0 -2
- package/package.json +15 -13
- package/rules/data-no-store-string-literals.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 10.0.0 (2022-01-27)
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
- The peer dependency constraint for ESLint has been updated from `^6 || ^7` to `^8`.
|
|
10
|
+
- The bundled `@typescript-eslint/eslint-plugin` dependency has been updated from requiring `^4.31.0` to requiring `^5.3.0` ([#36283](https://github.com/WordPress/gutenberg/pull/36283)).
|
|
11
|
+
- The bundled `@typescript-eslint/parser` dependency has been updated from requiring `^4.31.0` to requiring `^5.3.0` ([#36283](https://github.com/WordPress/gutenberg/pull/36283)).
|
|
12
|
+
- The bundled `eslint-config-prettier` dependency has been updated from requiring `^7.1.0` to requiring `^8.3.0` ([#36283](https://github.com/WordPress/gutenberg/pull/36283)).
|
|
13
|
+
- The bundled `eslint-plugin-jest` dependency has been updated from requiring `^24.1.3` to requiring `^25.2.3` ([#36283](https://github.com/WordPress/gutenberg/pull/36283)).
|
|
14
|
+
- The bundled `eslint-plugin-jsdoc` dependency has been updated from requiring `^36.0.8` to requiring `^37.0.3` ([#36283](https://github.com/WordPress/gutenberg/pull/36283)).
|
|
15
|
+
- The bundled `globals` dependency has been updated from requiring `^12.0.0` to requiring `^13.12.0` ([#36283](https://github.com/WordPress/gutenberg/pull/36283)).
|
|
16
|
+
|
|
17
|
+
### Enhancement
|
|
18
|
+
|
|
19
|
+
- Omit verification for WordPress dependencies in the import statements since they get externalized when used with WordPress ([#37639](https://github.com/WordPress/gutenberg/pull/37639)).
|
|
20
|
+
|
|
21
|
+
### Bug Fix
|
|
22
|
+
|
|
23
|
+
- Fix Babel config resolution when a custom ESLint config present ([#37406](https://github.com/WordPress/gutenberg/pull/37406)). Warning: it won't recognize the `babel.config.json` file present in the project until the upstream bug in `cosmiconfig` is fixed.
|
|
24
|
+
|
|
5
25
|
## 9.3.0 (2021-11-15)
|
|
6
26
|
|
|
7
27
|
### Enhancements
|
package/LICENSE.md
CHANGED
package/configs/custom.js
CHANGED
package/configs/esnext.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
const { cosmiconfigSync } = require( 'cosmiconfig' );
|
|
5
|
+
|
|
6
|
+
const config = {
|
|
7
|
+
parser: '@babel/eslint-parser',
|
|
8
|
+
parserOptions: {
|
|
9
|
+
sourceType: 'module',
|
|
10
|
+
},
|
|
2
11
|
env: {
|
|
3
12
|
es6: true,
|
|
4
13
|
},
|
|
5
14
|
extends: [ require.resolve( './es5.js' ) ],
|
|
6
|
-
parserOptions: {
|
|
7
|
-
sourceType: 'module',
|
|
8
|
-
},
|
|
9
15
|
rules: {
|
|
10
16
|
// Disable ES5-specific (extended from ES5)
|
|
11
17
|
'vars-on-top': 'off',
|
|
@@ -45,3 +51,18 @@ module.exports = {
|
|
|
45
51
|
'template-curly-spacing': [ 'error', 'always' ],
|
|
46
52
|
},
|
|
47
53
|
};
|
|
54
|
+
|
|
55
|
+
// It won't recognize the `babel.config.json` file used in the project until the upstream bug in `cosmiconfig` is fixed:
|
|
56
|
+
// https://github.com/davidtheclark/cosmiconfig/issues/246.
|
|
57
|
+
const result = cosmiconfigSync( 'babel' ).search();
|
|
58
|
+
if ( ! result || ! result.filepath ) {
|
|
59
|
+
config.parserOptions = {
|
|
60
|
+
...config.parserOptions,
|
|
61
|
+
requireConfigFile: false,
|
|
62
|
+
babelOptions: {
|
|
63
|
+
presets: [ require.resolve( '@wordpress/babel-preset-default' ) ],
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = config;
|
package/configs/react.js
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const { isPackageInstalled } = require( '../utils' );
|
|
5
5
|
|
|
6
|
+
// Exclude bundled WordPress packages from the list.
|
|
7
|
+
const wpPackagesRegExp = '^@wordpress/(?!(icons|interface))';
|
|
8
|
+
|
|
6
9
|
const config = {
|
|
7
|
-
parser: '@babel/eslint-parser',
|
|
8
10
|
extends: [
|
|
9
11
|
require.resolve( './jsx-a11y.js' ),
|
|
10
12
|
require.resolve( './custom.js' ),
|
|
@@ -21,6 +23,10 @@ const config = {
|
|
|
21
23
|
document: true,
|
|
22
24
|
wp: 'readonly',
|
|
23
25
|
},
|
|
26
|
+
settings: {
|
|
27
|
+
'import/internal-regex': wpPackagesRegExp,
|
|
28
|
+
'import/extensions': [ '.js', '.jsx' ],
|
|
29
|
+
},
|
|
24
30
|
rules: {
|
|
25
31
|
'import/no-extraneous-dependencies': [
|
|
26
32
|
'error',
|
|
@@ -28,7 +34,12 @@ const config = {
|
|
|
28
34
|
peerDependencies: true,
|
|
29
35
|
},
|
|
30
36
|
],
|
|
31
|
-
'import/no-unresolved':
|
|
37
|
+
'import/no-unresolved': [
|
|
38
|
+
'error',
|
|
39
|
+
{
|
|
40
|
+
ignore: [ wpPackagesRegExp ],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
32
43
|
'import/default': 'warn',
|
|
33
44
|
'import/named': 'warn',
|
|
34
45
|
},
|
package/configs/recommended.js
CHANGED
|
@@ -21,7 +21,6 @@ const config = {
|
|
|
21
21
|
extends: [
|
|
22
22
|
require.resolve( './recommended-with-formatting.js' ),
|
|
23
23
|
'plugin:prettier/recommended',
|
|
24
|
-
'prettier/react',
|
|
25
24
|
],
|
|
26
25
|
rules: {
|
|
27
26
|
'prettier/prettier': [ 'error', prettierConfig ],
|
|
@@ -35,7 +34,6 @@ if ( isPackageInstalled( 'typescript' ) ) {
|
|
|
35
34
|
extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
|
|
36
35
|
},
|
|
37
36
|
},
|
|
38
|
-
'import/core-modules': [ 'react' ],
|
|
39
37
|
};
|
|
40
38
|
config.extends.push( 'plugin:@typescript-eslint/eslint-recommended' );
|
|
41
39
|
config.ignorePatterns = [ '**/*.d.ts' ];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/eslint-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "ESLint plugin for WordPress development.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -32,25 +32,27 @@
|
|
|
32
32
|
"main": "index.js",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/eslint-parser": "^7.16.0",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
36
|
-
"@typescript-eslint/parser": "^
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
|
36
|
+
"@typescript-eslint/parser": "^5.3.0",
|
|
37
|
+
"@wordpress/babel-preset-default": "^6.5.0",
|
|
37
38
|
"@wordpress/prettier-config": "^1.1.1",
|
|
38
39
|
"cosmiconfig": "^7.0.0",
|
|
39
|
-
"eslint-config-prettier": "^
|
|
40
|
+
"eslint-config-prettier": "^8.3.0",
|
|
40
41
|
"eslint-plugin-import": "^2.25.2",
|
|
41
|
-
"eslint-plugin-jest": "^
|
|
42
|
-
"eslint-plugin-jsdoc": "^
|
|
43
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
42
|
+
"eslint-plugin-jest": "^25.2.3",
|
|
43
|
+
"eslint-plugin-jsdoc": "^37.0.3",
|
|
44
|
+
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
44
45
|
"eslint-plugin-prettier": "^3.3.0",
|
|
45
|
-
"eslint-plugin-react": "^7.
|
|
46
|
-
"eslint-plugin-react-hooks": "^4.
|
|
47
|
-
"globals": "^12.0
|
|
46
|
+
"eslint-plugin-react": "^7.27.0",
|
|
47
|
+
"eslint-plugin-react-hooks": "^4.3.0",
|
|
48
|
+
"globals": "^13.12.0",
|
|
48
49
|
"prettier": "npm:wp-prettier@2.2.1-beta-1",
|
|
49
50
|
"requireindex": "^1.2.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
|
-
"
|
|
53
|
-
"
|
|
53
|
+
"@babel/core": ">=7",
|
|
54
|
+
"eslint": ">=8",
|
|
55
|
+
"typescript": ">=4"
|
|
54
56
|
},
|
|
55
57
|
"peerDependenciesMeta": {
|
|
56
58
|
"typescript": {
|
|
@@ -60,5 +62,5 @@
|
|
|
60
62
|
"publishConfig": {
|
|
61
63
|
"access": "public"
|
|
62
64
|
},
|
|
63
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "d95ccb9366e249133cdb1d7b25c382446b9ee502"
|
|
64
66
|
}
|
|
@@ -198,6 +198,7 @@ function getFixes( fixer, context, callNode ) {
|
|
|
198
198
|
module.exports = {
|
|
199
199
|
meta: {
|
|
200
200
|
type: 'problem',
|
|
201
|
+
hasSuggestions: true,
|
|
201
202
|
schema: [],
|
|
202
203
|
messages: {
|
|
203
204
|
doNotUseStringLiteral: `Do not use string literals ( '{{ argument }}' ) for accessing @wordpress/data stores. Pass the store definition instead`,
|