@wordpress/eslint-plugin 12.9.0 → 13.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,11 +2,18 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 13.0.0 (2022-08-24)
6
+
7
+ ### Breaking Change
8
+
9
+ - Increase the minimum Node.js version to 14 and minimum npm version to 6.14.4 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)).
10
+ - Remove all rules targeting test files from the `recommended` and `recommended-with-formatting` presets when Jest package is installed ([#43272](https://github.com/WordPress/gutenberg/pull/43272)).
11
+
5
12
  ## 12.8.0 (2022-07-27)
6
13
 
7
14
  ### Code Quality
8
15
 
9
- - Remove deprecated rules `no-negated-in-lhs` replaced with `no-unsafe-negation`, and `jsx-a11y/label-has-for` replaced with `jsx-a11/label-has-associated-control` ([#42654](https://github.com/WordPress/gutenberg/pull/42654)).
16
+ - Remove deprecated rules `no-negated-in-lhs` replaced with `no-unsafe-negation`, and `jsx-a11y/label-has-for` replaced with `jsx-a11/label-has-associated-control` ([#42654](https://github.com/WordPress/gutenberg/pull/42654)).
10
17
 
11
18
  ## 12.6.0 (2022-06-29)
12
19
 
package/README.md CHANGED
@@ -10,7 +10,7 @@ Install the module
10
10
  npm install @wordpress/eslint-plugin --save-dev
11
11
  ```
12
12
 
13
- **Note**: This package requires `node` 12.0.0 or later, and `npm` 6.9.0 or later. It is not compatible with older versions.
13
+ **Note**: This package requires `node` 14.0.0 or later, and `npm` 6.14.4 or later. It is not compatible with older versions.
14
14
 
15
15
  ## Usage
16
16
 
@@ -44,15 +44,15 @@ There is also `recommended-with-formatting` ruleset for projects that want to en
44
44
 
45
45
  Alternatively, you can opt-in to only the more granular rulesets offered by the plugin. These include:
46
46
 
47
- - `custom`
48
- - `es5`
49
- - `esnext`
50
- - `jsdoc`
51
- - `jsx-a11y`
52
- - `react`
53
- - `i18n`
54
- - `test-e2e`
55
- - `test-unit`
47
+ - `custom` – custom rules for WordPress development.
48
+ - `es5` – rules for legacy ES5 environments.
49
+ - `esnext` – rules for ES2015+ environments.
50
+ - `i18n` – rules for internationalization.
51
+ - `jsdoc` – rules for JSDoc comments.
52
+ - `jsx-a11y` – rules for accessibility in JSX.
53
+ - `react` – rules for React components.
54
+ - `test-e2e` – rules for end-to-end tests written in Puppeteer.
55
+ - `test-unit`– rules for unit tests written in Jest.
56
56
 
57
57
  For example, if your project does not use React, you could consider extending including only the ESNext rules in your project using the following `extends` definition:
58
58
 
@@ -1,10 +1,5 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- const { isPackageInstalled } = require( '../utils' );
5
-
6
1
  // Exclude bundled WordPress packages from the list.
7
- const wpPackagesRegExp = '^@wordpress/(?!(icons|interface))';
2
+ const wpPackagesRegExp = '^@wordpress/(?!(icons|interface|style-engine))';
8
3
 
9
4
  const config = {
10
5
  extends: [
@@ -45,23 +40,4 @@ const config = {
45
40
  },
46
41
  };
47
42
 
48
- // Don't apply Jest config if Playwright is installed.
49
- if (
50
- isPackageInstalled( 'jest' ) &&
51
- ! isPackageInstalled( '@playwright/test' )
52
- ) {
53
- config.overrides = [
54
- {
55
- // Unit test files and their helpers only.
56
- files: [ '**/@(test|__tests__)/**/*.js', '**/?(*.)test.js' ],
57
- extends: [ require.resolve( './test-unit.js' ) ],
58
- },
59
- {
60
- // End-to-end test files and their helpers only.
61
- files: [ '**/specs/**/*.js', '**/?(*.)spec.js' ],
62
- extends: [ require.resolve( './test-e2e.js' ) ],
63
- },
64
- ];
65
- }
66
-
67
43
  module.exports = config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/eslint-plugin",
3
- "version": "12.9.0",
3
+ "version": "13.0.0",
4
4
  "description": "ESLint plugin for WordPress development.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -20,8 +20,8 @@
20
20
  "url": "https://github.com/WordPress/gutenberg/issues"
21
21
  },
22
22
  "engines": {
23
- "node": ">=12",
24
- "npm": ">=6.9"
23
+ "node": ">=14",
24
+ "npm": ">=6.14.4"
25
25
  },
26
26
  "files": [
27
27
  "configs",
@@ -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.17.0",
38
- "@wordpress/prettier-config": "^1.4.0",
37
+ "@wordpress/babel-preset-default": "^7.0.0",
38
+ "@wordpress/prettier-config": "^2.0.0",
39
39
  "cosmiconfig": "^7.0.0",
40
40
  "eslint-config-prettier": "^8.3.0",
41
41
  "eslint-plugin-import": "^2.25.2",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "08358f53b627a15148c3a3e433cdf58cf8714aa4"
68
+ "gitHead": "171b87c7465b93e685e081c5f57f153507363c95"
69
69
  }
@@ -22,7 +22,7 @@ ruleTester.run( 'dependency-group', rule, {
22
22
  /**
23
23
  * External dependencies
24
24
  */
25
- import { get } from 'lodash';
25
+ import { camelCase } from 'change-case';
26
26
  import classnames from 'classnames';
27
27
 
28
28
  /**
@@ -40,7 +40,7 @@ import edit from './edit';`,
40
40
  /**
41
41
  * External dependencies
42
42
  */
43
- const { get } = require( 'lodash' );
43
+ const { camelCase } = require( 'change-case' );
44
44
  const classnames = require( 'classnames' );
45
45
 
46
46
  /**
@@ -57,7 +57,7 @@ const edit = require( './edit' );`,
57
57
  invalid: [
58
58
  {
59
59
  code: `
60
- import { get } from 'lodash';
60
+ import { camelCase } from 'change-case';
61
61
  import classnames from 'classnames';
62
62
  /*
63
63
  * wordpress dependencies.
@@ -82,7 +82,7 @@ import edit from './edit';`,
82
82
  /**
83
83
  * External dependencies
84
84
  */
85
- import { get } from 'lodash';
85
+ import { camelCase } from 'change-case';
86
86
  import classnames from 'classnames';
87
87
  /**
88
88
  * WordPress dependencies
@@ -95,7 +95,7 @@ import edit from './edit';`,
95
95
  },
96
96
  {
97
97
  code: `
98
- const { get } = require( 'lodash' );
98
+ const { camelCase } = require( 'change-case' );
99
99
  const classnames = require( 'classnames' );
100
100
  /*
101
101
  * wordpress dependencies.
@@ -120,7 +120,7 @@ const edit = require( './edit' );`,
120
120
  /**
121
121
  * External dependencies
122
122
  */
123
- const { get } = require( 'lodash' );
123
+ const { camelCase } = require( 'change-case' );
124
124
  const classnames = require( 'classnames' );
125
125
  /**
126
126
  * WordPress dependencies
@@ -21,15 +21,15 @@ const options = [
21
21
 
22
22
  ruleTester.run( 'no-unsafe-wp-apis', rule, {
23
23
  valid: [
24
- { code: "import _ from 'lodash';", options },
25
- { code: "import { map } from 'lodash';", options },
26
- { code: "import { __experimentalFoo } from 'lodash';", options },
27
- { code: "import { __unstableFoo } from 'lodash';", options },
28
- { code: "import _, { __unstableFoo } from 'lodash';", options },
29
- { code: "import * as _ from 'lodash';", options },
24
+ { code: "import _ from 'change-case';", options },
25
+ { code: "import { camelCase } from 'change-case';", options },
26
+ { code: "import { __experimentalFoo } from 'change-case';", options },
27
+ { code: "import { __unstableFoo } from 'change-case';", options },
28
+ { code: "import _, { __unstableFoo } from 'change-case';", options },
29
+ { code: "import * as _ from 'change-case';", options },
30
30
 
31
31
  { code: "import _ from './x';", options },
32
- { code: "import { map } from './x';", options },
32
+ { code: "import { camelCase } from './x';", options },
33
33
  { code: "import { __experimentalFoo } from './x';", options },
34
34
  { code: "import { __unstableFoo } from './x';", options },
35
35
  { code: "import _, { __unstableFoo } from './x';", options },