eslint-plugin-sanity-studio

1.0.0 • Public • Published

eslint-plugin-sanity-studio

npm GitHub Workflow Status (with event)

This plugin lints Sanity schemas to enforce helper functions.

Rules

💼 Configurations enabled in.
✅ Set in the recommended configuration.
🔧 Automatically fixable by the --fix CLI option.

Name                       Description 💼 🔧
define-array-member-helper Enforce "defineArrayMember" helper functions for Sanity schema arrays. 🔧
define-field-helper Enforce "defineField" helper functions for Sanity schema fields. 🔧
define-type-helper Enforce "defineType" helper functions for Sanity schemas. 🔧

Installation

You'll first need to install ESLint:

npm install eslint --save-dev
yarn add eslint --dev
pnpm add eslint --save-dev

Next, install eslint-plugin-sanity-studio:

npm install eslint-plugin-sanity-studio --save-dev
yarn add eslint-plugin-sanity-studio --dev
pnpm add eslint-plugin-sanity-studio --save-dev

Usage

Add sanity-studio to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["sanity-studio"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "sanity-studio/rule-name": "error"
  }
}

Alternatively, use the recommended configuration by extending plugin:sanity-studio/recommended.

{
  "extends": [
    "eslint:recommended",
    // Currently errors for all missing helper functions.
    "plugin:sanity-studio/recommended"
  ]
}

Package Sidebar

Install

npm i eslint-plugin-sanity-studio

Weekly Downloads

7

Version

1.0.0

License

MIT

Unpacked Size

25.3 kB

Total Files

19

Last publish

Collaborators

  • alexanderliu