Skip to content

Windows compat #528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions src/eslint-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from "path";
import ts from "typescript";
import { SourceCode, Linter, ESLint } from "eslint";
import { parseForESLint, type ParserOptions } from "@typescript-eslint/parser";
Expand Down Expand Up @@ -134,7 +135,7 @@ export class ESLintAdapter {
if (this.ignoredFilepathMap.get(fileName) === true) return [];
const configArray = this.configProvider.getConfigArrayForFile(fileName);
const configFileContent = configArray.extractConfig(fileName).toCompatibleObjectAsConfigFileContent();
if (!isParserModuleNameValid(configFileContent.parser, "@typescript-eslint/parser")) {
if (!isParserModuleNameValid(configFileContent.parser, path.join("@typescript-eslint", "parser"))) {
throw new InvalidParserError();
}
const parserOptions = (configFileContent.parserOptions ? configFileContent.parserOptions : {}) as ParserOptions;
Expand All @@ -145,7 +146,7 @@ export class ESLintAdapter {
}

public checkFileToBeIgnored(fileName: string) {
if (fileName.indexOf("node_modules/") !== -1) return;
if (fileName.indexOf("node_modules" + path.sep) !== -1) return;
if (!fileName.endsWith(".ts") && !fileName.endsWith(".tsx")) return;
Promise.resolve()
.then(() => new ESLint())
Expand Down
4 changes: 2 additions & 2 deletions src/eslint-config-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export class ESLintConfigProvider implements ConfigProvider {
} catch {
try {
// For legacy ESLint < v8.35
const fragments = require.resolve("eslint").split("node_modules/eslint");
return [...fragments.slice(0, fragments.length - 1), `/conf/${name}.js`].join("node_modules/eslint");
const fragments = require.resolve("eslint").split(path.join("node_modules", "eslint"));
return path.join(...fragments.slice(0, fragments.length - 1), "node_modules", "eslint", "conf", `${name}.js`);
} catch (e) {
this.log(String(e));
}
Expand Down