Update @wordpress/eslint-plugin dependency to latest version. (https://github.com/woocommerce/woocommerce-admin/pull/5856)

* update @wordpress/eslint-plugin dependency to latest version

* local prettier config isn’t needed anymore because of fix in upstream package

* add jsdoc config to use typescript format for jsdocs

* update changelog

* update packages and include .prettierrc.js back in for code editor support of prettier

* add docs

* minor prettier fix in test file

* Convert all new eslint rules throwing errors to warnings temporarily to be handled in separate prs

* updated changelog

* fix package-lock.json

* prettier auto-fixes

* add prettier dependency at root

* sigh prettier is being finicky

* version bump

Co-authored-by: Paul Sealock <psealock@gmail.com>
This commit is contained in:
Darren Ethier 2021-01-25 19:24:28 -05:00 committed by GitHub
parent 74b3eccbc9
commit 4210b6f0a8
15 changed files with 1017 additions and 437 deletions

View File

@ -8,5 +8,11 @@ module.exports = {
'error',
{ definedTags: [ 'jest-environment' ] },
],
'import/no-extraneous-dependencies': 'warn',
'import/no-unresolved': 'warn',
'jest/no-deprecated-functions': 'warn',
'@wordpress/no-unsafe-wp-apis': 'warn',
'jest/valid-title': 'warn',
'@wordpress/no-global-active-element': 'warn',
},
};

View File

@ -0,0 +1,3 @@
// Import the default config file and expose it in the project root.
// Useful for editor integrations.
module.exports = require("@wordpress/prettier-config");

View File

@ -1 +0,0 @@
"@wordpress/prettier-config"

View File

@ -21,7 +21,7 @@
},
"devDependencies": {
"@wordpress/scripts": "^12.2.1",
"@woocommerce/eslint-plugin": "1.0.0-beta.0",
"@woocommerce/eslint-plugin": "1.1.0",
"@woocommerce/dependency-extraction-webpack-plugin": "1.1.0"
}
}

View File

