Skip to content

Commit 0d2e74a

Browse files
markieo1Marco Havermans
andauthored
fix: add absolute path for reading file contents, fix rootDir issue (#108)
* Add absolute option for finding files * Only use absolutePath to read file contents --------- Co-authored-by: Marco Havermans <marco.havermans@easyflex.nl>
1 parent ffbd03b commit 0d2e74a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import vueParser from 'vue-eslint-parser'
66
import pluginVue from 'eslint-plugin-vue'
77

88
import fg from 'fast-glob'
9+
import path from 'node:path'
910

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy