Skip to content

Commit

Permalink
fix(eslint): update perfectionist rules
Browse files Browse the repository at this point in the history
  • Loading branch information
thecuvii committed Jul 23, 2024
1 parent c1bb0e2 commit b8815cc
Show file tree
Hide file tree
Showing 5 changed files with 253 additions and 256 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"bumpp": "^9.4.1",
"eslint": "^9.7.0",
"prettier": "^3.3.3",
"typescript": "^5.5.3"
"typescript": "^5.5.4"
}
}
40 changes: 28 additions & 12 deletions packages/eslint/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import antfu from '@antfu/eslint-config'
import { FlatCompat } from '@eslint/eslintrc'
// @ts-expect-error no types
import nextPlugin from '@next/eslint-plugin-next'
import stylistic from '@stylistic/eslint-plugin'
import stylisticJsx from '@stylistic/eslint-plugin-jsx'
import queryPlugin from '@tanstack/eslint-plugin-query'

// @ts-expect-error no types
Expand Down Expand Up @@ -46,16 +44,16 @@ export const factory = ({ next, prettier, reactQuery, tailwind }: EslintConfigOp
const customGroups = {
as: ['as'],
children: ['children'],
variant: ['variant', 'type', 'mode'],
className: ['class', 'className', '*className', 'style'],
'framer-motion': ['initial', 'animate', 'exit', 'whileHover', 'whileTap', 'transition'],
label: ['label', 'name'],
icon: ['icon'],
value: ['value'],
'framer-motion': ['initial', 'animate', 'exit', 'whileHover', 'whileTap', 'transition'],
jsx: ['key', 'ref', 'id'],
label: ['label', 'name'],
links: ['link', 'href', 'to', 'src', 'url'],
meta: ['name', 'property', 'content'],
svg: ['d', 'width', 'height', 'viewBox', 'fill', 'stroke'],
value: ['value'],
variant: ['variant', 'type', 'mode'],
}

const groups = [
Expand All @@ -80,29 +78,47 @@ export const factory = ({ next, prettier, reactQuery, tailwind }: EslintConfigOp
base.append({
rules: {
'perfectionist/sort-array-includes': ['error', { type: 'natural' }],
'perfectionist/sort-enums': ['error', { type: 'natural' }],
'perfectionist/sort-enums': ['error', { type: 'natural', 'partition-by-comment': true }],
'perfectionist/sort-exports': ['error', { type: 'natural' }],
'perfectionist/sort-interfaces': [
'error',
{
type: 'natural',
'custom-groups': customGroups,
groups,
'optionality-order': 'required-first',
type: 'natural',
'partition-by-new-line': true,
},
],
'perfectionist/sort-jsx-props': [
'error',
{
type: 'natural',
'custom-groups': customGroups,
groups,
},
],
'perfectionist/sort-named-exports': ['error', { type: 'natural', 'group-kind': 'types-first' }],
'perfectionist/sort-object-types': [
'error',
{
type: 'natural',
'custom-groups': customGroups,
groups,
'partition-by-new-line': true,
},
],
'perfectionist/sort-objects': [
'error',
{
type: 'natural',
'custom-groups': customGroups,
groups,
'partition-by-comment': true,
'partition-by-new-line': true,
},
],
'perfectionist/sort-named-exports': ['error', { 'group-kind': 'types-first', type: 'natural' }],
'perfectionist/sort-object-types': ['error', { 'custom-groups': customGroups, groups, type: 'natural' }],
'perfectionist/sort-objects': ['error', { 'custom-groups': customGroups, groups, type: 'natural' }],
'perfectionist/sort-union-types': ['error', { 'nullable-last': true, type: 'natural' }],
'perfectionist/sort-union-types': ['error', { type: 'natural', 'nullable-last': true }],
},
})

Expand Down
6 changes: 3 additions & 3 deletions packages/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"eslint-plugin-svg-jsx": "^1.2.4"
},
"dependencies": {
"@antfu/eslint-config": "^2.23.1",
"@antfu/eslint-config": "^2.23.2",
"@eslint/eslintrc": "^3.1.0",
"@next/eslint-plugin-next": "^14.2.5",
"@tanstack/eslint-plugin-query": "^5.51.12",
Expand All @@ -34,7 +34,7 @@
"eslint-plugin-tailwindcss": "^3.17.4"
},
"devDependencies": {
"@types/eslint__eslintrc": "^2.1.1",
"tsup": "^8.2.1"
"@types/eslint__eslintrc": "^2.1.2",
"tsup": "^8.2.2"
}
}
2 changes: 1 addition & 1 deletion packages/prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"prettier-plugin-tailwindcss": "^0.5.14"
},
"devDependencies": {
"tsup": "^8.2.1"
"tsup": "^8.2.2"
}
}
Loading

0 comments on commit b8815cc

Please sign in to comment.