From 2b69c139051fb07b6864bd5680aaadb92b34e64d Mon Sep 17 00:00:00 2001 From: Alexander Liu Date: Mon, 1 Jan 2024 15:12:13 -0800 Subject: [PATCH] docs: add additional installation information in readme --- README.md | 52 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index e660d8b..f740cc2 100644 --- a/README.md +++ b/README.md @@ -3,24 +3,40 @@ [![npm](https://img.shields.io/npm/v/eslint-plugin-sanity-studio?logo=npm&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Feslint-plugin-sanity-studio)](https://www.npmjs.com/package/eslint-plugin-sanity-studio) [![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/alexanderl19/eslint-plugin-sanity-studio/publish.yml?logo=githubactions&label=publish)](https://github.com/alexanderl19/eslint-plugin-sanity-studio/actions/workflows/publish.yml) -> **Warning** -> -> This is my first attempt at creating an eslint plugin. -> Dispite my best efforts, it may not adhere to all best practices. -> Please keep this in mind before incorporating into your projects. +This plugin lints [Sanity schemas](https://www.sanity.io/docs/schema-types) to enforce [helper functions](https://www.sanity.io/docs/schema-field-types#e5642a3e8506). + +## Rules + + + +💼 Configurations enabled in.\ +✅ Set in the `recommended` configuration.\ +🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix). + +| Name                       | Description | 💼 | 🔧 | +| :--------------------------------------------------------------------- | :--------------------------------------------------------------------- | :-- | :-- | +| [define-array-member-helper](docs/rules/define-array-member-helper.md) | Enforce "defineArrayMember" helper functions for Sanity schema arrays. | ✅ | 🔧 | +| [define-field-helper](docs/rules/define-field-helper.md) | Enforce "defineField" helper functions for Sanity schema fields. | ✅ | 🔧 | +| [define-type-helper](docs/rules/define-type-helper.md) | Enforce "defineType" helper functions for Sanity schemas. | ✅ | 🔧 | + + ## Installation You'll first need to install [ESLint](https://eslint.org/): ```sh -npm i eslint --save-dev +npm install eslint --save-dev +yarn add eslint --dev +pnpm add eslint --save-dev ``` Next, install `eslint-plugin-sanity-studio`: ```sh npm install eslint-plugin-sanity-studio --save-dev +yarn add eslint-plugin-sanity-studio --dev +pnpm add eslint-plugin-sanity-studio --save-dev ``` ## Usage @@ -43,18 +59,14 @@ Then configure the rules you want to use under the rules section. } ``` -## Rules - - - -💼 Configurations enabled in.\ -✅ Set in the `recommended` configuration.\ -🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix). - -| Name                       | Description | 💼 | 🔧 | -| :--------------------------------------------------------------------- | :--------------------------------------------------------------------- | :- | :- | -| [define-array-member-helper](docs/rules/define-array-member-helper.md) | Enforce "defineArrayMember" helper functions for Sanity schema arrays. | ✅ | 🔧 | -| [define-field-helper](docs/rules/define-field-helper.md) | Enforce "defineField" helper functions for Sanity schema fields. | ✅ | 🔧 | -| [define-type-helper](docs/rules/define-type-helper.md) | Enforce "defineType" helper functions for Sanity schemas. | ✅ | 🔧 | +Alternatively, use the recommended configuration by extending `plugin:sanity-studio/recommended`. - +```json +{ + "extends": [ + "eslint:recommended", + // Currently errors for all missing helper functions. + "plugin:sanity-studio/recommended" + ] +} +```