Skip to content

Commit

Permalink
docs: add additional installation information in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderl19 committed Jan 1, 2024
1 parent dc46b67 commit 2b69c13
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<!-- begin auto-generated rules list -->

💼 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. || 🔧 |

<!-- end auto-generated rules list -->

## 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
Expand All @@ -43,18 +59,14 @@ Then configure the rules you want to use under the rules section.
}
```

## Rules

<!-- begin auto-generated rules list -->

💼 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`.

<!-- end auto-generated rules list -->
```json
{
"extends": [
"eslint:recommended",
// Currently errors for all missing helper functions.
"plugin:sanity-studio/recommended"
]
}
```

0 comments on commit 2b69c13

Please sign in to comment.