This will be the base wepback configuration for all WordPress plugins and themes
In package.json, add BC Gov Webpack Wordpress as a dev dependency:
"devDependencies": {
"@bcgov/webpack-wordpress": "git+https://apps.itsm.gov.bc.ca/bitbucket/scm/wp/bcgov-webpack-wordpress.git"
}
To add the JS linter rules, create an .eslint.js file in your repository(if none present),
and add the rules under the "extends" key:
extends: [
"./node_modules/@bcgov/webpack-wordpress/.eslint.js",
]
You have the option to reduce the error severity to warnings if your project requires it. Declare a LINT_SEVERITY environment variable in the relevant npm script and set it to warn. If no such environment variable is set, the default severity level will be error.
"scripts": {
...
"lint:js" : "LINT_SEVERITY=warn wp-scripts lint-js ./src/scripts"
}
In this rule set, console.log() calls are not permitted in production builds. To enable this,
declare a NODE_ENV environment variable in the relevant npm script. Set its value to production to ensure console calls are flagged.
To add the style linter rules, create a .stylelintrc file in your repositor(if none present),
and add the rule set under the "extends" key:
{
"extends": "./node_modules/@bcgov/webpack-wordpress/.stylelintrc",
}
sass @import "~@bcgov/webpack-wordpress/src/styles/mixins";
@import "~@bcgov/webpack-wordpress/src/styles/components/blocks";
@import "~@bcgov/webpack-wordpress/src/styles/components/gform";
@import "~@bcgov/webpack-wordpress/src/styles/components/posts";
@import "~@bcgov/webpack-wordpress/src/styles/components/print";
@import "~@bcgov/webpack-wordpress/src/styles/components/wp-classes";
- Add standalone test for this repo, for ease of development and testing.