Socket
Socket
Sign inDemoInstall

eslint-config-sanity

Package Overview
Dependencies
243
Maintainers
46
Versions
260
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eslint-config-sanity

Shared eslint configs for sanity-io


Version published
Weekly downloads
9.5K
increased by4.66%
Maintainers
46
Install size
56.2 kB
Created
Weekly downloads
 

Changelog

Source

7.1.2 (2024-03-18)

Bug Fixes

  • remove react/prop-types rule (89b18d4)

Readme

Source

eslint-config-sanity

Shared eslint rules for official Sanity.io projects

Installing

npm install --save-dev eslint-config-sanity

Usage

Create an .eslintrc in the root of your project (or an eslintConfig entry in package.json) and extend the sanity config:

{
  "env": {"node": true, "browser": true},
  "extends": ["sanity"]
}

Adjust env according to your use case, obviously.

Usage: React

ESLint requires plugins to be peer dependencies (they resolve relative to the end-user project), as such you need to install an additional dependency if you're using React:

npm install --save-dev eslint-plugin-react eslint-plugin-react-hooks

Then, make sure to extend sanity/react in your .eslintrc:

{
  "extends": ["sanity/react"]
}

Note: It's not necessary to extend both sanity and sanity/react - extending sanity/react will implicitly extend sanity first.

Note: If you're using TypeScript and React, make sure you extend sanity/react before sanity/typescript:

{
  "extends": ["sanity/react", "sanity/typescript"]
}

Usage: Typescript

ESLint requires plugins to be peer dependencies (they resolve relative to the end-user project), as such you need to install a few more dependencies if you're using typescript:

npm install --save-dev \
  typescript \
  @typescript-eslint/parser \
  @typescript-eslint/eslint-plugin

Then, make sure to extend sanity/typescript in your .eslintrc:

{
  "extends": ["sanity/typescript"]
}

Note: It's not necessary to extend both sanity and sanity/typescript - extending sanity/typescript will implicitly extend sanity first.

Note: If you're using TypeScript and React, make sure you extend sanity/react before sanity/typescript:

{
  "extends": ["sanity/react", "sanity/typescript"]
}

License

MIT © Sanity.io

Keywords

FAQs

Last updated on 18 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc