Commit a34fb9ca955 for woocommerce
commit a34fb9ca955c0cbc5e7d0952f68ee533c457f673
Author: Vlad Olaru <vlad.olaru@automattic.com>
Date: Thu Sep 17 21:51:12 2026 +0300
[docs] Fix stale ESLint guidance in blocks CLAUDE.md (#68820)
docs(blocks): Fix stale ESLint guidance in CLAUDE.md
The blocks CLAUDE.md tells agents and contributors to lint a file with
a bare `npx eslint --fix`. Run from client/blocks, that crashes with
"TypeError: require is not a function or its return value is not
iterable" on files whose imports fall through to the webpack import
resolver. The resolver loads webpack.config.js, whose interactive
blocks config destructures the @wordpress/scripts webpack config, and
that config is only an array when WP_EXPERIMENTAL_MODULES is set. Run
from the monorepo root, which the command block asks for, npx finds no
ESLint in the repo at all.
Point the line at the package's lint:js script instead: it sets
WP_EXPERIMENTAL_MODULES and runs from the package directory. The path
has to come before --fix. wp-scripts reads `--fix <path>` as a flag
value, finds no file arguments, and lints and fixes the whole package.
The Gotchas entry still named .eslintrc.js, which #66621 replaced with
the flat config in eslint.config.mjs. Keep the point that the package
config differs from the root one, under the current filename.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
diff --git a/plugins/woocommerce/client/blocks/CLAUDE.md b/plugins/woocommerce/client/blocks/CLAUDE.md
index 88098e5c923..2167dccb778 100644
--- a/plugins/woocommerce/client/blocks/CLAUDE.md
+++ b/plugins/woocommerce/client/blocks/CLAUDE.md
@@ -23,7 +23,7 @@ pnpm --filter=@woocommerce/block-library test:update # Update s
pnpm --filter=@woocommerce/block-library test:e2e # Playwright E2E tests
# Lint (target specific files only)
-npx eslint --fix path/to/file.tsx # Fix JS/TS file
+pnpm --filter=@woocommerce/block-library lint:js path/to/file.tsx --fix # Fix JS/TS file (path relative to client/blocks; --fix after the path)
pnpm --filter=@woocommerce/block-library lint:css # Stylelint for SCSS
pnpm --filter=@woocommerce/block-library ts:check # TypeScript type checking
@@ -228,7 +228,7 @@ Webpack writes directly to `plugins/woocommerce/assets/client/blocks/` so PHP en
## Gotchas
-- **ESLint config** has custom WooCommerce rules and lodash import restrictions - use the local `.eslintrc.js`, not the monorepo root
+- **ESLint config** has custom WooCommerce rules and lodash import restrictions - use the local `eslint.config.mjs`, not the monorepo root
- **`side-effects` in package.json** is extensive - many files cannot be tree-shaken (CSS, block registrations, filters)
- **StoreApi lives outside Blocks** at `src/StoreApi/`, not `src/Blocks/StoreApi/`
- **Two DI containers** exist: `src/Blocks/Registry/Container.php` (blocks-specific, legacy) and the main WooCommerce DI container in `src/`