Skip to content

Commit 44e2a0e

Browse files
authored
added enforcement of no array constructor. (#11385)
1 parent 0cd369c commit 44e2a0e

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Extension/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ module.exports = {
6666
"arrow-spacing": ["error", { "before": true, "after": true }],
6767
"semi-spacing": ["error", { "before": false, "after": true }],
6868
"no-extra-parens": ["error", "all", { "nestedBinaryExpressions": false, "ternaryOperandBinaryExpressions": false }],
69+
"@typescript-eslint/no-array-constructor": "error",
6970
"@typescript-eslint/no-useless-constructor": "error",
7071
"@typescript-eslint/no-for-in-array": "error",
7172
"@typescript-eslint/no-misused-new": "error",

Extension/src/Debugger/configurationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
839839
}
840840
const rawLaunchJson: any = await this.getRawLaunchJson();
841841
if (!rawLaunchJson.configurations) {
842-
rawLaunchJson.configurations = new Array();
842+
rawLaunchJson.configurations = [];
843843
}
844844
if (!rawLaunchJson.version) {
845845
rawLaunchJson.version = "2.0.0";

Extension/src/LanguageServer/cppBuildTaskProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class CppBuildTaskProvider implements TaskProvider {
220220

221221
public async getJsonTasks(): Promise<CppBuildTask[]> {
222222
const rawJson: any = await this.getRawTasksJson();
223-
const rawTasksJson: any = !rawJson.tasks ? new Array() : rawJson.tasks;
223+
const rawTasksJson: any = !rawJson.tasks ? [] : rawJson.tasks;
224224
const buildTasksJson: CppBuildTask[] = rawTasksJson.map((task: any) => {
225225
if (!task.label || !task.type || task.type !== CppBuildTaskProvider.CppBuildScriptType) {
226226
return null;
@@ -259,7 +259,7 @@ export class CppBuildTaskProvider implements TaskProvider {
259259
public async writeBuildTask(taskLabel: string, workspaceFolder?: WorkspaceFolder, setAsDefault: boolean = false): Promise<void> {
260260
const rawTasksJson: any = await this.getRawTasksJson(workspaceFolder);
261261
if (!rawTasksJson.tasks) {
262-
rawTasksJson.tasks = new Array();
262+
rawTasksJson.tasks = [];
263263
}
264264
// Check if the task exists in the user's task.json.
265265
if (rawTasksJson.tasks.find((task: any) => task.label && task.label === taskLabel)) {

0 commit comments

Comments
 (0)