Skip to content

Commit b195ca9

Browse files
committed
feat: support more fields of packageJson as ascending order
1 parent 6eb114e commit b195ca9

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/configs/sort.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,22 @@ export async function sortPackageJson(): Promise<FlatConfigItem[]> {
8181
order: ['types', 'import', 'require', 'default'],
8282
pathPattern: '^exports.*$',
8383
},
84+
{
85+
order: [
86+
// client hooks only
87+
'pre-commit',
88+
'prepare-commit-msg',
89+
'commit-msg',
90+
'post-commit',
91+
'pre-rebase',
92+
'post-rewrite',
93+
'post-checkout',
94+
'post-merge',
95+
'pre-push',
96+
'pre-auto-gc',
97+
],
98+
pathPattern: '^(?:gitHooks|husky|simple-git-hooks)$',
99+
},
84100
],
85101
},
86102
},

src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ const flatConfigProps: (keyof FlatConfigItem)[] = [
5757

5858
/**
5959
* Construct an array of ESLint flat config items.
60+
*
61+
* @param {OptionsConfig & FlatConfigItem} options
62+
* The options for generating the ESLint configurations.
63+
* @param {Awaitable<UserConfigItem | UserConfigItem[]>[]} userConfigs
64+
* The user configurations to be merged with the generated configurations.
65+
* @returns {Promise<UserConfigItem[]>}
66+
* The merged ESLint configurations.
6067
*/
6168
export async function defineConfig(
6269
options: OptionsConfig & FlatConfigItem = {},

0 commit comments

Comments
 (0)