Skip to content

Commit

Permalink
feat!: move the optional sort-keys plugin to perfectionist
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Feb 19, 2024
1 parent a2ec44f commit c19559f
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 20 deletions.
6 changes: 3 additions & 3 deletions eslint.config.js
@@ -1,17 +1,17 @@
import { createRequire } from 'node:module'
// import { sxzz } from './dist/index.js'

const require = createRequire(import.meta.url)
require('sucrase/register')
/** @type {typeof import('./src/index.ts')} */
const { sxzz } = require('./src/index.ts')

// import { sxzz } from './dist/index.js'

export default sxzz(
[
{
files: ['src/**/*.ts'],
rules: {
'sort-keys/sort-keys-fix': 'error',
'perfectionist/sort-objects': 'error',
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -47,8 +47,8 @@
"eslint-plugin-jsonc": "^2.13.0",
"eslint-plugin-markdown": "^3.0.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-perfectionist": "^2.5.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-sort-keys": "^2.3.5",
"eslint-plugin-unicorn": "^51.0.1",
"eslint-plugin-unused-imports": "^3.1.0",
"eslint-plugin-vue": "^9.21.1",
Expand Down
44 changes: 35 additions & 9 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion src/configs/index.ts
Expand Up @@ -5,8 +5,8 @@ export * from './javascript'
export * from './jsonc'
export * from './markdown'
export * from './node'
export * from './perfectionist'
export * from './prettier'
export * from './sort-keys'
export * from './sort'
export * from './typescript'
export * from './unicorn'
Expand Down
4 changes: 2 additions & 2 deletions src/configs/sort-keys.ts → src/configs/perfectionist.ts
@@ -1,10 +1,10 @@
import { pluginSortKeys } from '../plugins'
import { pluginPerfectionist } from '../plugins'
import type { FlatESLintConfigItem } from 'eslint-define-config'

export const sortKeys: FlatESLintConfigItem[] = [
{
plugins: {
'sort-keys': pluginSortKeys,
perfectionist: pluginPerfectionist,
},
},
]
8 changes: 6 additions & 2 deletions src/plugins.ts
Expand Up @@ -27,6 +27,12 @@ export const pluginUnicorn = interopDefault(_pluginUnicorn)
import * as _pluginVue from 'eslint-plugin-vue'
export const pluginVue = interopDefault(_pluginVue)

import * as _pluginNode from 'eslint-plugin-n'
export const pluginNode = interopDefault(_pluginNode)

import * as _pluginPerfectionist from 'eslint-plugin-perfectionist'
export const pluginPerfectionist = interopDefault(_pluginPerfectionist)

import * as _pluginUnocss from '@unocss/eslint-plugin'
export const pluginUnocss: typeof import('@unocss/eslint-plugin').default =
interopDefault(_pluginUnocss)
Expand All @@ -41,8 +47,6 @@ export * as pluginImport from 'eslint-plugin-i'
export * as pluginJsonc from 'eslint-plugin-jsonc'
export * as pluginUnusedImports from 'eslint-plugin-unused-imports'
export * as pluginYml from 'eslint-plugin-yml'
export * as pluginSortKeys from 'eslint-plugin-sort-keys'
export * as pluginNode from 'eslint-plugin-n'

export * as parserVue from 'vue-eslint-parser'
export * as parserYml from 'yaml-eslint-parser'
Expand Down
4 changes: 2 additions & 2 deletions src/presets.ts
Expand Up @@ -60,10 +60,10 @@ export { presetBasic as basic, presetAll as all }
export function sxzz(
config: FlatESLintConfigItem | FlatESLintConfigItem[] = [],
{
vue: enableVue = hasVue,
prettier: enablePrettier = true,
markdown: enableMarkdown = true,
prettier: enablePrettier = true,
unocss: enableUnocss = hasUnocss,
vue: enableVue = hasVue,
}: Partial<{
/** Vue support. Auto-enable. */
vue: boolean
Expand Down

0 comments on commit c19559f

Please sign in to comment.