Skip to content

Commit d2d98f8

Browse files
authored
enable lint rule for indentation (#2229)
1 parent 33ffa5d commit d2d98f8

File tree

14 files changed

+70
-117
lines changed

14 files changed

+70
-117
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = {
2727
"format": ["PascalCase"]
2828
}
2929
],
30-
//"@typescript-eslint/indent": "error",
30+
"@typescript-eslint/indent": "error",
3131
"@typescript-eslint/member-delimiter-style": [
3232
"error",
3333
{

src/cmake-tools.ts

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -482,15 +482,7 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
482482
await drv.asyncDispose();
483483
}
484484
}
485-
for (const disp of [this._statusMessage,
486-
this._targetName,
487-
this._activeVariant,
488-
this._ctestEnabled,
489-
this._testResults,
490-
this._isBusy,
491-
this._variantManager,
492-
this._ctestController
493-
]) {
485+
for (const disp of [this._statusMessage, this._targetName, this._activeVariant, this._ctestEnabled, this._testResults, this._isBusy, this._variantManager, this._ctestController]) {
494486
disp.dispose();
495487
}
496488
}
@@ -1003,8 +995,8 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
1003995
this._cmakeDriver = Promise.resolve(null);
1004996
if (e instanceof BadHomeDirectoryError) {
1005997
void vscode.window
1006-
.showErrorMessage(localize('source.directory.does.not.match',
1007-
'The source directory "{0}" does not match the source directory in the CMake cache: {1}. You will need to run a clean-configure to configure this project.', e.expecting, e.cached),
998+
.showErrorMessage(
999+
localize('source.directory.does.not.match', 'The source directory "{0}" does not match the source directory in the CMake cache: {1}. You will need to run a clean-configure to configure this project.', e.expecting, e.cached),
10081000
{},
10091001
{ title: localize('clean.configure.title', 'Clean Configure') }
10101002
)
@@ -1280,16 +1272,16 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
12801272
if (!save_good) {
12811273
log.debug(localize('saving.open.files.failed', 'Saving open files failed'));
12821274
const yesButtonTitle: string = localize('yes.button', 'Yes');
1283-
const chosen = await vscode.window.showErrorMessage<
1284-
vscode.MessageItem>(localize('not.saved.continue.anyway', 'Not all open documents were saved. Would you like to continue anyway?'),
1285-
{
1286-
title: yesButtonTitle,
1287-
isCloseAffordance: false
1288-
},
1289-
{
1290-
title: localize('no.button', 'No'),
1291-
isCloseAffordance: true
1292-
});
1275+
const chosen = await vscode.window.showErrorMessage<vscode.MessageItem>(
1276+
localize('not.saved.continue.anyway', 'Not all open documents were saved. Would you like to continue anyway?'),
1277+
{
1278+
title: yesButtonTitle,
1279+
isCloseAffordance: false
1280+
},
1281+
{
1282+
title: localize('no.button', 'No'),
1283+
isCloseAffordance: true
1284+
});
12931285
return chosen !== undefined && (chosen.title === yesButtonTitle);
12941286
}
12951287
}

src/cpptools.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ const localize: nls.LocalizeFunc = nls.loadMessageBundle();
2222
const log = createLogger('cpptools');
2323

2424
type Architecture = 'x86' | 'x64' | 'arm' | 'arm64' | undefined;
25-
type StandardVersion = "c89" | "c99" | "c11" | "c17" | "c++98" | "c++03" | "c++11" | "c++14" | "c++17" | "c++20"
26-
| "gnu89" | "gnu99" | "gnu11" | "gnu17" | "gnu++98" | "gnu++03" | "gnu++11" | "gnu++14" | "gnu++17" | "gnu++20" | undefined;
25+
type StandardVersion = "c89" | "c99" | "c11" | "c17" | "c++98" | "c++03" | "c++11" | "c++14" | "c++17" | "c++20" | "gnu89" | "gnu99" | "gnu11" | "gnu17" | "gnu++98" | "gnu++03" | "gnu++11" | "gnu++14" | "gnu++17" | "gnu++20" | undefined;
2726

2827
export interface DiagnosticsCpptools {
2928
isReady: boolean;
@@ -423,8 +422,7 @@ export class CppConfigurationProvider implements cpt.CustomConfigurationProvider
423422
* @param fileGroup The file group from the code model to create config data for
424423
* @param opts Index update options
425424
*/
426-
private _buildConfigurationData(fileGroup: codemodel_api.CodeModelFileGroup, opts: codemodel_api.CodeModelParams, target: TargetDefaults, sysroot: string):
427-
cpt.SourceFileConfiguration {
425+
private _buildConfigurationData(fileGroup: codemodel_api.CodeModelFileGroup, opts: codemodel_api.CodeModelParams, target: TargetDefaults, sysroot: string): cpt.SourceFileConfiguration {
428426
// If the file didn't have a language, default to C++
429427
const lang = fileGroup.language === "RC" ? undefined : fileGroup.language;
430428
// First try to get toolchain values directly reported by CMake. Check the

src/diagnostics/cmake.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,11 @@ export class CMakeOutputConsumer implements OutputConsumer {
5757
* a warning or error with blank lines
5858
*/
5959
blankLines: number;
60-
}
61-
= {
62-
state: 'init',
63-
diag: null,
64-
blankLines: 0
65-
};
60+
} = {
61+
state: 'init',
62+
diag: null,
63+
blankLines: 0
64+
};
6665
/**
6766
* Consume a line of stderr.
6867
* @param line The line from stderr

src/drivers/cmakefileapi/api_helpers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ function findPropertyValue(cacheElement: index_api.Cache.CMakeCacheEntry, name:
7777
return property_element ? property_element.value : '';
7878
}
7979

80-
function convertFileApiCacheToExtensionCache(cache_from_cmake: index_api.Cache.CacheContent):
81-
Map<string, api.CacheEntry> {
80+
function convertFileApiCacheToExtensionCache(cache_from_cmake: index_api.Cache.CacheContent): Map<string, api.CacheEntry> {
8281
return cache_from_cmake.entries.reduce((acc, el) => {
8382
const entry_type_translation_map: { [key: string]: api.CacheEntryType | undefined } = {
8483
BOOL: api.CacheEntryType.Bool,

src/drivers/cms-driver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ export class CMakeServerClientDriver extends CMakeDriver {
232232
targetType: 'META'
233233
});
234234
}
235-
return build_config.projects.reduce<RichTarget[]>((acc, project) => acc.concat(project.targets.map(
236-
t => ({
235+
return build_config.projects.reduce<RichTarget[]>(
236+
(acc, project) => acc.concat(project.targets.map(t => ({
237237
type: 'rich' as 'rich',
238238
name: t.name,
239239
filepath: t.artifacts && t.artifacts.length

src/drivers/driver.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,7 @@ export abstract class CMakeDriver implements vscode.Disposable {
342342
return util.mergeEnvironment(cur_env, kit_env, (opts && opts.environment) ? opts.environment : {});
343343
}
344344

345-
executeCommand(command: string, args?: string[], consumer?: proc.OutputConsumer, options?: proc.ExecutionOptions):
346-
proc.Subprocess {
345+
executeCommand(command: string, args?: string[], consumer?: proc.OutputConsumer, options?: proc.ExecutionOptions): proc.Subprocess {
347346
const environment = this.getEffectiveSubprocessEnvironment(options);
348347
const exec_options = { ...options, environment };
349348
return proc.execute(command, args, consumer, exec_options);

src/extension.ts

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -552,27 +552,24 @@ class ExtensionManager implements vscode.Disposable {
552552
title: string;
553553
persistMode: 'user' | 'workspace';
554554
}
555-
const persist_pr
556-
// Try to persist the user's selection to a `settings.json`
557-
= vscode.window
558-
.showInformationMessage<Choice2>(
559-
perist_message,
560-
{},
561-
{ title: button_messages[0], persistMode: 'user' },
562-
{ title: button_messages[1], persistMode: 'workspace' }
563-
)
564-
.then(async choice => {
565-
if (!choice) {
566-
// Use cancelled. Do nothing.
567-
return;
568-
}
569-
const config = vscode.workspace.getConfiguration(undefined, ws.uri);
570-
let config_target = vscode.ConfigurationTarget.Global;
571-
if (choice.persistMode === 'workspace') {
572-
config_target = vscode.ConfigurationTarget.WorkspaceFolder;
573-
}
574-
await config.update('cmake.configureOnOpen', chosen.doConfigure, config_target);
575-
});
555+
// Try to persist the user's selection to a `settings.json`
556+
const persist_pr = vscode.window.showInformationMessage<Choice2>(
557+
perist_message,
558+
{},
559+
{ title: button_messages[0], persistMode: 'user' },
560+
{ title: button_messages[1], persistMode: 'workspace' })
561+
.then(async choice => {
562+
if (!choice) {
563+
// Use cancelled. Do nothing.
564+
return;
565+
}
566+
const config = vscode.workspace.getConfiguration(undefined, ws.uri);
567+
let config_target = vscode.ConfigurationTarget.Global;
568+
if (choice.persistMode === 'workspace') {
569+
config_target = vscode.ConfigurationTarget.WorkspaceFolder;
570+
}
571+
await config.update('cmake.configureOnOpen', chosen.doConfigure, config_target);
572+
});
576573
rollbar.takePromise(localize('persist.config.on.open.setting', 'Persist config-on-open setting'), {}, persist_pr);
577574
should_configure = chosen.doConfigure;
578575
}
@@ -683,17 +680,7 @@ class ExtensionManager implements vscode.Disposable {
683680
}
684681

685682
private _disposeSubs() {
686-
for (const sub of [this._statusMessageSub,
687-
this._targetNameSub,
688-
this._buildTypeSub,
689-
this._launchTargetSub,
690-
this._ctestEnabledSub,
691-
this._testResultsSub,
692-
this._isBusySub,
693-
this._activeConfigurePresetSub,
694-
this._activeBuildPresetSub,
695-
this._activeTestPresetSub
696-
]) {
683+
for (const sub of [this._statusMessageSub, this._targetNameSub, this._buildTypeSub, this._launchTargetSub, this._ctestEnabledSub, this._testResultsSub, this._isBusySub, this._activeConfigurePresetSub, this._activeBuildPresetSub, this._activeTestPresetSub]) {
697684
sub.dispose();
698685
}
699686
}
@@ -838,10 +825,9 @@ class ExtensionManager implements vscode.Disposable {
838825
/**
839826
* Watches for changes to the kits file
840827
*/
841-
private readonly _kitsWatcher =
842-
util.chokidarOnAnyChange(chokidar.watch(USER_KITS_FILEPATH,
843-
{ ignoreInitial: true }),
844-
_ => rollbar.takePromise(localize('rereading.kits', 'Re-reading kits'), {}, KitsController.readUserKits(this._folders.activeFolder?.cmakeTools)));
828+
private readonly _kitsWatcher = util.chokidarOnAnyChange(
829+
chokidar.watch(USER_KITS_FILEPATH, { ignoreInitial: true }),
830+
_ => rollbar.takePromise(localize('rereading.kits', 'Re-reading kits'), {}, KitsController.readUserKits(this._folders.activeFolder?.cmakeTools)));
845831

846832
/**
847833
* Set the current kit for the specified workspace folder
@@ -1149,9 +1135,8 @@ class ExtensionManager implements vscode.Disposable {
11491135
}
11501136

11511137
configure(folder?: vscode.WorkspaceFolder, showCommandOnly?: boolean) {
1152-
return this.mapCMakeToolsFolder(cmt => cmt.configureInternal(ConfigureTrigger.commandConfigure,
1153-
[],
1154-
showCommandOnly ? ConfigureType.ShowCommandOnly : ConfigureType.Normal),
1138+
return this.mapCMakeToolsFolder(
1139+
cmt => cmt.configureInternal(ConfigureTrigger.commandConfigure, [], showCommandOnly ? ConfigureType.ShowCommandOnly : ConfigureType.Normal),
11551140
folder, undefined, true);
11561141
}
11571142

src/kit.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,7 @@ const MSVC_ENVIRONMENT_VARIABLES = [
638638
* @param devbat Path to a VS environment batch file
639639
* @param args List of arguments to pass to the batch file
640640
*/
641-
async function collectDevBatVars(hostArch: string, devbat: string, args: string[], major_version: number, common_dir: string):
642-
Promise<Map<string, string> | undefined> {
641+
async function collectDevBatVars(hostArch: string, devbat: string, args: string[], major_version: number, common_dir: string): Promise<Map<string, string> | undefined> {
643642
const fname = Math.random().toString() + '.bat';
644643
const batfname = `vs-cmt-${fname}`;
645644
const envfname = batfname + '.env';

src/kitsController.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -466,18 +466,16 @@ export class KitsController {
466466
interface FailOptions extends vscode.MessageItem {
467467
do: 'retry' | 'cancel';
468468
}
469-
const pr = vscode.window
470-
.showErrorMessage<FailOptions>(
471-
`Failed to write kits file to disk: ${USER_KITS_FILEPATH}: ${e.toString()}`,
472-
{
473-
title: localize('retry.button', 'Retry'),
474-
do: 'retry'
475-
},
476-
{
477-
title: localize('cancel.button', 'Cancel'),
478-
do: 'cancel'
479-
}
480-
)
469+
const pr = vscode.window.showErrorMessage<FailOptions>(
470+
`Failed to write kits file to disk: ${USER_KITS_FILEPATH}: ${e.toString()}`,
471+
{
472+
title: localize('retry.button', 'Retry'),
473+
do: 'retry'
474+
},
475+
{
476+
title: localize('cancel.button', 'Cancel'),
477+
do: 'cancel'
478+
})
481479
.then(choice => {
482480
if (!choice) {
483481
return false;

0 commit comments

Comments
 (0)