{"id":19987,"library":"eslint-plugin-wpcalypso","title":"eslint-plugin-wpcalypso","description":"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.","status":"active","version":"8.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/Automattic/wp-calypso","tags":["javascript","eslint","eslintplugin","eslint-plugin"],"install":[{"cmd":"npm install eslint-plugin-wpcalypso","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-wpcalypso","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-wpcalypso","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for plugin to function","package":"eslint","optional":false},{"reason":"peer dependency for Babel AST parsing","package":"@babel/core","optional":false},{"reason":"peer dependency for JSDoc rules","package":"eslint-plugin-jsdoc","optional":false},{"reason":"peer dependency for React rules","package":"eslint-plugin-react","optional":false},{"reason":"peer dependency for React Hooks rules","package":"eslint-plugin-react-hooks","optional":false},{"reason":"peer dependency for inclusive language rules","package":"eslint-plugin-inclusive-language","optional":false}],"imports":[{"note":"ESM-only since v8","wrong":"const wpcalypso = require('eslint-plugin-wpcalypso')","symbol":"default","correct":"import wpcalypso from 'eslint-plugin-wpcalypso'"},{"note":"Access all rules as an object","wrong":"const rules = require('eslint-plugin-wpcalypso').rules","symbol":"rules","correct":"import { rules } from 'eslint-plugin-wpcalypso'"},{"note":"Access predefined configs like 'recommended'","wrong":"const configs = require('eslint-plugin-wpcalypso').configs","symbol":"configs","correct":"import { configs } from 'eslint-plugin-wpcalypso'"}],"quickstart":{"code":"// .eslintrc.js\nmodule.exports = {\n  plugins: ['wpcalypso'],\n  extends: ['plugin:wpcalypso/recommended'],\n  rules: {\n    'wpcalypso/no-unsafe-wp-apis': 'error',\n    'wpcalypso/import-dependencies': 'warn',\n  },\n};","lang":"javascript","description":"Shows how to configure ESLint with the wpcalypso plugin, using the recommended config and customizing a couple of rules."},"warnings":[{"fix":"Use ES module syntax: import wpcalypso from 'eslint-plugin-wpcalypso'","message":"ESM-only exports since v8: require() no longer works. Use import statements.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Use jest/no-conditional-expect instead if applicable.","message":"Rule 'wpcalypso/no-unsafe-wp-apis' deprecated in favor of 'jest/no-conditional-expect'?","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Adjust import paths to be flat as per Calypso conventions.","message":"Plugin enforces import ordering with no nested folders: import paths must be flat (e.g., 'components/button' not 'components/button/icon').","severity":"gotcha","affected_versions":"all"},{"fix":"Use string literals directly in translate() calls.","message":"The rule 'wpcalypso/i18n-no-variables' disallows variables in translate() calls to ensure string extraction.","severity":"gotcha","affected_versions":"all"},{"fix":"Run npm install --save-dev eslint-plugin-jsdoc eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-inclusive-language","message":"Peer dependencies must be manually installed: eslint-plugin-jsdoc, eslint-plugin-react, eslint-plugin-react-hooks, eslint-plugin-inclusive-language.","severity":"breaking","affected_versions":">=6.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install --save-dev eslint-plugin-wpcalypso","cause":"Plugin not installed as a dependency.","error":"Error: Failed to load plugin 'wpcalypso' declared in '.eslintrc': Cannot find module 'eslint-plugin-wpcalypso'"},{"fix":"Use import syntax or update to CJS compatible version <8.","cause":"Using require() with ESM-only plugin v8.","error":"TypeError: wpcalypso is not a function"},{"fix":"Run npm install --save-dev @babel/core","cause":"Missing peer dependency @babel/core.","error":"Error: Cannot find module '@babel/core'"},{"fix":"Install @babel/eslint-parser and configure parser in .eslintrc.","cause":"Project uses Babel syntax but ESLint is not configured with @babel/eslint-parser.","error":"Parsing error: Unexpected token ="}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}