Skip to content

Commit

Permalink
Sanity Studio Eslint Rules (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderl19 committed Nov 3, 2023
1 parent 48fba6f commit 624e458
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 9 deletions.
8 changes: 7 additions & 1 deletion apps/sanity/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"extends": "@sanity/eslint-config-studio"
"extends": "@sanity/eslint-config-studio",
"plugins": ["sanity-studio"],
"rules": {
"sanity-studio/define-array-member-helper": "error",
"sanity-studio/define-field-helper": "error",
"sanity-studio/define-type-helper": "error"
}
}
4 changes: 3 additions & 1 deletion apps/sanity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"build": "sanity build",
"deploy": "sanity deploy",
"deploy-graphql": "sanity graphql deploy",
"lint": "eslint .",
"format:write": "prettier --write .",
"format:check": "prettier --check ."
},
Expand All @@ -32,7 +33,8 @@
"@types/react": "^18.0.25",
"@types/styled-components": "^5.1.26",
"eslint": "^8.6.0",
"eslint-plugin-sanity-studio": "^0.4.0",
"prettier": "^2.8.8",
"typescript": "^4.9.5"
}
}
}
4 changes: 2 additions & 2 deletions apps/sanity/schemas/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ export default defineType({
title: "Description",
type: "array",
of: [
{
defineArrayMember({
type: "block",
styles: [{ title: "Normal", value: "normal" }],
lists: [],
},
}),
],
validation: (Rule) => Rule.required(),
}),
Expand Down
4 changes: 2 additions & 2 deletions apps/sanity/schemas/faqs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export default defineType({
title: "Answer",
type: "array",
of: [
{
defineArrayMember({
type: "block",
styles: [{ title: "Normal", value: "normal" }],
lists: [],
},
}),
],
}),
],
Expand Down
6 changes: 3 additions & 3 deletions apps/sanity/schemas/resource.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineType, defineField } from "sanity";
import { defineType, defineField, defineArrayMember } from "sanity";
import { Globe } from "lucide-react";

export default defineType({
Expand Down Expand Up @@ -32,11 +32,11 @@ export default defineType({
title: "Description",
type: "array",
of: [
{
defineArrayMember({
type: "block",
styles: [{ title: "Normal", value: "normal" }],
lists: [],
},
}),
],
validation: (Rule) => Rule.required(),
}),
Expand Down
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 624e458

Please sign in to comment.