From f0a22baf3bcc7b2aefe6ca34bde4d2fa49ecd9e2 Mon Sep 17 00:00:00 2001 From: Rafael Santana Date: Mon, 30 Aug 2021 00:41:01 -0300 Subject: [PATCH 1/3] refactor: simplify converters --- .../ruleConverters/codelyzer/tests/use-pipe-decorator.test.ts | 2 +- .../rules/ruleConverters/codelyzer/use-pipe-decorator.ts | 4 +--- .../ngrx-tslint-rules/no-duplicate-action-types.ts | 4 +--- .../ngrx-tslint-rules/tests/no-duplicate-action-types.test.ts | 4 +--- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/use-pipe-decorator.test.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/use-pipe-decorator.test.ts index 5d59b30e3..001d8ab78 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/use-pipe-decorator.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/use-pipe-decorator.test.ts @@ -6,6 +6,6 @@ describe(convertUsePipeDecorator, () => { ruleArguments: [], }); - expect(result).toEqual({ rules: [] }); + expect(result).toEqual({}); }); }); diff --git a/src/converters/lintConfigs/rules/ruleConverters/codelyzer/use-pipe-decorator.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/use-pipe-decorator.ts index 2506632d4..90ca37a63 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/codelyzer/use-pipe-decorator.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/use-pipe-decorator.ts @@ -1,7 +1,5 @@ import { RuleConverter } from "../../ruleConverter"; export const convertUsePipeDecorator: RuleConverter = () => { - return { - rules: [], - }; + return {}; }; diff --git a/src/converters/lintConfigs/rules/ruleConverters/ngrx-tslint-rules/no-duplicate-action-types.ts b/src/converters/lintConfigs/rules/ruleConverters/ngrx-tslint-rules/no-duplicate-action-types.ts index a8ce6e832..7de53aa0a 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/ngrx-tslint-rules/no-duplicate-action-types.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/ngrx-tslint-rules/no-duplicate-action-types.ts @@ -1,7 +1,5 @@ import { RuleConverter } from "../../ruleConverter"; export const convertNoDuplicateActionTypes: RuleConverter = () => { - return { - rules: [], - }; + return {}; }; diff --git a/src/converters/lintConfigs/rules/ruleConverters/ngrx-tslint-rules/tests/no-duplicate-action-types.test.ts b/src/converters/lintConfigs/rules/ruleConverters/ngrx-tslint-rules/tests/no-duplicate-action-types.test.ts index 4cbeee165..3dd7f7bb7 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/ngrx-tslint-rules/tests/no-duplicate-action-types.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/ngrx-tslint-rules/tests/no-duplicate-action-types.test.ts @@ -6,8 +6,6 @@ describe(convertNoDuplicateActionTypes, () => { ruleArguments: [], }); - expect(result).toEqual({ - rules: [], - }); + expect(result).toEqual({}); }); }); From fd9dfff79c445d7cee574b6e1ab549377171b443 Mon Sep 17 00:00:00 2001 From: Rafael Santana Date: Mon, 30 Aug 2021 00:42:11 -0300 Subject: [PATCH 2/3] refactor: move codelyzer rules to the correct folder --- src/converters/lintConfigs/rules/ruleConverters.ts | 4 ++-- .../{ => codelyzer}/import-destructuring-spacing.ts | 2 +- .../ruleConverters/{ => codelyzer}/prefer-inline-decorator.ts | 2 +- .../tests/import-destructuring-spacing.test.ts | 0 .../{ => codelyzer}/tests/prefer-inline-decorator.test.ts | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename src/converters/lintConfigs/rules/ruleConverters/{ => codelyzer}/import-destructuring-spacing.ts (63%) rename src/converters/lintConfigs/rules/ruleConverters/{ => codelyzer}/prefer-inline-decorator.ts (61%) rename src/converters/lintConfigs/rules/ruleConverters/{ => codelyzer}/tests/import-destructuring-spacing.test.ts (100%) rename src/converters/lintConfigs/rules/ruleConverters/{ => codelyzer}/tests/prefer-inline-decorator.test.ts (100%) diff --git a/src/converters/lintConfigs/rules/ruleConverters.ts b/src/converters/lintConfigs/rules/ruleConverters.ts index 0037c3594..3b24bd6bf 100644 --- a/src/converters/lintConfigs/rules/ruleConverters.ts +++ b/src/converters/lintConfigs/rules/ruleConverters.ts @@ -17,6 +17,7 @@ import { convertContextualDecorator } from "./ruleConverters/codelyzer/contextua import { convertContextualLifecycle } from "./ruleConverters/codelyzer/contextual-lifecycle"; import { convertDirectiveClassSuffix } from "./ruleConverters/codelyzer/directive-class-suffix"; import { convertDirectiveSelector } from "./ruleConverters/codelyzer/directive-selector"; +import { convertImportDestructuringSpacing } from "./ruleConverters/codelyzer/import-destructuring-spacing"; import { convertNoAttributeDecorator } from "./ruleConverters/codelyzer/no-attribute-decorator"; import { convertNoConflictingLifecycle } from "./ruleConverters/codelyzer/no-conflicting-lifecycle"; import { convertNoForwardRef } from "./ruleConverters/codelyzer/no-forward-ref"; @@ -32,6 +33,7 @@ import { convertNoOutputsMetadataProperty } from "./ruleConverters/codelyzer/no- import { convertNoPipeImpure } from "./ruleConverters/codelyzer/no-pipe-impure"; import { convertNoQueriesMetadataProperty } from "./ruleConverters/codelyzer/no-queries-metadata-property"; import { convertPipePrefix } from "./ruleConverters/codelyzer/pipe-prefix"; +import { convertPreferInlineDecorator } from "./ruleConverters/codelyzer/prefer-inline-decorator"; import { convertPreferOnPushComponentChangeDetection } from "./ruleConverters/codelyzer/prefer-on-push-component-change-detection"; import { convertPreferOutputReadonly } from "./ruleConverters/codelyzer/prefer-output-readonly"; import { convertRelativeUrlPrefix } from "./ruleConverters/codelyzer/relative-url-prefix"; @@ -156,7 +158,6 @@ import { convertFileNameCasing } from "./ruleConverters/file-name-casing"; import { convertForin } from "./ruleConverters/forin"; import { convertFunctionConstructor } from "./ruleConverters/function-constructor"; import { convertImportBlacklist } from "./ruleConverters/import-blacklist"; -import { convertImportDestructuringSpacing } from "./ruleConverters/import-destructuring-spacing"; import { convertIncrementDecrement } from "./ruleConverters/increment-decrement"; import { convertIndent } from "./ruleConverters/indent"; import { convertInterfaceName } from "./ruleConverters/interface-name"; @@ -281,7 +282,6 @@ import { convertPreferConditionalExpression } from "./ruleConverters/prefer-cond import { convertPreferConst } from "./ruleConverters/prefer-const"; import { convertPreferForOf } from "./ruleConverters/prefer-for-of"; import { convertPreferFunctionOverMethod } from "./ruleConverters/prefer-function-over-method"; -import { convertPreferInlineDecorator } from "./ruleConverters/prefer-inline-decorator"; import { convertPreferObjectSpread } from "./ruleConverters/prefer-object-spread"; import { convertPreferReadonly } from "./ruleConverters/prefer-readonly"; import { convertPreferSwitch } from "./ruleConverters/prefer-switch"; diff --git a/src/converters/lintConfigs/rules/ruleConverters/import-destructuring-spacing.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/import-destructuring-spacing.ts similarity index 63% rename from src/converters/lintConfigs/rules/ruleConverters/import-destructuring-spacing.ts rename to src/converters/lintConfigs/rules/ruleConverters/codelyzer/import-destructuring-spacing.ts index 1d0a27a35..b4c55f9ea 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/import-destructuring-spacing.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/import-destructuring-spacing.ts @@ -1,4 +1,4 @@ -import { RuleConverter } from "../ruleConverter"; +import { RuleConverter } from "../../ruleConverter"; export const convertImportDestructuringSpacing: RuleConverter = () => { return {}; diff --git a/src/converters/lintConfigs/rules/ruleConverters/prefer-inline-decorator.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/prefer-inline-decorator.ts similarity index 61% rename from src/converters/lintConfigs/rules/ruleConverters/prefer-inline-decorator.ts rename to src/converters/lintConfigs/rules/ruleConverters/codelyzer/prefer-inline-decorator.ts index 8d674d55e..57417a327 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/prefer-inline-decorator.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/prefer-inline-decorator.ts @@ -1,4 +1,4 @@ -import { RuleConverter } from "../ruleConverter"; +import { RuleConverter } from "../../ruleConverter"; export const convertPreferInlineDecorator: RuleConverter = () => { return {}; diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/import-destructuring-spacing.test.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/import-destructuring-spacing.test.ts similarity index 100% rename from src/converters/lintConfigs/rules/ruleConverters/tests/import-destructuring-spacing.test.ts rename to src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/import-destructuring-spacing.test.ts diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-inline-decorator.test.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/prefer-inline-decorator.test.ts similarity index 100% rename from src/converters/lintConfigs/rules/ruleConverters/tests/prefer-inline-decorator.test.ts rename to src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/prefer-inline-decorator.test.ts From 4f486eb5fa5d7cb82f584c53353c9782129816cd Mon Sep 17 00:00:00 2001 From: Rafael Santana Date: Mon, 30 Aug 2021 00:42:42 -0300 Subject: [PATCH 3/3] feat: add missing `angular-whitespace` converter --- src/converters/lintConfigs/rules/ruleConverters.ts | 2 ++ .../ruleConverters/codelyzer/angular-whitespace.ts | 5 +++++ .../codelyzer/tests/angular-whitespace.test.ts | 11 +++++++++++ 3 files changed, 18 insertions(+) create mode 100644 src/converters/lintConfigs/rules/ruleConverters/codelyzer/angular-whitespace.ts create mode 100644 src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/angular-whitespace.test.ts diff --git a/src/converters/lintConfigs/rules/ruleConverters.ts b/src/converters/lintConfigs/rules/ruleConverters.ts index 3b24bd6bf..d7d279d6d 100644 --- a/src/converters/lintConfigs/rules/ruleConverters.ts +++ b/src/converters/lintConfigs/rules/ruleConverters.ts @@ -10,6 +10,7 @@ import { convertBanTypes } from "./ruleConverters/ban-types"; import { convertBinaryExpressionOperandOrder } from "./ruleConverters/binary-expression-operand-order"; import { convertCallableTypes } from "./ruleConverters/callable-types"; import { convertClassName } from "./ruleConverters/class-name"; +import { convertAngularWhitespace } from "./ruleConverters/codelyzer/angular-whitespace"; import { convertComponentClassSuffix } from "./ruleConverters/codelyzer/component-class-suffix"; import { convertComponentMaxInlineDeclarations } from "./ruleConverters/codelyzer/component-max-inline-declarations"; import { convertComponentSelector } from "./ruleConverters/codelyzer/component-selector"; @@ -331,6 +332,7 @@ import { convertVariableName } from "./ruleConverters/variable-name"; export const ruleConverters = new Map([ ["adjacent-overload-signatures", convertAdjacentOverloadSignatures], ["align", convertAlign], + ["angular-whitespace", convertAngularWhitespace], ["array-type", convertArrayType], ["arrow-parens", convertArrowParens], ["arrow-return-shorthand", convertArrowReturnShorthand], diff --git a/src/converters/lintConfigs/rules/ruleConverters/codelyzer/angular-whitespace.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/angular-whitespace.ts new file mode 100644 index 000000000..3dcd10957 --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/angular-whitespace.ts @@ -0,0 +1,5 @@ +import { RuleConverter } from "../../ruleConverter"; + +export const convertAngularWhitespace: RuleConverter = () => { + return {}; +}; diff --git a/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/angular-whitespace.test.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/angular-whitespace.test.ts new file mode 100644 index 000000000..ff1bc4eda --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/angular-whitespace.test.ts @@ -0,0 +1,11 @@ +import { convertAngularWhitespace } from "../angular-whitespace"; + +describe(convertAngularWhitespace, () => { + test("conversion without arguments", () => { + const result = convertAngularWhitespace({ + ruleArguments: [], + }); + + expect(result).toEqual({}); + }); +});