Registry / devops / eslint-config-sanity

eslint-config-sanity

JSON →
library7.1.4jsnpmunverified

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.

npm install eslint-config-sanity
INSTALL
IMPORT
SIG · ESLINT-CONFIG-SANI
E
eslint-config-sanity
devopsjavascriptv7.1.4
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

eslint-config-sanity
✓ extends: ['sanity']
✗ extends: ['eslint-config-sanity']
In ESLint config files, use the shorthand 'sanity' (without 'eslint-config-'). This is the base config.
eslint-config-sanity/react
✓ extends: ['sanity/react']
✗ extends: ['sanity', 'sanity/react']
sanity/react already extends sanity; no need to extend both. For TypeScript+React, extend sanity/react then sanity/typescript.
eslint-config-sanity/typescript
✓ extends: ['sanity/typescript']
✗ extends: ['sanity', 'sanity/typescript']
sanity/typescript already extends sanity. For React+TypeScript, order matters: sanity/react then sanity/typescript.

Shows minimal setup: create .eslintrc.json extending 'sanity', and install required peer dependencies.

// .eslintrc.json { "env": { "browser": true, "es2021": true }, "extends": ["sanity"] } // package.json { "devDependencies": { "eslint": "^9.0.0", "eslint-config-sanity": "^7.1.4", "eslint-plugin-import": "^2.28.1" } }
Debug
Known issues
breakingVersion 7.0.0 changed base config to extend ESLint recommended defaults, which may enable new rules. Review your codebase for potential lint errors.
fix
Run 'eslint --fix' and adjust any new violations. If you relied on previous lenient rules, consider overriding rules in your config.
affects: >=7.0.0
gotchaOrder of extends matters: for React+TypeScript, must extend 'sanity/react' before 'sanity/typescript'.
fix
Set 'extends' as ['sanity/react', 'sanity/typescript'].
affects: >=7.0.0
gotchaMissing 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.
fix
Install the required peer deps per the README.
affects: >=7.0.0
deprecatedRules 'react/prop-types' were removed in v7.1.2. Overrides for that rule will be ignored.
fix
Remove any overrides for 'react/prop-types' from your ESLint config.
affects: >=7.1.2
breakingSupport for @typescript-eslint v6 and v7 added, but not v5. Ensure your project uses v6 or newer.
fix
Update @typescript-eslint/parser and @typescript-eslint/eslint-plugin to v6, v7, or v8.
affects: >=7.0.2
gotchaDo not use literal package name in 'extends'. Use 'sanity', 'sanity/react', 'sanity/typescript'.
fix
Use 'sanity' instead of 'eslint-config-sanity'.
affects: >=7.0.0
breakingVersion 8 of eslint-config-sanity is not yet released; do not install future v8.x expecting compatibility with v7 API.
fix
Continue using v7 until official v8 migration guide is published.
affects: >=8.0.0-alpha
Errors
Common errors & fixes
Error: Cannot find module 'eslint-plugin-import'
Missing required peer dependency eslint-plugin-import.
fix
Run: npm install --save-dev eslint-plugin-import
Error: Cannot read config file: .../eslintrc.json Error: Unexpected key 'sanity-extends'
Using incorrect extends name (e.g., 'sanity-extends' instead of 'sanity').
fix
Use 'extends': ['sanity'] (for base) or 'extends': ['sanity/react'], etc.
Parsing error: Cannot read file 'tsconfig.json'
Missing tsconfig.json when using @typescript-eslint parser.
fix
Create a tsconfig.json in project root or set parserOptions.project to null if not using type-aware rules.
ESLint: TypeError: this.getScope is not a function
Incompatible version of @typescript-eslint/parser (e.g., v5 with eslint-config-sanity v7).
fix
Update @typescript-eslint/parser to v6 or later: npm install --save-dev @typescript-eslint/parser@^6.0.0
Upgrade
Version history
7.1.4latest on npm
Audit
Dependencies
eslintrequiredPeer dependency; required to run ESLint.
eslint-plugin-reactoptionalPeer dependency for React config (sanity/react).
eslint-plugin-react-hooksoptionalPeer dependency for React hooks support (sanity/react).
eslint-plugin-importrequiredPeer dependency; used by base config for import sorting.
@typescript-eslint/parseroptionalPeer dependency for TypeScript config (sanity/typescript).
@typescript-eslint/eslint-pluginoptionalPeer dependency for TypeScript config (sanity/typescript).
Agent activity
2 hits · last 30 days
node
2
Resources