@wearerequired/eslint-config
v7.0.0
Published
required coding standard for JavaScript.
Downloads
682
Readme
required JavaScript Coding Standard
required coding standard for JavaScript, based on the rules provided by @wordpress/eslint-plugin.
Installation
This package is an ESLint shareable configuration. Install it together with its peer dependencies:
npm install --save-dev @wearerequired/eslint-config eslint @wordpress/eslint-plugin "prettier@npm:wp-prettier@^3"npm 7+ installs peer dependencies automatically, so listing them is optional for a working install — but installing them explicitly keeps them pinned in your
package.json(and visible to editors/CI). Usewp-prettier, not the standard Prettier: the config relies on theparenSpacingoption, which onlywp-prettierprovides.
Requires ESLint 9 or 10 and @wordpress/eslint-plugin 25 or newer.
Note — ESLint 10: works when ESLint is provided by
@wordpress/scripts(v32+, the recommended WordPress setup) — it bundles ESLint 10 and@wordpress/eslint-plugin25 in a controlled tree. For a standalone direct ESLint 10 install (no@wordpress/scripts), the classiceslint-plugin-import@2bundled by@wordpress/eslint-pluginstill stops at ESLint 9 in its peer range, so npm nests the TypeScript import resolver and it fails to load (typescript with invalid interface loaded as resolver); installeslint-import-resolver-typescriptas a direct dependency or use--legacy-peer-depsthere. This resolves once WordPress moves toeslint-plugin-import-x(see WordPress/gutenberg#76654).
Usage
This package exports a flat config.
Create an eslint.config.js file in your project root:
const config = require( '@wearerequired/eslint-config' );
module.exports = config;To add your own overrides, spread the config into an array:
const config = require( '@wearerequired/eslint-config' );
module.exports = [
...config,
{
rules: {
// Your project-specific overrides.
},
},
];Migrating from v6
- Remove
.eslintrc*and.eslintignoreand add aneslint.config.jsas shown above (move ignore patterns into an{ ignores: [ … ] }config object). - Update
eslintto^9and@wordpress/eslint-pluginto>=25. - If you install ESLint via
wearerequired/lint-action, make sure your version supports ESLint 9 / flat config. - Prefer
npm ciovernpm iin CI so installs are reproducible. - Browser globals are no longer predefined (this matches the WordPress default). If you lint
.js/.jsxfiles that use bare DOM-only globals (MutationObserver,getComputedStyle,IntersectionObserver, …), add them vialanguageOptions.globalsin youreslint.config.jsor access them throughwindow.. TypeScript files are unaffected (no-undefis off for TS).

