Custom ESLint rules for the WordPress.com Calypso project.
You'll first need to install ESLint:
$ npm install eslint --save-dev
Next, install eslint-plugin-wpcalypso
:
$ npm install eslint-plugin-wpcalypso --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-wpcalypso
globally.
Add wpcalypso
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"wpcalypso"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"wpcalypso/rule-name": 2
}
}
i18n-ellipsis
: Disallow using three dots in translate stringsi18n-mismatched-placeholders
: Ensure placeholder counts match between singular and plural stringsi18n-named-placeholders
: Disallow multiple unnamed placeholdersi18n-no-newlines
: Disallow newlines in translatable stringsi18n-no-placeholders-only
: Disallow strings which include only placeholdersi18n-no-variables
: Disallow variables as translate stringsjsx-classname-namespace
: Ensure JSX className adheres to CSS namespace guidelinesjsx-gridicon-size
: Enforce recommended Gridicon size attributesno-lodash-import
: Disallow importing from the root Lodash module
Calypso is licensed under GNU General Public License v2 (or later).