Registry / testing / eslint-plugin-wpcalypso

eslint-plugin-wpcalypso

JSON →
library8.0.0jsnpmunverified

Custom ESLint rules for the WordPress.com Calypso project, version 8.0.0. This plugin enforces coding conventions specific to the Calypso codebase, such as import ordering without nested folders, JSX classname naming, and i18n string restrictions. It requires ESLint >=8.48.0, @babel/core >=7.17.5, and peer dependencies eslint-plugin-jsdoc, eslint-plugin-react, eslint-plugin-react-hooks, and eslint-plugin-inclusive-language. Unlike general-purpose ESLint plugins, this is tailored for the Calypso monorepo and may not be suitable for other projects.

npm install eslint-plugin-wpcalypso
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-WPCA
E
eslint-plugin-wpcalypso
testingjavascriptv8.0.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import wpcalypso from 'eslint-plugin-wpcalypso'
✗ const wpcalypso = require('eslint-plugin-wpcalypso')
ESM-only since v8
rules
✓ import { rules } from 'eslint-plugin-wpcalypso'
✗ const rules = require('eslint-plugin-wpcalypso').rules
Access all rules as an object
configs
✓ import { configs } from 'eslint-plugin-wpcalypso'
✗ const configs = require('eslint-plugin-wpcalypso').configs
Access predefined configs like 'recommended'

Shows how to configure ESLint with the wpcalypso plugin, using the recommended config and customizing a couple of rules.

// .eslintrc.js module.exports = { plugins: ['wpcalypso'], extends: ['plugin:wpcalypso/recommended'], rules: { 'wpcalypso/no-unsafe-wp-apis': 'error', 'wpcalypso/import-dependencies': 'warn', }, };
Debug
Known issues
breakingESM-only exports since v8: require() no longer works. Use import statements.
fix
Use ES module syntax: import wpcalypso from 'eslint-plugin-wpcalypso'
affects: >=8.0.0
deprecatedRule 'wpcalypso/no-unsafe-wp-apis' deprecated in favor of 'jest/no-conditional-expect'?
fix
Use jest/no-conditional-expect instead if applicable.
affects: >=6.0.0
gotchaPlugin enforces import ordering with no nested folders: import paths must be flat (e.g., 'components/button' not 'components/button/icon').
fix
Adjust import paths to be flat as per Calypso conventions.
affects: all
gotchaThe rule 'wpcalypso/i18n-no-variables' disallows variables in translate() calls to ensure string extraction.
fix
Use string literals directly in translate() calls.
affects: all
breakingPeer dependencies must be manually installed: eslint-plugin-jsdoc, eslint-plugin-react, eslint-plugin-react-hooks, eslint-plugin-inclusive-language.
fix
Run npm install --save-dev eslint-plugin-jsdoc eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-inclusive-language
affects: >=6.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'wpcalypso' declared in '.eslintrc': Cannot find module 'eslint-plugin-wpcalypso'
Plugin not installed as a dependency.
fix
Run npm install --save-dev eslint-plugin-wpcalypso
TypeError: wpcalypso is not a function
Using require() with ESM-only plugin v8.
fix
Use import syntax or update to CJS compatible version <8.
Error: Cannot find module '@babel/core'
Missing peer dependency @babel/core.
fix
Run npm install --save-dev @babel/core
Parsing error: Unexpected token =
Project uses Babel syntax but ESLint is not configured with @babel/eslint-parser.
fix
Install @babel/eslint-parser and configure parser in .eslintrc.
Upgrade
Version history
8.0.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency for plugin to function
@babel/corerequiredpeer dependency for Babel AST parsing
eslint-plugin-jsdocrequiredpeer dependency for JSDoc rules
eslint-plugin-reactrequiredpeer dependency for React rules
eslint-plugin-react-hooksrequiredpeer dependency for React Hooks rules
eslint-plugin-inclusive-languagerequiredpeer dependency for inclusive language rules
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-wpcalypso — npm install eslint-plugin-wpcalypso · libregistry