diff --git a/src/api/convertFileCommentsStandalone.ts b/src/api/convertFileCommentsStandalone.ts index 4307a4f2b..af1095123 100644 --- a/src/api/convertFileCommentsStandalone.ts +++ b/src/api/convertFileCommentsStandalone.ts @@ -33,8 +33,8 @@ export type ConvertFileCommentsStandaloneDependencies = { export const convertFileCommentsStandalone = ({ fileContent, filePath, - ruleCommentsCache = new Map(), - ruleEquivalents = new Map(), + ruleCommentsCache = new Map(), + ruleEquivalents = new Map(), }: ConvertFileCommentsStandaloneDependencies) => { const comments = parseFileComments(filePath, fileContent); diff --git a/src/converters/lintConfigs/rules/ruleConverters.ts b/src/converters/lintConfigs/rules/ruleConverters.ts index 9b08c7ea6..093edb285 100644 --- a/src/converters/lintConfigs/rules/ruleConverters.ts +++ b/src/converters/lintConfigs/rules/ruleConverters.ts @@ -112,6 +112,7 @@ import { convertOneLine } from "./ruleConverters/one-line"; import { convertOneVariablePerDeclaration } from "./ruleConverters/one-variable-per-declaration"; import { convertOnlyArrowFunctions } from "./ruleConverters/only-arrow-functions"; import { convertOrderedImports } from "./ruleConverters/ordered-imports"; +import { convertPreferArrayLiteral } from "./ruleConverters/prefer-array-literal"; import { convertPreferConditionalExpression } from "./ruleConverters/prefer-conditional-expression"; import { convertPreferConst } from "./ruleConverters/prefer-const"; import { convertPreferForOf } from "./ruleConverters/prefer-for-of"; @@ -376,6 +377,7 @@ export const ruleConverters = new Map([ ["only-arrow-functions", convertOnlyArrowFunctions], ["ordered-imports", convertOrderedImports], ["pipe-prefix", convertPipePrefix], + ["prefer-array-literal", convertPreferArrayLiteral], ["prefer-conditional-expression", convertPreferConditionalExpression], ["prefer-const", convertPreferConst], ["prefer-for-of", convertPreferForOf], diff --git a/src/converters/lintConfigs/rules/ruleConverters/prefer-array-literal.ts b/src/converters/lintConfigs/rules/ruleConverters/prefer-array-literal.ts new file mode 100644 index 000000000..00c47ed9f --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/prefer-array-literal.ts @@ -0,0 +1,15 @@ +import { RuleConverter } from "../ruleConverter"; + +export const convertPreferArrayLiteral: RuleConverter = () => { + return { + rules: [ + { + ruleName: "no-array-constructor", + ruleSeverity: "off" + }, + { + ruleName: "@typescript-eslint/no-array-constructor", + }, + ], + }; +}; diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-array-literal.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-array-literal.test.ts new file mode 100644 index 000000000..0e48424bf --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-array-literal.test.ts @@ -0,0 +1,21 @@ +import { convertPreferArrayLiteral } from "../prefer-array-literal"; + +describe(convertPreferArrayLiteral, () => { + test("conversion without arguments", () => { + const result = convertPreferArrayLiteral({ + ruleArguments: [], + }); + + expect(result).toEqual({ + rules: [ + { + ruleName: "no-array-constructor", + ruleSeverity: "off" + }, + { + ruleName: "@typescript-eslint/no-array-constructor", + }, + ], + }); + }); +});