{"id":19554,"library":"eslint-config-openlayers","title":"eslint-config-openlayers","description":"Shareable ESLint configuration enforcing OpenLayers coding style. v21.0.0 (stable), updated regularly with dependency bumps. Supports ESLint flat config (eslint.config.js). Differentiator: opinionated set of rules for OpenLayers projects, includes JSdoc and Prettier integration. Requires ESLint as peer dependency.","status":"active","version":"21.0.0","language":"javascript","source_language":"en","source_url":"git://github.com/openlayers/eslint-config-openlayers","tags":["javascript"],"install":[{"cmd":"npm install eslint-config-openlayers","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-config-openlayers","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-config-openlayers","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required as the linter engine","package":"eslint","optional":false}],"imports":[{"note":"ESM-only; CommonJS require() fails. Use `createRequire` if needed.","wrong":"const openlayers = require('eslint-config-openlayers');","symbol":"default","correct":"import openlayers from 'eslint-config-openlayers';"},{"note":"Default import returns an array of flat config objects.","wrong":"import openlayers from 'eslint-config-openlayers'; // correct","symbol":"openlayers","correct":"import openlayers from 'eslint-config-openlayers';"},{"note":"Flat config must be spread; no direct `module.exports`.","wrong":"module.exports = require('eslint-config-openlayers');","symbol":"FlatConfig","correct":"import openlayers from 'eslint-config-openlayers'; export default [...openlayers];"}],"quickstart":{"code":"// eslint.config.js\nimport openlayers from 'eslint-config-openlayers';\n\nexport default [\n  ...openlayers,\n  {\n    rules: {\n      // Custom overrides\n      'no-console': 'warn',\n    },\n  },\n];","lang":"javascript","description":"Creates an ESLint flat config extending OpenLayers config with overrides."},"warnings":[{"fix":"Use eslint.config.js with export default [...openlayers];","message":"Flat config syntax required as of v18.0.0; .eslintrc files no longer supported","severity":"breaking","affected_versions":">=18.0.0"},{"fix":"Refactor code to avoid else-if after return, e.g. remove else block.","message":"No else-if return rule added in v18.0.0 may cause new lint errors","severity":"breaking","affected_versions":">=18.0.0"},{"fix":"Upgrade ESLint to 9.x and use flat config.","message":"ESLint 8 support ends; v18+ uses ESLint 9 flat config only","severity":"deprecated","affected_versions":">=18.0.0"},{"fix":"Add 'eslint-config-prettier' and 'eslint-plugin-prettier' as devDependencies.","message":"Prettier integration requires eslint-config-prettier and eslint-plugin-prettier to be installed","severity":"gotcha","affected_versions":"all"},{"fix":"Use `Object` instead of `object` in TypeScript types or JSDoc.","message":"Prefer Object to object rule added in v16.2.2 may cause errors","severity":"breaking","affected_versions":">=16.2.2"},{"fix":"Set 'eslint.useFlatConfig': true in VSCode settings.","message":"VSCode users must enable flat config in settings","severity":"gotcha","affected_versions":">=18.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use import syntax in your eslint.config.js or convert to ES module.","cause":"Using CommonJS require() on an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/eslint-config-openlayers/index.js not supported."},{"fix":"Create eslint.config.js and use import openlayers from 'eslint-config-openlayers'; export default [...openlayers];","cause":"Using .eslintrc file with extends; flat config required since v18.","error":"Error: Failed to load config 'openlayers' to extend from."},{"fix":"Remove you can use the built-in 'no-else-return' rule configuration or otherwise adjust.","cause":"Rule 'no-else-return' uses allowElseIf option not present in ESLint config.","error":"Error: Configuration for rule 'no-else-return' is invalid: value 'error' is not allowed."},{"fix":"Ensure eslint-config-openlayers is correctly imported; if using custom parser, set ecmaVersion: 2022.","cause":"ESLint is not configured for ES6+ syntax; config may not include ecmaVersion.","error":"Parsing error: The keyword 'const' is reserved."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}