{"id":19574,"library":"eslint-config-sanity","title":"eslint-config-sanity","description":"Shared ESLint configuration for Sanity.io projects. Version 7.1.4 is the current stable release, actively maintained. Provides base, React, and TypeScript config presets that extend recommended defaults. Differentiators: minimal ruleset optimized for Sanity's codebase, automatic handling of React props and TypeScript integration, and support for ESLint 8 and 9. Updated regularly to align with latest ESLint and TypeScript-ESLint versions. Ideal for Sanity plugin development or any project using Sanity's style conventions.","status":"active","version":"7.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/sanity-io/eslint-config-sanity","tags":["javascript","sanity","cms","headless","realtime","content","eslint-config-sanity","eslint","eslintconfig"],"install":[{"cmd":"npm install eslint-config-sanity","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-config-sanity","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-config-sanity","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; required to run ESLint.","package":"eslint","optional":false},{"reason":"Peer dependency for React config (sanity/react).","package":"eslint-plugin-react","optional":true},{"reason":"Peer dependency for React hooks support (sanity/react).","package":"eslint-plugin-react-hooks","optional":true},{"reason":"Peer dependency; used by base config for import sorting.","package":"eslint-plugin-import","optional":false},{"reason":"Peer dependency for TypeScript config (sanity/typescript).","package":"@typescript-eslint/parser","optional":true},{"reason":"Peer dependency for TypeScript config (sanity/typescript).","package":"@typescript-eslint/eslint-plugin","optional":true}],"imports":[{"note":"In ESLint config files, use the shorthand 'sanity' (without 'eslint-config-'). This is the base config.","wrong":"extends: ['eslint-config-sanity']","symbol":"eslint-config-sanity","correct":"extends: ['sanity']"},{"note":"sanity/react already extends sanity; no need to extend both. For TypeScript+React, extend sanity/react then sanity/typescript.","wrong":"extends: ['sanity', 'sanity/react']","symbol":"eslint-config-sanity/react","correct":"extends: ['sanity/react']"},{"note":"sanity/typescript already extends sanity. For React+TypeScript, order matters: sanity/react then sanity/typescript.","wrong":"extends: ['sanity', 'sanity/typescript']","symbol":"eslint-config-sanity/typescript","correct":"extends: ['sanity/typescript']"}],"quickstart":{"code":"// .eslintrc.json\n{\n  \"env\": { \"browser\": true, \"es2021\": true },\n  \"extends\": [\"sanity\"]\n}\n\n// package.json\n{\n  \"devDependencies\": {\n    \"eslint\": \"^9.0.0\",\n    \"eslint-config-sanity\": \"^7.1.4\",\n    \"eslint-plugin-import\": \"^2.28.1\"\n  }\n}","lang":"javascript","description":"Shows minimal setup: create .eslintrc.json extending 'sanity', and install required peer dependencies."},"warnings":[{"fix":"Run 'eslint --fix' and adjust any new violations. If you relied on previous lenient rules, consider overriding rules in your config.","message":"Version 7.0.0 changed base config to extend ESLint recommended defaults, which may enable new rules. Review your codebase for potential lint errors.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Set 'extends' as ['sanity/react', 'sanity/typescript'].","message":"Order of extends matters: for React+TypeScript, must extend 'sanity/react' before 'sanity/typescript'.","severity":"gotcha","affected_versions":">=7.0.0"},{"fix":"Install the required peer deps per the README.","message":"Missing peer dependencies will cause ESLint to fail. For TypeScript, need @typescript-eslint/parser and @typescript-eslint/eslint-plugin. For React, need eslint-plugin-react and eslint-plugin-react-hooks.","severity":"gotcha","affected_versions":">=7.0.0"},{"fix":"Remove any overrides for 'react/prop-types' from your ESLint config.","message":"Rules 'react/prop-types' were removed in v7.1.2. Overrides for that rule will be ignored.","severity":"deprecated","affected_versions":">=7.1.2"},{"fix":"Update @typescript-eslint/parser and @typescript-eslint/eslint-plugin to v6, v7, or v8.","message":"Support for @typescript-eslint v6 and v7 added, but not v5. Ensure your project uses v6 or newer.","severity":"breaking","affected_versions":">=7.0.2"},{"fix":"Use 'sanity' instead of 'eslint-config-sanity'.","message":"Do not use literal package name in 'extends'. Use 'sanity', 'sanity/react', 'sanity/typescript'.","severity":"gotcha","affected_versions":">=7.0.0"},{"fix":"Continue using v7 until official v8 migration guide is published.","message":"Version 8 of eslint-config-sanity is not yet released; do not install future v8.x expecting compatibility with v7 API.","severity":"breaking","affected_versions":">=8.0.0-alpha"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run: npm install --save-dev eslint-plugin-import","cause":"Missing required peer dependency eslint-plugin-import.","error":"Error: Cannot find module 'eslint-plugin-import'"},{"fix":"Use 'extends': ['sanity'] (for base) or 'extends': ['sanity/react'], etc.","cause":"Using incorrect extends name (e.g., 'sanity-extends' instead of 'sanity').","error":"Error: Cannot read config file: .../eslintrc.json Error: Unexpected key 'sanity-extends'"},{"fix":"Create a tsconfig.json in project root or set parserOptions.project to null if not using type-aware rules.","cause":"Missing tsconfig.json when using @typescript-eslint parser.","error":"Parsing error: Cannot read file 'tsconfig.json'"},{"fix":"Update @typescript-eslint/parser to v6 or later: npm install --save-dev @typescript-eslint/parser@^6.0.0","cause":"Incompatible version of @typescript-eslint/parser (e.g., v5 with eslint-config-sanity v7).","error":"ESLint: TypeError: this.getScope is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}