Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ export namespace ESLintClient {
}

if (detail !== undefined && languageStatus.detail !== detail) {
languageStatus.detail = detail;
languageStatus.detail = detail;
}
if (languageStatus.severity !== severity) {
languageStatus.severity = severity;
Expand Down
32 changes: 16 additions & 16 deletions server/src/eslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,20 @@ type ParserOptions = {
};

type ESLintRcConfig = {
env: Record<string, boolean>;
env: Record<string, boolean>;
extends: string | string[];
// globals: Record<string, GlobalConf>;
ignorePatterns: string | string[];
noInlineConfig: boolean;
// overrides: OverrideConfigData[];
parser: string | null;
parserOptions?: ParserOptions;
plugins: string[];
processor: string;
reportUnusedDisableDirectives: boolean | undefined;
root: boolean;
rules: Record<string, RuleConf>;
settings: object;
// globals: Record<string, GlobalConf>;
ignorePatterns: string | string[];
noInlineConfig: boolean;
// overrides: OverrideConfigData[];
parser: string | null;
parserOptions?: ParserOptions;
plugins: string[];
processor: string;
reportUnusedDisableDirectives: boolean | undefined;
root: boolean;
rules: Record<string, RuleConf>;
settings: object;
};
type ESLintConfig = ESLintRcConfig;

Expand Down Expand Up @@ -1167,7 +1167,7 @@ export namespace ESLint {
if (result.length === 0) {
return result;
}
return result[result.length - 1] === path.sep
return result.endsWith(path.sep)
? result.substring(0, result.length - 1)
: result;
}
Expand Down Expand Up @@ -1331,8 +1331,8 @@ export namespace ESLint {
if (typeof err.message === 'string' || err.message instanceof String) {
result = <string>err.message;
result = result.replace(/\r?\n/g, ' ');
if (/^CLI: /.test(result)) {
result = result.substr(5);
if (result.startsWith('CLI: ')) {
result = result.slice(5);
}
} else {
result = `An unknown error occurred while validating document: ${document.uri}`;
Expand Down
4 changes: 2 additions & 2 deletions server/src/eslintServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function inferFilePath(documentOrUri: string | TextDocument | URI | undefined):
const extension = LanguageDefaults.getExtension(textDocument.languageId);
if (extension !== undefined) {
const extname = path.extname(filePath);
if (extname.length === 0 && filePath[0] === '.') {
if (extname.length === 0 && filePath.startsWith('.')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this better than the array access?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dbaeumer
SonarQube, which I often use, says this, but do you prefer array access?

スクリーンショット 2025-08-17 午後10 59 10

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep the array access.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dbaeumer
I reverted it.

return `${filePath}.${extension}`;
} else if (extname.length > 0 && extname !== extension) {
return `${filePath.substring(0, filePath.length - extname.length)}.${extension}`;
Expand Down Expand Up @@ -802,7 +802,7 @@ async function computeAllFixes(identifier: VersionedTextDocumentIdentifier, mode
start: textDocument.positionAt(diff.originalStart),
end: textDocument.positionAt(diff.originalStart + diff.originalLength)
},
newText: fixedContent.substr(diff.modifiedStart, diff.modifiedLength)
newText: fixedContent.slice(diff.modifiedStart, diff.modifiedStart + diff.modifiedLength)
});
}
}
Expand Down