Skip to content

Commit

Permalink
chore(eslint-config): remove vitest hack
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusrbrown committed Nov 4, 2024
1 parent dbe88dc commit 597efc6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
32 changes: 9 additions & 23 deletions packages/eslint-config/scripts/generate-types.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
import fs from 'node:fs/promises'
import {builtinRules} from 'eslint/use-at-your-own-risk'
import {composer} from 'eslint-flat-config-utils'
import {flatConfigsToRulesDTS} from 'eslint-typegen/core'
import type vitest from '@vitest/eslint-plugin'
import {defineConfig} from '../src/define-config'

const configs = await composer(
defineConfig({
plugins: {
'': {
rules: Object.fromEntries(builtinRules),
},
const configs = await defineConfig({
plugins: {
'': {
rules: Object.fromEntries(builtinRules),
},
typescript: {
tsconfigPath: 'tsconfig.json',
},
vitest: true,
}),
// TODO: The `vitest/valid-title` rule breaks the generated types if saved as a .ts instead of a .d.ts file.
).override('@bfra.me/vitest/plugin', config => {
const {
plugins: {vitest: vitestPlugin},
} = config as {plugins: {vitest: typeof vitest}}
if (vitestPlugin.rules && 'valid-title' in vitestPlugin.rules) {
// HACK: Remove the rule before passing the config to the type generator.
delete (vitestPlugin.rules as {[key: string]: unknown})['valid-title']
}
return config
},
typescript: {
tsconfigPath: 'tsconfig.json',
},
vitest: true,
})

const rulesTypeName = 'Rules'
Expand Down
14 changes: 14 additions & 0 deletions packages/eslint-config/src/rules.d.ts

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

0 comments on commit 597efc6

Please sign in to comment.