Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump wp-scripts to 22.1.0 and webpack config to v5 #1339

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 24 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
const webpackConfig = require( './webpack.config' );

const webpackResolver = {
config: {
resolve: {
...webpackConfig.resolve,
/**
* Make eslint correctly resolve files that omit the .js extensions.
* The default value `'...'` doesn't work before the current eslint support for webpack v5.
* Ref: https://webpack.js.org/configuration/resolve/#resolveextensions
*/
extensions: [ '.js' ],
/**
* Make eslint be able to resolve the exports config of `use-debounce`.
* The `exports` config of package.json doesn't work before the current eslint support it.
* Ref: https://github.com/xnimorz/use-debounce/blob/5.2.0/package.json#L8-L14
*/
conditionNames: [ 'import', 'require' ],
},
},
};

module.exports = {
extends: [
'plugin:@woocommerce/eslint-plugin/recommended',
Expand All @@ -7,7 +29,8 @@ module.exports = {
jsdoc: {
mode: 'typescript',
},
'import/resolver': 'webpack',
'import/core-modules': [ 'webpack' ],
'import/resolver': { webpack: webpackResolver },
},
rules: {
'@wordpress/no-unsafe-wp-apis': 1,
Expand Down
5 changes: 4 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "@wordpress/stylelint-config",
"extends": [
"stylelint-config-standard-scss",
"@wordpress/stylelint-config"
],
"rules": {
"at-rule-empty-line-before": null,
"at-rule-no-unknown": null,
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const defaultConfig = require( '@wordpress/scripts/config/jest-unit.config' );

module.exports = {
...defaultConfig,
testEnvironment: 'jsdom',
moduleNameMapper: {
'\\.svg$': '<rootDir>/tests/mocks/assets/svgrMock.js',
'\\.scss$': '<rootDir>/tests/mocks/assets/styleMock.js',
Expand Down
8 changes: 4 additions & 4 deletions js/src/data/test/reducer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,14 +503,14 @@ describe( 'reducer', () => {
orderby: 'title',
per_page: 2,
total: 7,
pages: { '1': [ '#1', '#2' ] },
pages: { 1: [ '#1', '#2' ] },
} );
expect( pageFourState ).toHaveProperty( path, {
order: 'asc',
orderby: 'title',
per_page: 2,
total: 7,
pages: { '1': [ '#1', '#2' ], '4': [ '#7' ] },
pages: { 1: [ '#1', '#2' ], 4: [ '#7' ] },
} );
} );

Expand All @@ -529,7 +529,7 @@ describe( 'reducer', () => {
const initValue = {
...baseQuery,
total: 7,
pages: { '1': [ '#1', '#2' ], '4': [ '#7' ] },
pages: { 1: [ '#1', '#2' ], 4: [ '#7' ] },
};
const originalState = prepareState( path, initValue, [
path,
Expand All @@ -554,7 +554,7 @@ describe( 'reducer', () => {
...baseQuery,
[ key ]: value,
total: 7,
pages: { '2': [ '#3', '#4' ] },
pages: { 2: [ '#3', '#4' ] },
} );
}
);
Expand Down