eslint-plugin-square

raw JSON →
26.0.1 verified Fri May 01 auth: no javascript

Square's custom ESLint plugin that consolidates frontend linting rules and configurations including base, Ember, React, strict, and TypeScript configs. Current stable version is 26.0.1, requires Node ^18.0.0 || >=20.0.0 and ESLint >= 8.40.0. Ships TypeScript types, integrates eslint-plugin-import, eslint-plugin-unicorn, eslint-plugin-react, eslint-plugin-react-hooks, eslint-plugin-jsx-a11y, prettier, and more. Not recommended for public use outside Square. Breaking changes in v26: dropped Node v16 support; v24 added warning on unused ESLint disable directives in base config.

error Error: ESLint couldn't find the plugin "eslint-plugin-square".
cause Missing installed package or incorrect configuration.
fix
Run 'yarn add --dev eslint-plugin-square' or check node_modules.
error Oops! Something went wrong! :( ESLint: 8.x. Error: Configuration for rule "unicorn/xxx" is invalid.
cause Breaking change in eslint-plugin-unicorn major version bump.
fix
Update eslint-plugin-square to v25+ or pin eslint-plugin-unicorn to compatible version.
error TypeError: Cannot destructure property 'configs' of 'require(...)' as it is undefined.
cause Trying to import named exports via require() in a CJS file; plugin may be ESM-only in recent versions.
fix
Use dynamic import() or switch to ESM (eslint.config.js) with import statement.
breaking Node v16 support dropped in v26.0.0. Must use Node ^18.0.0 || >=20.0.0.
fix Upgrade Node to 18 or 20+.
breaking Unused ESLint disable directives now warn by default in base config since v24.0.0.
fix Use --report-unused-disable-directives to check, or disable with 'no-unused-disable-directives': 'off'.
deprecated eslint-plugin-unicorn v46+ introduced breaking changes; base config updated in v25.0.0.
fix Ensure you're using eslint-plugin-square v25+ if you depend on Unicorn rules.
gotcha The plugin is not recommended for public use outside Square; configs may change without notice.
fix If using externally, pin to a specific version and expect breaking changes.
gotcha ESM projects must use .eslintrc.cjs instead of .eslintrc.js when using CommonJS config export.
fix Rename to .eslintrc.cjs or use ESM config format (eslint.config.js with export default).
npm install eslint-plugin-square
yarn add eslint-plugin-square
pnpm add eslint-plugin-square

Shows how to install, configure the base preset in a .eslintrc.cjs file, and set up npm-run-all scripts.

// Install:
// yarn add --dev eslint eslint-plugin-square npm-run-all

// .eslintrc.cjs (CommonJS):
module.exports = {
  extends: ['plugin:square/base'],
  env: { browser: true, node: true },
};

// package.json scripts:
{
  "scripts": {
    "lint": "npm-run-all --continue-on-error --aggregate-output --parallel lint:*",
    "lint:js": "eslint --report-unused-disable-directives --cache ."
  }
}

// Then run:
// yarn lint