@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 CHANGED
@@ -2,7 +2,15 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- – Replaced no-shadow eslint rule with @typescript-eslint/no-shadow ([#38665](https://github.com/WordPress/gutenberg/pull/38665)).
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-jsx-a11y`](https://github.com/evcohen/eslint-plugin-jsx-a11y), [`eslint-plugin-react`](https://github.com/yannickcr/eslint-plugin-react), and [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier) projects. It also includes an optional integration with [`@typescript-eslint/eslint-plugin`](https://github.com/typescript-eslint/typescript-eslint) that gets activated when the [`typescript`](https://www.npmjs.com/package/typescript) package is installed in the project.
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
- There is also `recommended-with-formatting` ruleset for projects that want to opt out from [Prettier](https://prettier.io). It has the native ESLint code formatting rules enabled instead.
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
 
@@ -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": "10.1.0-next.e230fbab09.0",
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-next.e230fbab09.0",
38
- "@wordpress/prettier-config": "^1.2.0-next.e230fbab09.0",
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": "308df03e6a96ded732f9c4e32471b1b4f8dea54a"
68
+ "gitHead": "c37fd7edbc3e379540d7b24fce75a6f640a434ae"
66
69
  }