@wordpress/eslint-plugin 10.1.0-next.e230fbab09.0 → 11.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 +9 -1
- package/README.md +14 -2
- package/configs/recommended.js +12 -11
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 11.0.0 (2022-03-11)
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
- The integration with [Prettier](https://prettier.io) is now optional and gets activated when the `prettier` package is installed in the project ([#39244](https://github.com/WordPress/gutenberg/pull/39244)).
|
|
10
|
+
|
|
11
|
+
### Bug Fix
|
|
12
|
+
|
|
13
|
+
- Replaced no-shadow eslint rule with @typescript-eslint/no-shadow ([#38665](https://github.com/WordPress/gutenberg/pull/38665)).
|
|
6
14
|
|
|
7
15
|
## 10.0.0 (2022-01-27)
|
|
8
16
|
|
package/README.md
CHANGED
|
@@ -24,9 +24,21 @@ To opt-in to the default configuration, extend your own project's `.eslintrc` fi
|
|
|
24
24
|
|
|
25
25
|
Refer to the [ESLint documentation on Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs) for more information.
|
|
26
26
|
|
|
27
|
-
The `recommended` preset will include rules governing an ES2015+ environment, and includes rules from the [`eslint-plugin-
|
|
27
|
+
The `recommended` preset will include rules governing an ES2015+ environment, and includes rules from the [`eslint-plugin-jsdoc`](https://github.com/gajus/eslint-plugin-jsdoc), [`eslint-plugin-jsx-a11y`](https://github.com/evcohen/eslint-plugin-jsx-a11y), [`eslint-plugin-react`](https://github.com/yannickcr/eslint-plugin-react), and other similar plugins.
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
This preset offers an optional integration with the [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier) package that runs [Prettier](https://prettier.io) code formatter and reports differences as individual ESLint issues. You can activate it by installing the [`prettier`](https://www.npmjs.com/package/prettier) package separately with:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install prettier --save-dev
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Finally, this ruleset also includes an optional integration with the [`@typescript-eslint/eslint-plugin`](https://github.com/typescript-eslint/typescript-eslint) package that enables ESLint to support [TypeScript](https://www.typescriptlang.org) language. You can activate it by installing the [`typescript`](https://www.npmjs.com/package/typescript) package separately with:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install typescript --save-dev
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
There is also `recommended-with-formatting` ruleset for projects that want to ensure that [Prettier](https://prettier.io) and [TypeScript](https://www.typescriptlang.org) integration is never activated. This preset has the native ESLint code formatting rules enabled instead.
|
|
30
42
|
|
|
31
43
|
### Rulesets
|
|
32
44
|
|
package/configs/recommended.js
CHANGED
|
@@ -13,20 +13,21 @@ const defaultPrettierConfig = require( '@wordpress/prettier-config' );
|
|
|
13
13
|
*/
|
|
14
14
|
const { isPackageInstalled } = require( '../utils' );
|
|
15
15
|
|
|
16
|
-
const { config: localPrettierConfig } =
|
|
17
|
-
cosmiconfigSync( 'prettier' ).search() || {};
|
|
18
|
-
const prettierConfig = { ...defaultPrettierConfig, ...localPrettierConfig };
|
|
19
|
-
|
|
20
16
|
const config = {
|
|
21
|
-
extends: [
|
|
22
|
-
require.resolve( './recommended-with-formatting.js' ),
|
|
23
|
-
'plugin:prettier/recommended',
|
|
24
|
-
],
|
|
25
|
-
rules: {
|
|
26
|
-
'prettier/prettier': [ 'error', prettierConfig ],
|
|
27
|
-
},
|
|
17
|
+
extends: [ require.resolve( './recommended-with-formatting.js' ) ],
|
|
28
18
|
};
|
|
29
19
|
|
|
20
|
+
if ( isPackageInstalled( 'prettier' ) ) {
|
|
21
|
+
config.extends.push( 'plugin:prettier/recommended' );
|
|
22
|
+
|
|
23
|
+
const { config: localPrettierConfig } =
|
|
24
|
+
cosmiconfigSync( 'prettier' ).search() || {};
|
|
25
|
+
const prettierConfig = { ...defaultPrettierConfig, ...localPrettierConfig };
|
|
26
|
+
config.rules = {
|
|
27
|
+
'prettier/prettier': [ 'error', prettierConfig ],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
30
31
|
if ( isPackageInstalled( 'typescript' ) ) {
|
|
31
32
|
config.settings = {
|
|
32
33
|
'import/resolver': {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/eslint-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.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": "^5.3.0",
|
|
36
36
|
"@typescript-eslint/parser": "^5.3.0",
|
|
37
|
-
"@wordpress/babel-preset-default": "^6.6.0
|
|
38
|
-
"@wordpress/prettier-config": "^1.2
|
|
37
|
+
"@wordpress/babel-preset-default": "^6.6.0",
|
|
38
|
+
"@wordpress/prettier-config": "^1.1.2",
|
|
39
39
|
"cosmiconfig": "^7.0.0",
|
|
40
40
|
"eslint-config-prettier": "^8.3.0",
|
|
41
41
|
"eslint-plugin-import": "^2.25.2",
|
|
@@ -46,15 +46,18 @@
|
|
|
46
46
|
"eslint-plugin-react": "^7.27.0",
|
|
47
47
|
"eslint-plugin-react-hooks": "^4.3.0",
|
|
48
48
|
"globals": "^13.12.0",
|
|
49
|
-
"prettier": "npm:wp-prettier@2.2.1-beta-1",
|
|
50
49
|
"requireindex": "^1.2.0"
|
|
51
50
|
},
|
|
52
51
|
"peerDependencies": {
|
|
53
52
|
"@babel/core": ">=7",
|
|
54
53
|
"eslint": ">=8",
|
|
54
|
+
"prettier": ">=2",
|
|
55
55
|
"typescript": ">=4"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
|
+
"prettier": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
58
61
|
"typescript": {
|
|
59
62
|
"optional": true
|
|
60
63
|
}
|
|
@@ -62,5 +65,5 @@
|
|
|
62
65
|
"publishConfig": {
|
|
63
66
|
"access": "public"
|
|
64
67
|
},
|
|
65
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "c37fd7edbc3e379540d7b24fce75a6f640a434ae"
|
|
66
69
|
}
|