Name: eslint-plugin-wordpress
Owner: WordPress Coding Standards
Description: WordPress ESLint rules and shared configs.
Created: 2016-02-20 03:20:03.0
Updated: 2018-05-18 02:02:44.0
Pushed: 2018-05-18 02:02:50.0
Size: 260
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A collection of custom ESLint rules that help enforce JavaScript coding standard in the WordPress project.
You'll first need to install ESLint:
m i eslint --save-dev
Next, install eslint-plugin-wordpress
:
m install eslint-plugin-wordpress --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-wordpress
globally.
This plugin exports a recommended
config that enforces WordPress JavaScript coding standards.
Note: This config will also add the Backbone, jQuery, JSON, Underscore, and the global wp
as allowed globals.
Enable it in your package.json
with the extends
option:
"name": "my-wordpress-project",
"eslintConfig": {
"extends": "plugin:wordpress/recommended",
"plugins": [
"wordpress"
]
}
Or create your own .eslintrc.json
configuration file:
"extends": "plugin:wordpress/recommended",
"plugins": [
"wordpress"
]
Or create your own .eslintrc.js
configuration file:
"extends": "plugin:wordpress/recommended",
"plugins": [
"wordpress"
]
Or create your own .eslintrc.yaml
or .eslintrc.yml
configuration file:
nds:
- "plugin:wordpress/recommended"
ins:
- "wordpress"
See the ESLint docs for more information about configuration file formats.
You can also stack any of the extra shared configs on top of the “recommended” config by extending an array of linting configs. For example, this package provides a Node.js linting config, which can be added to the recommended config with the following configuration file:
"extends": [
"plugin:wordpress/recommended",
"plugin:wordpress/node"
]
The following rulesets are available:
.jshintrc
using https://github.com/brenolf/polyjuice.