@ -48,7 +48,7 @@ const REVIEW = {
};
jest.mock( '@woocommerce/components', () => ( {
...require.requireActual( '@woocommerce/components' ),
...jest.requireActual( '@woocommerce/components' ),
Link: ( { children } ) => {
return <>{ children }</>;
},

View File

@ -424,7 +424,7 @@ describe( 'Page with single post', () => {
} );
} );
describe( 'Custom title and description ', () => {
describe( 'Custom title and description', () => {
it( 'should override defaults', () => {
const { getByText } = render(
<KnowledgeBase

View File

@ -177,7 +177,7 @@ describe( 'Click Recommendations', () => {
} );
} );
describe( 'Custom title and description ', () => {
describe( 'Custom title and description', () => {
it( 'should override defaults', () => {
const { getByText } = render(
<RecommendedExtensions

File diff suppressed because it is too large Load Diff

View File

@ -149,8 +149,8 @@
"@testing-library/user-event": "12.6.0",
"@woocommerce/components": "file:packages/components",
"@woocommerce/csv-export": "file:packages/csv-export",
"@woocommerce/customer-effort-score": "file:packages/customer-effort-score",
"@woocommerce/currency": "file:packages/currency",
"@woocommerce/customer-effort-score": "file:packages/customer-effort-score",
"@woocommerce/data": "file:packages/data",
"@woocommerce/date": "file:packages/date",
"@woocommerce/eslint-plugin": "file:packages/eslint-plugin",
@ -164,11 +164,10 @@
"@wordpress/browserslist-config": "2.6.0",
"@wordpress/custom-templated-path-webpack-plugin": "1.6.0",
"@wordpress/e2e-test-utils": "4.6.0",
"@wordpress/eslint-plugin": "7.1.0",
"@wordpress/eslint-plugin": "8.0.0",
"@wordpress/jest-preset-default": "5.5.0",
"@wordpress/postcss-plugins-preset": "1.3.0",
"@wordpress/postcss-themes": "1.0.5",
"@wordpress/prettier-config": "0.3.0",
"@wordpress/scripts": "12.0.0",
"ast-types": "0.14.2",
"autoprefixer": "10.2.3",
@ -184,6 +183,7 @@
"cross-env": "7.0.3",
"css-loader": "3.6.0",
"docsify-cli": "4.4.2",
"eslint-plugin-import": "^2.22.1",
"fs-extra": "8.1.0",
"grunt": "1.3.0",
"grunt-checktextdomain": "1.0.1",
@ -200,7 +200,7 @@
"node-watch": "0.7.1",
"postcss-color-function": "4.1.0",
"postcss-loader": "3.0.0",
"prettier": "npm:wp-prettier@2.0.5",
"prettier": "npm:wp-prettier@2.2.1-beta-1",
"promptly": "3.2.0",
"prop-types": "15.7.2",
"raw-loader": "4.0.2",

View File

@ -18,7 +18,7 @@ import {
} from '../scales';
jest.mock( 'd3-scale', () => ( {
...require.requireActual( 'd3-scale' ),
...jest.requireActual( 'd3-scale' ),
scaleBand: jest.fn().mockReturnValue( {
bandwidth: jest.fn().mockReturnThis(),
domain: jest.fn().mockReturnThis(),

View File

@ -31,8 +31,8 @@ describe( 'items reducer', () => {
errors: {},
data: {
[ itemType ]: {
'1': { id: 1, title: 'Donkey', status: 'flavortown' },
'2': { id: 2, title: 'Sauce', status: 'flavortown' },
1: { id: 1, title: 'Donkey', status: 'flavortown' },
2: { id: 2, title: 'Sauce', status: 'flavortown' },
},
},
};

View File

@ -1,3 +1,8 @@
# 1.1.0
- Updated `@wordpress/eslint-plugin` dependency to latest version.
- `jsdoc` linting is configured to allow typescript style jsdocs.
# 1.0.0
- Released package

View File

@ -21,10 +21,10 @@ npm install @woocommerce/eslint-plugin --save-dev
## Usage
To opt-in to the default configuration, extend your own project's `.eslintrc` file:
To opt-in to the default configuration, extend your own project's `.eslintrc.js` file:
```
{
```js
module.exports = {
"extends": [ "plugin:@woocommerce/eslint-plugin/recommended" ]
}
```
@ -33,6 +33,12 @@ Refer to the [ESLint documentation on Shareable Configs](http://eslint.org/docs/
The `recommended` preset will include rules governing an ES2015+ environment, and includes rules from the [`@wordpress/eslint-plugin/recommended`](https://github.com/WordPress/gutenberg/tree/master/packages/eslint-plugin) project.
If you want to use prettier in your code editor, you'll need ot create a `.prettierrc.js` file at the root of your project with the following:
```js
module.exports = require("@wordpress/prettier-config");
```
### Rules
Rule|Description|Recommended

View File

@ -3,6 +3,11 @@ module.exports = {
rules: {
'@woocommerce/dependency-group': 'error',
},
settings: {
jsdoc: {
mode: 'typescript',
},
},
overrides: [
{
files: [

View File

@ -1,6 +1,6 @@
{
"name": "@woocommerce/eslint-plugin",
"version": "1.0.0-beta.0",
"version": "1.1.0",
"description": "ESLint plugin for WooCommerce development.",
"author": "Automattic",
"license": "GPL-2.0-or-later",
@ -26,11 +26,13 @@
],
"main": "index.js",
"dependencies": {
"@wordpress/eslint-plugin": "^7.1.0",
"@wordpress/eslint-plugin": "^8.0.0",
"eslint": "^7",
"eslint-plugin-react-hooks": "^4.0.4",
"eslint-plugin-testing-library": "^3.3.1",
"requireindex":"^1.2.0"
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-testing-library": "^3.10.1",
"@wordpress/prettier-config": "1.0.0",
"prettier": "npm:wp-prettier@2.2.1-beta-1",
"requireindex":"1.2.0"
},
"publishConfig": {
"access": "public"