-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add ESLint configuration merge function, refactor related files…
…, support TypeScript, update dependencies
- Loading branch information
Showing
9 changed files
with
3,773 additions
and
7 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import fs from 'node:fs/promises' | ||
import { mergeFlatConfigs } from '../src' | ||
import { builtinRules } from 'eslint/use-at-your-own-risk' | ||
import { flatConfigsToRulesDTS } from 'eslint-typegen/core' | ||
|
||
const configs = await mergeFlatConfigs( | ||
{ | ||
plugins: { | ||
'': { | ||
rules: Object.fromEntries(builtinRules.entries()) | ||
} | ||
} | ||
} | ||
) | ||
|
||
const configNames = configs.map(i => i.name).filter(Boolean) as string[] | ||
|
||
let dts = await flatConfigsToRulesDTS (configs, { | ||
includeAugmentation: false, | ||
}) | ||
|
||
dts += ` | ||
// Names of all the configs | ||
export type ConfigNames = ${configNames.map(i => `'${i}'`).join(' | ')} | ||
` | ||
|
||
await fs.writeFile('src/eslintype.d.ts', dts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.