{"id":19555,"library":"eslint-config-preact","title":"eslint-config-preact","description":"Unopinionated baseline ESLint configuration for Preact and Preact CLI codebases. Current stable version is 2.0.0, released with ESLint v9 support and dropped support for legacy configs. It provides sensible defaults for modern JS, JSX, Preact, Jest, and Mocha, avoiding stylistic or subjective rules. This config helps catch bugs and suggests optimal patterns. It has a low release cadence (major versions every ~1-2 years). Differentiator: focused solely on Preact, unlike generic React configs.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/preactjs/eslint-config-preact","tags":["javascript","eslint","eslint-config"],"install":[{"cmd":"npm install eslint-config-preact","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-config-preact","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-config-preact","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for eslint to work","package":"eslint","optional":false}],"imports":[{"note":"ESM default export. In CommonJS, use `const {default: preact} = require('eslint-config-preact')`.","wrong":"const preact = require('eslint-config-preact')","symbol":"default","correct":"import preact from 'eslint-config-preact'"},{"note":"The config exports an array, must be spread into your eslint config array.","wrong":"export default preact;","symbol":"default with ESM","correct":"export default [...preact];"},{"note":"CommonJS users must destructure `default` and spread the array.","wrong":"const preact = require('eslint-config-preact'); module.exports = preact;","symbol":"default with CommonJS","correct":"const {default: preact} = require('eslint-config-preact'); module.exports = [...preact];"}],"quickstart":{"code":"// eslint.config.js\nimport preact from 'eslint-config-preact';\n\nexport default [\n  ...preact,\n  // your custom rules\n  {\n    rules: {\n      'no-console': 'warn'\n    }\n  }\n];","lang":"javascript","description":"Shows how to import and extend eslint-config-preact in an ESLint flat config file."},"warnings":[{"fix":"Migrate to eslint.config.js using the flat config format. See the quickstart for an example.","message":"Version 2.0.0 drops support for legacy .eslintrc configs. Only flat config (eslint.config.js) is supported.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Upgrade ESLint to version ^8.57.1 || ^9.0.0.","message":"Version 2.0.0 requires ESLint v8.57.1 or v9.0.0+. ESLint v7 is no longer supported.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Update to v2 and use flat config, or pin to v1.x if you cannot migrate.","message":"Version 1.x used legacy config format; migration to flat config is needed for v2.","severity":"deprecated","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Use `...preact` inside the exported array.","message":"The config is exported as an array; it must be spread into your config array. Using it directly as a single element will not apply rules correctly.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"See installation instructions.","message":"CommonJS users must destructure the `default` export: `const {default: preact} = require('eslint-config-preact')`.","severity":"gotcha","affected_versions":">=2.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 i -D eslint eslint-config-preact.","cause":"Package not installed or missing peer dependency eslint.","error":"Cannot find module 'eslint-config-preact'"},{"fix":"Use eslint.config.js (flat config) or downgrade to v1.x.","cause":"Using legacy .eslintrc with v2 which requires flat config.","error":"Failed to load config \"preact\" to extend from."},{"fix":"Use `...preact` inside the config array.","cause":"Array config imported without spread.","error":"Invalid config: \"preact\" is not a valid configuration object."},{"fix":"Use `const {default: preact} = require('eslint-config-preact')`.","cause":"Using CommonJS require without destructuring default.","error":"Module \"eslint-config-preact\" does not export a default export"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}