WordPress-Coding-Standards/eslint-plugin-wordpress

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

Homepage:

Size: 260

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

eslint-plugin-wordpress

A collection of custom ESLint rules that help enforce JavaScript coding standard in the WordPress project.

Build Status Coverage Status bitHound Overall Score NPM version

Installation

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.

Usage

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"
]

Available rulesets

The following rulesets are available:

Resources
Code Sources, References,

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.