Skip to content

Commit bf2d947

Browse files
authored
Merge pull request #528 from artola/master
Windows compat
2 parents ac64174 + 186c10c commit bf2d947

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/eslint-adapter.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from "path";
12
import ts from "typescript";
23
import { SourceCode, Linter, ESLint } from "eslint";
34
import { parseForESLint, type ParserOptions } from "@typescript-eslint/parser";
@@ -134,7 +135,7 @@ export class ESLintAdapter {
134135
if (this.ignoredFilepathMap.get(fileName) === true) return [];
135136
const configArray = this.configProvider.getConfigArrayForFile(fileName);
136137
const configFileContent = configArray.extractConfig(fileName).toCompatibleObjectAsConfigFileContent();
137-
if (!isParserModuleNameValid(configFileContent.parser, "@typescript-eslint/parser")) {
138+
if (!isParserModuleNameValid(configFileContent.parser, path.join("@typescript-eslint", "parser"))) {
138139
throw new InvalidParserError();
139140
}
140141
const parserOptions = (configFileContent.parserOptions ? configFileContent.parserOptions : {}) as ParserOptions;
@@ -145,7 +146,7 @@ export class ESLintAdapter {
145146
}
146147

147148
public checkFileToBeIgnored(fileName: string) {
148-
if (fileName.indexOf("node_modules/") !== -1) return;
149+
if (fileName.indexOf("node_modules" + path.sep) !== -1) return;
149150
if (!fileName.endsWith(".ts") && !fileName.endsWith(".tsx")) return;
150151
Promise.resolve()
151152
.then(() => new ESLint())

src/eslint-config-provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export class ESLintConfigProvider implements ConfigProvider {
7878
} catch {
7979
try {
8080
// For legacy ESLint < v8.35
81-
const fragments = require.resolve("eslint").split("node_modules/eslint");
82-
return [...fragments.slice(0, fragments.length - 1), `/conf/${name}.js`].join("node_modules/eslint");
81+
const fragments = require.resolve("eslint").split(path.join("node_modules", "eslint"));
82+
return path.join(...fragments.slice(0, fragments.length - 1), "node_modules", "eslint", "conf", `${name}.js`);
8383
} catch (e) {
8484
this.log(String(e));
8585
}

0 commit comments

Comments
 (0)