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
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import vueParser from 'vue-eslint-parser'
import pluginVue from 'eslint-plugin-vue'

import fg from 'fast-glob'
import path from 'node:path'

type ExtendableConfigName = keyof typeof tseslint.configs
type ScriptLang = 'ts' | 'tsx' | 'js' | 'jsx'
Expand Down Expand Up @@ -33,7 +34,8 @@ export default function createConfig({
})
.reduce(
(acc, file) => {
const contents = fs.readFileSync(file, 'utf8')
const absolutePath = path.resolve(rootDir, file)
const contents = fs.readFileSync(absolutePath, 'utf8')
// contents matches the <script lang="ts"> (there can be anything but `>` between `script` and `lang`)
if (/<script[^>]*\blang\s*=\s*"ts"[^>]*>/i.test(contents)) {
acc.vueFilesWithScriptTs.push(file)
Expand Down