Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ import {
const ERROR = 'error'
const WARN = 'warn'

const has = pkg =>
import(pkg).then(
() => true,
() => false,
)
const has = pkg => {
try {
import.meta.resolve(pkg, import.meta.url)
return true
} catch {
return false
}
}

const hasTypeScript = await has('typescript')
const hasReact = await has('react')
const hasTestingLibrary = await has('@testing-library/dom')
const hasJestDom = await has('@testing-library/jest-dom')
const hasVitest = await has('vitest')
const hasTypeScript = has('typescript')
const hasReact = has('react')
const hasTestingLibrary = has('@testing-library/dom')
const hasJestDom = has('@testing-library/jest-dom')
const hasVitest = has('vitest')
const vitestFiles = ['**/__tests__/**/*', '**/*.test.*']
const testFiles = ['**/tests/**', '**/#tests/**', ...vitestFiles]
const playwrightFiles = ['**/e2e/**']
Expand Down