woocommerce/plugins/woocommerce-admin/packages/eslint-plugin
Paul Sealock 8b80c83b09 Prepare to publish packages (https://github.com/woocommerce/woocommerce-admin/pull/4908)
* get changelogs ready

* bump versions in package.json

* reset stable tag
2020-08-04 15:10:36 +12:00
..
configs Add @woocommerce/eslint-plugin (https://github.com/woocommerce/woocommerce-admin/pull/4714) 2020-07-28 14:32:58 +12:00
docs/rules Add @woocommerce/eslint-plugin (https://github.com/woocommerce/woocommerce-admin/pull/4714) 2020-07-28 14:32:58 +12:00
rules Add @woocommerce/eslint-plugin (https://github.com/woocommerce/woocommerce-admin/pull/4714) 2020-07-28 14:32:58 +12:00
.npmrc Add @woocommerce/eslint-plugin (https://github.com/woocommerce/woocommerce-admin/pull/4714) 2020-07-28 14:32:58 +12:00
CHANGELOG.md Prepare to publish packages (https://github.com/woocommerce/woocommerce-admin/pull/4908) 2020-08-04 15:10:36 +12:00
README.md Add @woocommerce/eslint-plugin (https://github.com/woocommerce/woocommerce-admin/pull/4714) 2020-07-28 14:32:58 +12:00
index.js Add @woocommerce/eslint-plugin (https://github.com/woocommerce/woocommerce-admin/pull/4714) 2020-07-28 14:32:58 +12:00
package.json Add @woocommerce/eslint-plugin (https://github.com/woocommerce/woocommerce-admin/pull/4714) 2020-07-28 14:32:58 +12:00

README.md

ESLint Plugin

This is an ESLint plugin including configurations and custom rules for WooCommerce development.

Note: This primarily extends the @wordpress/eslint-plugin/recommended ruleset and does not change any of the rules exposed on that plugin. As a base, all WooCommerce projects are expected to follow WordPress JavaScript Code Styles.

However, this ruleset does implement the following (which do not conflict with WordPress standards):

  • prettier formatting (using wp-prettier)
  • Dependency grouping (External and Internal) for dependencies in JavaScript files
  • No yoda conditionals
  • Radix argument required for parseInt.

Installation

Install the module

npm install @woocommerce/eslint-plugin --save-dev

Usage

To opt-in to the default configuration, extend your own project's .eslintrc file:

{
  "extends": [ "plugin:@woocommerce/eslint-plugin/recommended" ]
}

Refer to the ESLint documentation on Shareable Configs for more information.

The recommended preset will include rules governing an ES2015+ environment, and includes rules from the @wordpress/eslint-plugin/recommended project.

Rules

Rule Description Recommended
dependency-group Enforce dependencies docblocks formatting