diff --git a/.eslintrc.js b/.eslintrc.js index b0c3f9734..40787fc82 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -16,7 +16,7 @@ module.exports = { parserOptions: { project: "tsconfig.json", }, - plugins: ["@typescript-eslint"], + plugins: ["simple-import-sort", "@typescript-eslint"], rules: { "@typescript-eslint/comma-dangle": [ "error", @@ -64,5 +64,7 @@ module.exports = { "@typescript-eslint/typedef": "off", "comma-dangle": "off", "no-else-return": "error", + "simple-import-sort/imports": "error", + "simple-import-sort/exports": "error", }, }; diff --git a/package-lock.json b/package-lock.json index bee470824..ae0269697 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3969,6 +3969,12 @@ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz", "integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==" }, + "eslint-plugin-simple-import-sort": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz", + "integrity": "sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw==", + "dev": true + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", diff --git a/package.json b/package.json index c6fa72364..379e95c93 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "@typescript-eslint/parser": "4.25.0", "babel-jest": "27.0.1", "eslint": "7.27.0", + "eslint-plugin-simple-import-sort": "^7.0.0", "husky": "6.0.0", "jest": "27.0.1", "lint-staged": "11.0.0", diff --git a/src/api/dependencies.ts b/src/api/dependencies.ts index 2940039fc..854c8c2cd 100644 --- a/src/api/dependencies.ts +++ b/src/api/dependencies.ts @@ -4,62 +4,75 @@ import { globAsync } from "../adapters/globAsync"; import { nativeImporter } from "../adapters/nativeImporter"; import { processLogger } from "../adapters/processLogger"; import { bind } from "../binding"; +import { RunCliDependencies } from "../cli/runCli"; import { collectCommentFileNames, CollectCommentFileNamesDependencies, } from "../comments/collectCommentFileNames"; import { - ReportCommentResultsDependencies, + convertComments, + ConvertCommentsDependencies, +} from "../converters/comments/convertComments"; +import { + convertFileComments, + ConvertFileCommentsDependencies, +} from "../converters/comments/convertFileComments"; +import { + extractGlobPaths, + ExtractGlobPathsDependencies, +} from "../converters/comments/extractGlobPaths"; +import { reportCommentResults, + ReportCommentResultsDependencies, } from "../converters/comments/reporting/reportCommentResults"; import { - ConvertEditorConfigDependencies, convertEditorConfig, + ConvertEditorConfigDependencies, } from "../converters/editorConfigs/convertEditorConfig"; import { - ConvertLintConfigDependencies, + convertEditorConfigs, + ConvertEditorConfigsDependencies, +} from "../converters/editorConfigs/convertEditorConfigs"; +import { convertAtomConfig } from "../converters/editorConfigs/converters/convertAtomConfig"; +import { convertVSCodeConfig } from "../converters/editorConfigs/converters/convertVSCodeConfig"; +import { reportEditorConfigConversionResults } from "../converters/editorConfigs/reporting/reportEditorConfigConversionResults"; +import { EditorConfigDescriptor } from "../converters/editorConfigs/types"; +import { convertLintConfig, + ConvertLintConfigDependencies, } from "../converters/lintConfigs/convertLintConfig"; import { - ReportConversionResultsDependencies, - reportConfigConversionResults, -} from "../converters/lintConfigs/reporting/reportConfigConversionResults"; + createESLintConfiguration, + CreateESLintConfigurationDependencies, +} from "../converters/lintConfigs/createESLintConfiguration"; +import { removeExtendsDuplicatedRules } from "../converters/lintConfigs/pruning/removeExtendsDuplicatedRules"; import { - ConvertCommentsDependencies, - convertComments, -} from "../converters/comments/convertComments"; + choosePackageManager, + ChoosePackageManagerDependencies, +} from "../converters/lintConfigs/reporting/packages/choosePackageManager"; import { - ConvertFileCommentsDependencies, - convertFileComments, -} from "../converters/comments/convertFileComments"; + logMissingPackages, + LogMissingPackagesDependencies, +} from "../converters/lintConfigs/reporting/packages/logMissingPackages"; +import { + reportConfigConversionResults, + ReportConversionResultsDependencies, +} from "../converters/lintConfigs/reporting/reportConfigConversionResults"; import { - ConvertRulesDependencies, convertRules, + ConvertRulesDependencies, } from "../converters/lintConfigs/rules/convertRules"; import { ruleConverters } from "../converters/lintConfigs/rules/ruleConverters"; +import { ruleMergers } from "../converters/lintConfigs/rules/ruleMergers"; +import { checkPrettierExtension } from "../converters/lintConfigs/summarization/prettier/checkPrettierExtension"; import { - RetrieveExtendsValuesDependencies, retrieveExtendsValues, + RetrieveExtendsValuesDependencies, } from "../converters/lintConfigs/summarization/retrieveExtendsValues"; import { - SummarizePackageRulesDependencies, summarizePackageRules, + SummarizePackageRulesDependencies, } from "../converters/lintConfigs/summarization/summarizePackageRules"; -import { - ChoosePackageManagerDependencies, - choosePackageManager, -} from "../converters/lintConfigs/reporting/packages/choosePackageManager"; -import { - LogMissingPackagesDependencies, - logMissingPackages, -} from "../converters/lintConfigs/reporting/packages/logMissingPackages"; -import { RunCliDependencies } from "../cli/runCli"; -import { ruleMergers } from "../converters/lintConfigs/rules/ruleMergers"; -import { removeExtendsDuplicatedRules } from "../converters/lintConfigs/pruning/removeExtendsDuplicatedRules"; -import { - ExtractGlobPathsDependencies, - extractGlobPaths, -} from "../converters/comments/extractGlobPaths"; import { findESLintConfiguration } from "../input/findESLintConfiguration"; import { findOriginalConfigurations, @@ -70,19 +83,6 @@ import { findTSLintConfiguration } from "../input/findTSLintConfiguration"; import { findTypeScriptConfiguration } from "../input/findTypeScriptConfiguration"; import { importer, ImporterDependencies } from "../input/importer"; import { mergeLintConfigurations } from "../input/mergeLintConfigurations"; -import { - createESLintConfiguration, - CreateESLintConfigurationDependencies, -} from "../converters/lintConfigs/createESLintConfiguration"; -import { checkPrettierExtension } from "../converters/lintConfigs/summarization/prettier/checkPrettierExtension"; -import { - convertEditorConfigs, - ConvertEditorConfigsDependencies, -} from "../converters/editorConfigs/convertEditorConfigs"; -import { reportEditorConfigConversionResults } from "../converters/editorConfigs/reporting/reportEditorConfigConversionResults"; -import { EditorConfigDescriptor } from "../converters/editorConfigs/types"; -import { convertAtomConfig } from "../converters/editorConfigs/converters/convertAtomConfig"; -import { convertVSCodeConfig } from "../converters/editorConfigs/converters/convertVSCodeConfig"; export const convertFileCommentsDependencies: ConvertFileCommentsDependencies = { converters: ruleConverters, fileSystem: fsFileSystem, diff --git a/src/converters/comments/convertComments.ts b/src/converters/comments/convertComments.ts index 3598ce345..082e30f24 100644 --- a/src/converters/comments/convertComments.ts +++ b/src/converters/comments/convertComments.ts @@ -1,7 +1,7 @@ import { SansDependencies } from "../../binding"; import { collectCommentFileNames } from "../../comments/collectCommentFileNames"; import { AllOriginalConfigurations } from "../../input/findOriginalConfigurations"; -import { ResultWithDataStatus, ResultStatus, TSLintToESLintSettings } from "../../types"; +import { ResultStatus, ResultWithDataStatus, TSLintToESLintSettings } from "../../types"; import { isError } from "../../utils"; import { convertFileComments } from "./convertFileComments"; import { extractGlobPaths } from "./extractGlobPaths"; diff --git a/src/converters/editorConfigs/reporting/reportEditorConfigConversionResults.ts b/src/converters/editorConfigs/reporting/reportEditorConfigConversionResults.ts index 537ddb690..d10640435 100644 --- a/src/converters/editorConfigs/reporting/reportEditorConfigConversionResults.ts +++ b/src/converters/editorConfigs/reporting/reportEditorConfigConversionResults.ts @@ -1,8 +1,8 @@ import { Logger } from "../../../adapters/logger"; import { - logSuccessfulConversions, logFailedConversions, logMissingConversionTarget, + logSuccessfulConversions, } from "../../../reporting"; import { EditorConfigsConversionResults } from "../types"; diff --git a/src/converters/lintConfigs/convertLintConfig.ts b/src/converters/lintConfigs/convertLintConfig.ts index e3a32d193..14f3ced39 100644 --- a/src/converters/lintConfigs/convertLintConfig.ts +++ b/src/converters/lintConfigs/convertLintConfig.ts @@ -1,7 +1,7 @@ import { FileSystem } from "../../adapters/fileSystem"; import { SansDependencies } from "../../binding"; import { AllOriginalConfigurations } from "../../input/findOriginalConfigurations"; -import { TSLintToESLintSettings, ResultWithStatus, ResultStatus } from "../../types"; +import { ResultStatus, ResultWithStatus, TSLintToESLintSettings } from "../../types"; import { createESLintConfiguration } from "./createESLintConfiguration"; import { formatOutput } from "./formatting/formatOutput"; import { joinConfigConversionResults } from "./joinConfigConversionResults"; diff --git a/src/converters/lintConfigs/eslint/createEnv.test.ts b/src/converters/lintConfigs/eslint/createEnv.test.ts index 417c281b5..7cb709815 100644 --- a/src/converters/lintConfigs/eslint/createEnv.test.ts +++ b/src/converters/lintConfigs/eslint/createEnv.test.ts @@ -1,5 +1,5 @@ -import { createEnv } from "./createEnv"; import { TypeScriptConfiguration } from "../../../input/findTypeScriptConfiguration"; +import { createEnv } from "./createEnv"; const createTypeScriptCompilerOptions = ( overrides: Partial = {}, diff --git a/src/converters/lintConfigs/formatting/formatOutput.test.ts b/src/converters/lintConfigs/formatting/formatOutput.test.ts index 9a6a2391b..5b0ebd8d5 100644 --- a/src/converters/lintConfigs/formatting/formatOutput.test.ts +++ b/src/converters/lintConfigs/formatting/formatOutput.test.ts @@ -1,7 +1,7 @@ import { EOL } from "os"; -import { faqs } from "./formatters/faqs"; import { formatOutput } from "./formatOutput"; +import { faqs } from "./formatters/faqs"; describe("formatOutput", () => { it("formats output as JavaScript for a .js file path", () => { diff --git a/src/converters/lintConfigs/pruning/normalizeRawESLintRuleSeverity.ts b/src/converters/lintConfigs/pruning/normalizeRawESLintRuleSeverity.ts index 90202881e..c13491f6b 100644 --- a/src/converters/lintConfigs/pruning/normalizeRawESLintRuleSeverity.ts +++ b/src/converters/lintConfigs/pruning/normalizeRawESLintRuleSeverity.ts @@ -1,4 +1,4 @@ -import { RawESLintRuleSeverity, ESLintRuleSeverity } from "../rules/types"; +import { ESLintRuleSeverity, RawESLintRuleSeverity } from "../rules/types"; export const normalizeRawESLintRuleSeverity = ( rawSeverity: RawESLintRuleSeverity, diff --git a/src/converters/lintConfigs/pruning/removeExtendsDuplicatedRules.test.ts b/src/converters/lintConfigs/pruning/removeExtendsDuplicatedRules.test.ts index 8a551a674..bfcdebe00 100644 --- a/src/converters/lintConfigs/pruning/removeExtendsDuplicatedRules.test.ts +++ b/src/converters/lintConfigs/pruning/removeExtendsDuplicatedRules.test.ts @@ -33,7 +33,10 @@ describe("removeExtendsDuplicatedRules", () => { }); // Act - const { differentRules } = removeExtendsDuplicatedRules(allRules, new Map()); + const { differentRules } = removeExtendsDuplicatedRules( + allRules, + new Map(), + ); // Assert expect(differentRules.size).toBe(1); diff --git a/src/converters/lintConfigs/reporting/packages/choosePackageManager.ts b/src/converters/lintConfigs/reporting/packages/choosePackageManager.ts index afd04e906..e84856837 100644 --- a/src/converters/lintConfigs/reporting/packages/choosePackageManager.ts +++ b/src/converters/lintConfigs/reporting/packages/choosePackageManager.ts @@ -1,5 +1,5 @@ import { FileSystem } from "../../../../adapters/fileSystem"; -import { preferredLockfiles, PackageManager } from "./packageManagers"; +import { PackageManager, preferredLockfiles } from "./packageManagers"; export type ChoosePackageManagerDependencies = { fileSystem: Pick; diff --git a/src/converters/lintConfigs/reporting/reportConfigConversionResults.ts b/src/converters/lintConfigs/reporting/reportConfigConversionResults.ts index 287a06e17..6161ddcf0 100644 --- a/src/converters/lintConfigs/reporting/reportConfigConversionResults.ts +++ b/src/converters/lintConfigs/reporting/reportConfigConversionResults.ts @@ -3,11 +3,11 @@ import { EOL } from "os"; import { Logger } from "../../../adapters/logger"; import { - logSuccessfulConversions, logFailedConversions, logMissingConversionTarget, + logSuccessfulConversions, } from "../../../reporting"; -import { TSLintRuleOptions, ESLintRuleOptions } from "../rules/types"; +import { ESLintRuleOptions, TSLintRuleOptions } from "../rules/types"; import { SummarizedConfigResultsConfiguration } from "../summarization/types"; export type ReportConversionResultsDependencies = { diff --git a/src/converters/lintConfigs/rules/convertRules.test.ts b/src/converters/lintConfigs/rules/convertRules.test.ts index 999e293b5..d65b8244d 100644 --- a/src/converters/lintConfigs/rules/convertRules.test.ts +++ b/src/converters/lintConfigs/rules/convertRules.test.ts @@ -1,7 +1,7 @@ import { ConversionError } from "../../../errors/conversionError"; import { convertRules } from "./convertRules"; +import { ConversionResult, RuleConverter } from "./ruleConverter"; import { RuleMerger } from "./ruleMerger"; -import { RuleConverter, ConversionResult } from "./ruleConverter"; import { TSLintRuleOptions, TSLintRuleSeverity } from "./types"; describe("convertRules", () => { diff --git a/src/converters/lintConfigs/rules/convertRules.ts b/src/converters/lintConfigs/rules/convertRules.ts index 8b230f04b..031f60fa0 100644 --- a/src/converters/lintConfigs/rules/convertRules.ts +++ b/src/converters/lintConfigs/rules/convertRules.ts @@ -3,13 +3,13 @@ import { isEqual } from "lodash"; import { ConversionError } from "../../../errors/conversionError"; import { ErrorSummary } from "../../../errors/errorSummary"; import { TSLintConfigurationRules } from "../../../input/findTSLintConfiguration"; +import { Entries, uniqueFromSources } from "../../../utils"; import { convertRule } from "./convertRule"; import { convertTSLintRuleSeverity } from "./formats/convertTSLintRuleSeverity"; import { formatRawTslintRule } from "./formats/formatRawTslintRule"; -import { RuleMerger } from "./ruleMerger"; import { RuleConverter } from "./ruleConverter"; -import { TSLintRuleOptions, ESLintRuleOptions } from "./types"; -import { Entries, uniqueFromSources } from "../../../utils"; +import { RuleMerger } from "./ruleMerger"; +import { ESLintRuleOptions, TSLintRuleOptions } from "./types"; export type ConvertRulesDependencies = { ruleConverters: Map; @@ -39,7 +39,9 @@ export const convertRules = ( const plugins = new Set(); if (rawTslintRules !== undefined) { - for (const [ruleName, value] of Object.entries(rawTslintRules) as Entries) { + for (const [ruleName, value] of Object.entries( + rawTslintRules, + ) as Entries) { // 1. The raw TSLint rule is converted to a standardized format. const tslintRule = formatRawTslintRule(ruleName, value); diff --git a/src/converters/lintConfigs/rules/ruleConverter.ts b/src/converters/lintConfigs/rules/ruleConverter.ts index 392e67903..fc2f266b7 100644 --- a/src/converters/lintConfigs/rules/ruleConverter.ts +++ b/src/converters/lintConfigs/rules/ruleConverter.ts @@ -1,5 +1,5 @@ -import { ESLintRuleSeverity, TSLintRuleOptions } from "./types"; import { ConversionError } from "../../../errors/conversionError"; +import { ESLintRuleSeverity, TSLintRuleOptions } from "./types"; /** * Section of a TSLint rule's options used for conversion. diff --git a/src/converters/lintConfigs/rules/ruleConverters.ts b/src/converters/lintConfigs/rules/ruleConverters.ts index b87d77efa..d03ff5db3 100644 --- a/src/converters/lintConfigs/rules/ruleConverters.ts +++ b/src/converters/lintConfigs/rules/ruleConverters.ts @@ -10,11 +10,126 @@ 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 { convertComponentClassSuffix } from "./ruleConverters/codelyzer/component-class-suffix"; +import { convertComponentMaxInlineDeclarations } from "./ruleConverters/codelyzer/component-max-inline-declarations"; +import { convertComponentSelector } from "./ruleConverters/codelyzer/component-selector"; +import { convertContextualDecorator } from "./ruleConverters/codelyzer/contextual-decorator"; +import { convertContextualLifecycle } from "./ruleConverters/codelyzer/contextual-lifecycle"; +import { convertDirectiveClassSuffix } from "./ruleConverters/codelyzer/directive-class-suffix"; +import { convertDirectiveSelector } from "./ruleConverters/codelyzer/directive-selector"; +import { convertNoAttributeDecorator } from "./ruleConverters/codelyzer/no-attribute-decorator"; +import { convertNoConflictingLifecycle } from "./ruleConverters/codelyzer/no-conflicting-lifecycle"; +import { convertNoForwardRef } from "./ruleConverters/codelyzer/no-forward-ref"; +import { convertNoHostMetadataProperty } from "./ruleConverters/codelyzer/no-host-metadata-property"; +import { convertNoInputPrefix } from "./ruleConverters/codelyzer/no-input-prefix"; +import { convertNoInputRename } from "./ruleConverters/codelyzer/no-input-rename"; +import { convertNoInputsMetadataProperty } from "./ruleConverters/codelyzer/no-inputs-metadata-property"; +import { convertNoLifecycleCall } from "./ruleConverters/codelyzer/no-lifecycle-call"; +import { convertNoOutputNative } from "./ruleConverters/codelyzer/no-output-native"; +import { convertNoOutputOnPrefix } from "./ruleConverters/codelyzer/no-output-on-prefix"; +import { convertNoOutputRename } from "./ruleConverters/codelyzer/no-output-rename"; +import { convertNoOutputsMetadataProperty } from "./ruleConverters/codelyzer/no-outputs-metadata-property"; +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 { 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"; +import { convertTemplateAccessibilityAltText } from "./ruleConverters/codelyzer/template-accessibility-alt-text"; +import { convertTemplateAccessibilityElementsContent } from "./ruleConverters/codelyzer/template-accessibility-elements-content"; +import { convertTemplateAccessibilityLabelFor } from "./ruleConverters/codelyzer/template-accessibility-label-for"; +import { convertTemplateAccessibilityTabindexNoPositive } from "./ruleConverters/codelyzer/template-accessibility-tabindex-no-positive"; +import { convertTemplateAccessibilityTableScope } from "./ruleConverters/codelyzer/template-accessibility-table-scope"; +import { convertTemplateAccessibilityValidAria } from "./ruleConverters/codelyzer/template-accessibility-valid-aria"; +import { convertTemplateBananaInBox } from "./ruleConverters/codelyzer/template-banana-in-box"; +import { convertTemplateClickEventsHaveKeyEvents } from "./ruleConverters/codelyzer/template-click-events-have-key-events"; +import { convertTemplateConditionalComplexity } from "./ruleConverters/codelyzer/template-conditional-complexity"; +import { convertTemplateCyclomaticComplexity } from "./ruleConverters/codelyzer/template-cyclomatic-complexity"; +import { convertTemplateI18N } from "./ruleConverters/codelyzer/template-i18n"; +import { convertTemplateMouseEventsHaveKeyEvents } from "./ruleConverters/codelyzer/template-mouse-events-have-key-events"; +import { convertTemplateNoAny } from "./ruleConverters/codelyzer/template-no-any"; +import { convertTemplateNoAutofocus } from "./ruleConverters/codelyzer/template-no-autofocus"; +import { convertTemplateNoCallExpression } from "./ruleConverters/codelyzer/template-no-call-expression"; +import { convertTemplateNoDistractingElements } from "./ruleConverters/codelyzer/template-no-distracting-elements"; +import { convertTemplateNoNegatedAsync } from "./ruleConverters/codelyzer/template-no-negated-async"; +import { convertTemplateUseTrackByFunction } from "./ruleConverters/codelyzer/template-use-track-by-function"; +import { convertUseComponentSelector } from "./ruleConverters/codelyzer/use-component-selector"; +import { convertUseComponentViewEncapsulation } from "./ruleConverters/codelyzer/use-component-view-encapsulation"; +import { convertUseInjectableProvidedIn } from "./ruleConverters/codelyzer/use-injectable-provided-in"; +import { convertUseLifecycleInterface } from "./ruleConverters/codelyzer/use-lifecycle-interface"; +import { convertUsePipeDecorator } from "./ruleConverters/codelyzer/use-pipe-decorator"; +import { convertUsePipeTransformInterface } from "./ruleConverters/codelyzer/use-pipe-transform-interface"; import { convertCommentFormat } from "./ruleConverters/comment-format"; import { convertCurly } from "./ruleConverters/curly"; import { convertCyclomaticComplexity } from "./ruleConverters/cyclomatic-complexity"; import { convertDeprecation } from "./ruleConverters/deprecation"; import { convertEofline } from "./ruleConverters/eofline"; +import { convertJsxBanProps } from "./ruleConverters/eslint-plugin-react/jsx-ban-props"; +import { convertJsxBooleanValue } from "./ruleConverters/eslint-plugin-react/jsx-boolean-value"; +import { convertJsxCurlySpacing } from "./ruleConverters/eslint-plugin-react/jsx-curly-spacing"; +import { convertJsxEqualsSpacing } from "./ruleConverters/eslint-plugin-react/jsx-equals-spacing"; +import { convertJsxKey } from "./ruleConverters/eslint-plugin-react/jsx-key"; +import { convertJsxNoBind } from "./ruleConverters/eslint-plugin-react/jsx-no-bind"; +import { convertJsxNoLambda } from "./ruleConverters/eslint-plugin-react/jsx-no-lambda"; +import { convertJsxSelfClose } from "./ruleConverters/eslint-plugin-react/jsx-self-close"; +import { convertJsxSpaceBeforeTrailingSlash } from "./ruleConverters/eslint-plugin-react/jsx-space-before-trailing-slash"; +import { convertJsxWrapMultiline } from "./ruleConverters/eslint-plugin-react/jsx-wrap-multiline"; +import { convertNoAsyncSubscribe } from "./ruleConverters/eslint-plugin-rxjs/no-async-subscribe"; +import { convertNoCreate } from "./ruleConverters/eslint-plugin-rxjs/no-create"; +import { convertNoExposedSubjects } from "./ruleConverters/eslint-plugin-rxjs/no-exposed-subjects"; +import { convertNoFinnish } from "./ruleConverters/eslint-plugin-rxjs/no-finnish"; +import { convertNoIgnoredNotifier } from "./ruleConverters/eslint-plugin-rxjs/no-ignored-notifier"; +import { convertNoIgnoredReplayBuffer } from "./ruleConverters/eslint-plugin-rxjs/no-ignored-replay-buffer"; +import { convertNoIgnoredSubscription } from "./ruleConverters/eslint-plugin-rxjs/no-ignored-subscription"; +import { convertNoIgnoredTakeWhileValue } from "./ruleConverters/eslint-plugin-rxjs/no-ignored-takewhile-value"; +import { convertNoImplicitAnyCatch } from "./ruleConverters/eslint-plugin-rxjs/no-implicit-any-catch"; +import { convertNoIndex } from "./ruleConverters/eslint-plugin-rxjs/no-index"; +import { convertNoInternal } from "./ruleConverters/eslint-plugin-rxjs/no-internal"; +import { convertNoNestedSubscribe } from "./ruleConverters/eslint-plugin-rxjs/no-nested-subscribe"; +import { convertNoRedundantNotify } from "./ruleConverters/eslint-plugin-rxjs/no-redundant-notify"; +import { convertNoShareReplay } from "./ruleConverters/eslint-plugin-rxjs/no-sharereplay"; +import { convertNoSubjectUnubscribe } from "./ruleConverters/eslint-plugin-rxjs/no-subject-unsubscribe"; +import { convertNoSubjectValue } from "./ruleConverters/eslint-plugin-rxjs/no-subject-value"; +import { convertNoUnboundMethods } from "./ruleConverters/eslint-plugin-rxjs/no-unbound-methods"; +import { convertNoUnsafeSubjectNext } from "./ruleConverters/eslint-plugin-rxjs/no-unsafe-subject-next"; +import { convertNoUnsafeTakeUntil } from "./ruleConverters/eslint-plugin-rxjs/no-unsafe-takeuntil"; +import { convertCognitiveComplexity } from "./ruleConverters/eslint-plugin-sonarjs/cognitive-complexity"; +import { convertConsecutiveOverloads } from "./ruleConverters/eslint-plugin-sonarjs/consecutive-overloads"; +import { convertMaxSwitchCases } from "./ruleConverters/eslint-plugin-sonarjs/max-switch-cases"; +import { convertNoAllDuplicatedBranches } from "./ruleConverters/eslint-plugin-sonarjs/no-all-duplicated-branches"; +import { convertNoAlphabeticalSort } from "./ruleConverters/eslint-plugin-sonarjs/no-alphabetical-sort"; +import { convertNoBigFunction } from "./ruleConverters/eslint-plugin-sonarjs/no-big-function"; +import { convertNoCollapsibleIf } from "./ruleConverters/eslint-plugin-sonarjs/no-collapsible-if"; +import { convertNoCollectionSizeMischeck } from "./ruleConverters/eslint-plugin-sonarjs/no-collection-size-mischeck"; +import { convertNoDuplicateString } from "./ruleConverters/eslint-plugin-sonarjs/no-duplicate-string"; +import { convertNoDuplicatedBranches } from "./ruleConverters/eslint-plugin-sonarjs/no-duplicated-branches"; +import { convertNoElementOverwrite } from "./ruleConverters/eslint-plugin-sonarjs/no-element-overwrite"; +import { convertNoEmptyDestructuring } from "./ruleConverters/eslint-plugin-sonarjs/no-empty-destructuring"; +import { convertNoEmptyNestedBlocks } from "./ruleConverters/eslint-plugin-sonarjs/no-empty-nested-blocks"; +import { convertNoExtraSemicolon } from "./ruleConverters/eslint-plugin-sonarjs/no-extra-semicolon"; +import { convertNoIdenticalConditions } from "./ruleConverters/eslint-plugin-sonarjs/no-identical-conditions"; +import { convertNoIdenticalExpressions } from "./ruleConverters/eslint-plugin-sonarjs/no-identical-expressions"; +import { convertNoIdenticalFunctions } from "./ruleConverters/eslint-plugin-sonarjs/no-identical-functions"; +import { convertNoInMisuse } from "./ruleConverters/eslint-plugin-sonarjs/no-in-misuse"; +import { convertNoInvalidAwait } from "./ruleConverters/eslint-plugin-sonarjs/no-invalid-await"; +import { convertNoInvertedBooleanCheck } from "./ruleConverters/eslint-plugin-sonarjs/no-inverted-boolean-check"; +import { convertNoMultilineStringLiterals } from "./ruleConverters/eslint-plugin-sonarjs/no-multiline-string-literals"; +import { convertNoRedundantBoolean } from "./ruleConverters/eslint-plugin-sonarjs/no-redundant-boolean"; +import { convertNoRedundantJump } from "./ruleConverters/eslint-plugin-sonarjs/no-redundant-jump"; +import { convertNoRedundantParentheses } from "./ruleConverters/eslint-plugin-sonarjs/no-redundant-parentheses"; +import { convertNoSameLineConditional } from "./ruleConverters/eslint-plugin-sonarjs/no-same-line-conditional"; +import { convertNoSelfAssignment } from "./ruleConverters/eslint-plugin-sonarjs/no-self-assignment"; +import { convertNoSmallSwitch } from "./ruleConverters/eslint-plugin-sonarjs/no-small-switch"; +import { convertNoUnconditionalJump } from "./ruleConverters/eslint-plugin-sonarjs/no-unconditional-jump"; +import { convertNoUnusedArray } from "./ruleConverters/eslint-plugin-sonarjs/no-unused-array"; +import { convertNoUseOfEmptyReturnValue } from "./ruleConverters/eslint-plugin-sonarjs/no-use-of-empty-return-value"; +import { convertNoUselessCast } from "./ruleConverters/eslint-plugin-sonarjs/no-useless-cast"; +import { convertNoUselessCatch } from "./ruleConverters/eslint-plugin-sonarjs/no-useless-catch"; +import { convertNoVariableUsageBeforeDeclaration } from "./ruleConverters/eslint-plugin-sonarjs/no-variable-usage-before-declaration"; +import { convertParametersMaxNumber } from "./ruleConverters/eslint-plugin-sonarjs/parameters-max-number"; +import { convertPreferDefaultLast } from "./ruleConverters/eslint-plugin-sonarjs/prefer-default-last"; +import { convertPreferImmediateReturn } from "./ruleConverters/eslint-plugin-sonarjs/prefer-immediate-return"; +import { convertUsePrimitiveType } from "./ruleConverters/eslint-plugin-sonarjs/use-primitive-type"; import { convertFileNameCasing } from "./ruleConverters/file-name-casing"; import { convertForin } from "./ruleConverters/forin"; import { convertFunctionConstructor } from "./ruleConverters/function-constructor"; @@ -27,15 +142,15 @@ import { convertJSDocFormat } from "./ruleConverters/jsdoc-format"; import { convertLabelPosition } from "./ruleConverters/label-position"; import { convertLinebreakStyle } from "./ruleConverters/linebreak-style"; import { convertMaxClassesPerFile } from "./ruleConverters/max-classes-per-file"; -import { convertMaxFuncBodyLength } from "./ruleConverters/max-func-body-length"; import { convertMaxFileLineCount } from "./ruleConverters/max-file-line-count"; +import { convertMaxFuncBodyLength } from "./ruleConverters/max-func-body-length"; import { convertMaxLineLength } from "./ruleConverters/max-line-length"; import { convertMemberAccess } from "./ruleConverters/member-access"; import { convertMemberOrdering } from "./ruleConverters/member-ordering"; import { convertMochaAvoidOnly } from "./ruleConverters/mocha-avoid-only"; +import { convertNewParens } from "./ruleConverters/new-parens"; import { convertNewlineBeforeReturn } from "./ruleConverters/newline-before-return"; import { convertNewlinePerChainedCall } from "./ruleConverters/newline-per-chained-call"; -import { convertNewParens } from "./ruleConverters/new-parens"; import { convertNoAngleBracketTypeAssertion } from "./ruleConverters/no-angle-bracket-type-assertion"; import { convertNoArg } from "./ruleConverters/no-arg"; import { convertNoAsyncWithoutAwait } from "./ruleConverters/no-async-without-await"; @@ -137,8 +252,8 @@ import { convertStrictBooleanExpressions } from "./ruleConverters/strict-boolean import { convertSwitchDefault } from "./ruleConverters/switch-default"; import { convertTrailingComma } from "./ruleConverters/trailing-comma"; import { convertTripleEquals } from "./ruleConverters/triple-equals"; -import { convertTypedefWhitespace } from "./ruleConverters/typedef-whitespace"; import { convertTypeLiteralDelimiter } from "./ruleConverters/type-literal-delimiter"; +import { convertTypedefWhitespace } from "./ruleConverters/typedef-whitespace"; import { convertTypeofCompare } from "./ruleConverters/typeof-compare"; import { convertUnderscoreConsistentInvocation } from "./ruleConverters/underscore-consistent-invocation"; import { convertUnifiedSignatures } from "./ruleConverters/unified-signatures"; @@ -148,129 +263,6 @@ import { convertUseDefaultTypeParameter } from "./ruleConverters/use-default-typ import { convertUseIsnan } from "./ruleConverters/use-isnan"; import { convertVariableName } from "./ruleConverters/variable-name"; -// Codelyzer converters -import { convertComponentClassSuffix } from "./ruleConverters/codelyzer/component-class-suffix"; -import { convertComponentMaxInlineDeclarations } from "./ruleConverters/codelyzer/component-max-inline-declarations"; -import { convertComponentSelector } from "./ruleConverters/codelyzer/component-selector"; -import { convertContextualLifecycle } from "./ruleConverters/codelyzer/contextual-lifecycle"; -import { convertContextualDecorator } from "./ruleConverters/codelyzer/contextual-decorator"; -import { convertDirectiveClassSuffix } from "./ruleConverters/codelyzer/directive-class-suffix"; -import { convertDirectiveSelector } from "./ruleConverters/codelyzer/directive-selector"; -import { convertNoAttributeDecorator } from "./ruleConverters/codelyzer/no-attribute-decorator"; -import { convertNoConflictingLifecycle } from "./ruleConverters/codelyzer/no-conflicting-lifecycle"; -import { convertNoForwardRef } from "./ruleConverters/codelyzer/no-forward-ref"; -import { convertNoHostMetadataProperty } from "./ruleConverters/codelyzer/no-host-metadata-property"; -import { convertNoInputPrefix } from "./ruleConverters/codelyzer/no-input-prefix"; -import { convertNoInputRename } from "./ruleConverters/codelyzer/no-input-rename"; -import { convertNoInputsMetadataProperty } from "./ruleConverters/codelyzer/no-inputs-metadata-property"; -import { convertNoLifecycleCall } from "./ruleConverters/codelyzer/no-lifecycle-call"; -import { convertNoOutputNative } from "./ruleConverters/codelyzer/no-output-native"; -import { convertNoOutputOnPrefix } from "./ruleConverters/codelyzer/no-output-on-prefix"; -import { convertNoOutputRename } from "./ruleConverters/codelyzer/no-output-rename"; -import { convertNoOutputsMetadataProperty } from "./ruleConverters/codelyzer/no-outputs-metadata-property"; -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 { 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"; -import { convertTemplateAccessibilityAltText } from "./ruleConverters/codelyzer/template-accessibility-alt-text"; -import { convertTemplateAccessibilityElementsContent } from "./ruleConverters/codelyzer/template-accessibility-elements-content"; -import { convertTemplateAccessibilityLabelFor } from "./ruleConverters/codelyzer/template-accessibility-label-for"; -import { convertTemplateAccessibilityTabindexNoPositive } from "./ruleConverters/codelyzer/template-accessibility-tabindex-no-positive"; -import { convertTemplateAccessibilityTableScope } from "./ruleConverters/codelyzer/template-accessibility-table-scope"; -import { convertTemplateAccessibilityValidAria } from "./ruleConverters/codelyzer/template-accessibility-valid-aria"; -import { convertTemplateBananaInBox } from "./ruleConverters/codelyzer/template-banana-in-box"; -import { convertTemplateClickEventsHaveKeyEvents } from "./ruleConverters/codelyzer/template-click-events-have-key-events"; -import { convertTemplateConditionalComplexity } from "./ruleConverters/codelyzer/template-conditional-complexity"; -import { convertTemplateCyclomaticComplexity } from "./ruleConverters/codelyzer/template-cyclomatic-complexity"; -import { convertTemplateI18N } from "./ruleConverters/codelyzer/template-i18n"; -import { convertTemplateMouseEventsHaveKeyEvents } from "./ruleConverters/codelyzer/template-mouse-events-have-key-events"; -import { convertTemplateNoAny } from "./ruleConverters/codelyzer/template-no-any"; -import { convertTemplateNoAutofocus } from "./ruleConverters/codelyzer/template-no-autofocus"; -import { convertTemplateNoCallExpression } from "./ruleConverters/codelyzer/template-no-call-expression"; -import { convertTemplateNoDistractingElements } from "./ruleConverters/codelyzer/template-no-distracting-elements"; -import { convertTemplateNoNegatedAsync } from "./ruleConverters/codelyzer/template-no-negated-async"; -import { convertTemplateUseTrackByFunction } from "./ruleConverters/codelyzer/template-use-track-by-function"; -import { convertUseComponentSelector } from "./ruleConverters/codelyzer/use-component-selector"; -import { convertUseComponentViewEncapsulation } from "./ruleConverters/codelyzer/use-component-view-encapsulation"; -import { convertUseInjectableProvidedIn } from "./ruleConverters/codelyzer/use-injectable-provided-in"; -import { convertUseLifecycleInterface } from "./ruleConverters/codelyzer/use-lifecycle-interface"; -import { convertUsePipeDecorator } from "./ruleConverters/codelyzer/use-pipe-decorator"; -import { convertUsePipeTransformInterface } from "./ruleConverters/codelyzer/use-pipe-transform-interface"; - -// ESLint-React converters -import { convertJsxBanProps } from "./ruleConverters/eslint-plugin-react/jsx-ban-props"; -import { convertJsxBooleanValue } from "./ruleConverters/eslint-plugin-react/jsx-boolean-value"; -import { convertJsxCurlySpacing } from "./ruleConverters/eslint-plugin-react/jsx-curly-spacing"; -import { convertJsxEqualsSpacing } from "./ruleConverters/eslint-plugin-react/jsx-equals-spacing"; -import { convertJsxKey } from "./ruleConverters/eslint-plugin-react/jsx-key"; -import { convertJsxSpaceBeforeTrailingSlash } from "./ruleConverters/eslint-plugin-react/jsx-space-before-trailing-slash"; -import { convertJsxNoBind } from "./ruleConverters/eslint-plugin-react/jsx-no-bind"; -import { convertJsxNoLambda } from "./ruleConverters/eslint-plugin-react/jsx-no-lambda"; -import { convertJsxSelfClose } from "./ruleConverters/eslint-plugin-react/jsx-self-close"; -import { convertJsxWrapMultiline } from "./ruleConverters/eslint-plugin-react/jsx-wrap-multiline"; - -// eslint-plugin-rxjs converters -import { convertNoAsyncSubscribe } from "./ruleConverters/eslint-plugin-rxjs/no-async-subscribe"; -import { convertNoImplicitAnyCatch } from "./ruleConverters/eslint-plugin-rxjs/no-implicit-any-catch"; -import { convertNoCreate } from "./ruleConverters/eslint-plugin-rxjs/no-create"; -import { convertNoExposedSubjects } from "./ruleConverters/eslint-plugin-rxjs/no-exposed-subjects"; -import { convertNoFinnish } from "./ruleConverters/eslint-plugin-rxjs/no-finnish"; -import { convertNoIgnoredNotifier } from "./ruleConverters/eslint-plugin-rxjs/no-ignored-notifier"; -import { convertNoIgnoredReplayBuffer } from "./ruleConverters/eslint-plugin-rxjs/no-ignored-replay-buffer"; -import { convertNoIgnoredSubscription } from "./ruleConverters/eslint-plugin-rxjs/no-ignored-subscription"; -import { convertNoIgnoredTakeWhileValue } from "./ruleConverters/eslint-plugin-rxjs/no-ignored-takewhile-value"; -import { convertNoIndex } from "./ruleConverters/eslint-plugin-rxjs/no-index"; -import { convertNoInternal } from "./ruleConverters/eslint-plugin-rxjs/no-internal"; -import { convertNoNestedSubscribe } from "./ruleConverters/eslint-plugin-rxjs/no-nested-subscribe"; -import { convertNoRedundantNotify } from "./ruleConverters/eslint-plugin-rxjs/no-redundant-notify"; -import { convertNoShareReplay } from "./ruleConverters/eslint-plugin-rxjs/no-sharereplay"; -import { convertNoSubjectUnubscribe } from "./ruleConverters/eslint-plugin-rxjs/no-subject-unsubscribe"; -import { convertNoSubjectValue } from "./ruleConverters/eslint-plugin-rxjs/no-subject-value"; -import { convertNoUnboundMethods } from "./ruleConverters/eslint-plugin-rxjs/no-unbound-methods"; -import { convertNoUnsafeSubjectNext } from "./ruleConverters/eslint-plugin-rxjs/no-unsafe-subject-next"; -import { convertNoUnsafeTakeUntil } from "./ruleConverters/eslint-plugin-rxjs/no-unsafe-takeuntil"; - -// eslint-plugin-sonarjs converters -import { convertCognitiveComplexity } from "./ruleConverters/eslint-plugin-sonarjs/cognitive-complexity"; -import { convertConsecutiveOverloads } from "./ruleConverters/eslint-plugin-sonarjs/consecutive-overloads"; -import { convertMaxSwitchCases } from "./ruleConverters/eslint-plugin-sonarjs/max-switch-cases"; -import { convertNoAllDuplicatedBranches } from "./ruleConverters/eslint-plugin-sonarjs/no-all-duplicated-branches"; -import { convertNoAlphabeticalSort } from "./ruleConverters/eslint-plugin-sonarjs/no-alphabetical-sort"; -import { convertNoBigFunction } from "./ruleConverters/eslint-plugin-sonarjs/no-big-function"; -import { convertNoCollapsibleIf } from "./ruleConverters/eslint-plugin-sonarjs/no-collapsible-if"; -import { convertNoCollectionSizeMischeck } from "./ruleConverters/eslint-plugin-sonarjs/no-collection-size-mischeck"; -import { convertNoDuplicateString } from "./ruleConverters/eslint-plugin-sonarjs/no-duplicate-string"; -import { convertNoDuplicatedBranches } from "./ruleConverters/eslint-plugin-sonarjs/no-duplicated-branches"; -import { convertNoElementOverwrite } from "./ruleConverters/eslint-plugin-sonarjs/no-element-overwrite"; -import { convertNoEmptyDestructuring } from "./ruleConverters/eslint-plugin-sonarjs/no-empty-destructuring"; -import { convertNoEmptyNestedBlocks } from "./ruleConverters/eslint-plugin-sonarjs/no-empty-nested-blocks"; -import { convertNoExtraSemicolon } from "./ruleConverters/eslint-plugin-sonarjs/no-extra-semicolon"; -import { convertNoIdenticalConditions } from "./ruleConverters/eslint-plugin-sonarjs/no-identical-conditions"; -import { convertNoIdenticalExpressions } from "./ruleConverters/eslint-plugin-sonarjs/no-identical-expressions"; -import { convertNoIdenticalFunctions } from "./ruleConverters/eslint-plugin-sonarjs/no-identical-functions"; -import { convertNoInMisuse } from "./ruleConverters/eslint-plugin-sonarjs/no-in-misuse"; -import { convertNoInvalidAwait } from "./ruleConverters/eslint-plugin-sonarjs/no-invalid-await"; -import { convertNoInvertedBooleanCheck } from "./ruleConverters/eslint-plugin-sonarjs/no-inverted-boolean-check"; -import { convertNoMultilineStringLiterals } from "./ruleConverters/eslint-plugin-sonarjs/no-multiline-string-literals"; -import { convertNoRedundantBoolean } from "./ruleConverters/eslint-plugin-sonarjs/no-redundant-boolean"; -import { convertNoRedundantJump } from "./ruleConverters/eslint-plugin-sonarjs/no-redundant-jump"; -import { convertNoRedundantParentheses } from "./ruleConverters/eslint-plugin-sonarjs/no-redundant-parentheses"; -import { convertNoSameLineConditional } from "./ruleConverters/eslint-plugin-sonarjs/no-same-line-conditional"; -import { convertNoSelfAssignment } from "./ruleConverters/eslint-plugin-sonarjs/no-self-assignment"; -import { convertNoSmallSwitch } from "./ruleConverters/eslint-plugin-sonarjs/no-small-switch"; -import { convertNoUnconditionalJump } from "./ruleConverters/eslint-plugin-sonarjs/no-unconditional-jump"; -import { convertNoUnusedArray } from "./ruleConverters/eslint-plugin-sonarjs/no-unused-array"; -import { convertNoUseOfEmptyReturnValue } from "./ruleConverters/eslint-plugin-sonarjs/no-use-of-empty-return-value"; -import { convertNoUselessCast } from "./ruleConverters/eslint-plugin-sonarjs/no-useless-cast"; -import { convertNoUselessCatch } from "./ruleConverters/eslint-plugin-sonarjs/no-useless-catch"; -import { convertNoVariableUsageBeforeDeclaration } from "./ruleConverters/eslint-plugin-sonarjs/no-variable-usage-before-declaration"; -import { convertParametersMaxNumber } from "./ruleConverters/eslint-plugin-sonarjs/parameters-max-number"; -import { convertPreferDefaultLast } from "./ruleConverters/eslint-plugin-sonarjs/prefer-default-last"; -import { convertPreferImmediateReturn } from "./ruleConverters/eslint-plugin-sonarjs/prefer-immediate-return"; -import { convertUsePrimitiveType } from "./ruleConverters/eslint-plugin-sonarjs/use-primitive-type"; - /** * Keys TSLint rule names to their ESLint rule converters. */ @@ -293,8 +285,8 @@ export const ruleConverters = new Map([ ["component-max-inline-declarations", convertComponentMaxInlineDeclarations], ["component-selector", convertComponentSelector], ["consecutive-overloads", convertConsecutiveOverloads], - ["contextual-lifecycle", convertContextualLifecycle], ["contextual-decorator", convertContextualDecorator], + ["contextual-lifecycle", convertContextualLifecycle], ["curly", convertCurly], ["cyclomatic-complexity", convertCyclomaticComplexity], ["deprecation", convertDeprecation], @@ -323,8 +315,8 @@ export const ruleConverters = new Map([ ["label-position", convertLabelPosition], ["linebreak-style", convertLinebreakStyle], ["max-classes-per-file", convertMaxClassesPerFile], - ["max-func-body-length", convertMaxFuncBodyLength], ["max-file-line-count", convertMaxFileLineCount], + ["max-func-body-length", convertMaxFuncBodyLength], ["max-line-length", convertMaxLineLength], ["max-switch-cases", convertMaxSwitchCases], ["member-access", convertMemberAccess], @@ -366,7 +358,7 @@ export const ruleConverters = new Map([ ["no-element-overwrite", convertNoElementOverwrite], ["no-empty-destructuring", convertNoEmptyDestructuring], ["no-empty-interface", convertNoEmptyInterface], - ["no-empty-line-after-opening-brace", convertNoEmptyLineAfterOpeningBrace], // padded-blocks + ["no-empty-line-after-opening-brace", convertNoEmptyLineAfterOpeningBrace], ["no-empty-nested-blocks", convertNoEmptyNestedBlocks], ["no-empty", convertNoEmpty], ["no-eval", convertNoEval], @@ -396,15 +388,14 @@ export const ruleConverters = new Map([ ["no-lifecycle-call", convertNoLifecycleCall], ["no-magic-numbers", convertNoMagicNumbers], ["no-misused-new", convertNoMisusedNew], - ["no-multiline-string", convertNoMultilineString], ["no-multiline-string-literals", convertNoMultilineStringLiterals], + ["no-multiline-string", convertNoMultilineString], ["no-namespace", convertNoNamespace], ["no-non-null-assertion", convertNoNonNullAssertion], ["no-null-keyword", convertNoNullKeyword], ["no-object-literal-type-assertion", convertNoObjectLiteralTypeAssertion], ["no-octal-literal", convertNoOctalLiteral], ["no-output-native", convertNoOutputNative], - ["no-output-native", convertNoOutputNative], ["no-output-on-prefix", convertNoOutputOnPrefix], ["no-output-rename", convertNoOutputRename], ["no-outputs-metadata-property", convertNoOutputsMetadataProperty], @@ -413,8 +404,8 @@ export const ruleConverters = new Map([ ["no-pipe-impure", convertNoPipeImpure], ["no-queries-metadata-property", convertNoQueriesMetadataProperty], ["no-redundant-boolean", convertNoRedundantBoolean], - ["no-redundant-jump", convertNoRedundantJump], ["no-redundant-jsdoc", convertNoRedundantJsdoc], + ["no-redundant-jump", convertNoRedundantJump], ["no-redundant-parentheses", convertNoRedundantParentheses], ["no-reference-import", convertNoReferenceImport], ["no-reference", convertNoReference], @@ -440,8 +431,8 @@ export const ruleConverters = new Map([ ["no-unnecessary-qualifier", convertNoUnnecessaryQualifier], ["no-unnecessary-semicolons", convertNoUnnecessarySemicolons], ["no-unnecessary-type-assertion", convertNoUnnecessaryTypeAssertion], - ["no-unused-array", convertNoUnusedArray], ["no-unsafe-finally", convertNoUnsafeFinally], + ["no-unused-array", convertNoUnusedArray], ["no-unused-expression", convertNoUnusedExpression], ["no-unused-variable", convertNoUnusedVariable], ["no-use-before-declare", convertNoUseBeforeDeclare], @@ -479,6 +470,25 @@ export const ruleConverters = new Map([ ["radix", convertRadix], ["relative-url-prefix", convertRelativeUrlPrefix], ["restrict-plus-operands", convertRestrictPlusOperands], + ["rxjs-no-async-subscribe", convertNoAsyncSubscribe], + ["rxjs-no-create", convertNoCreate], + ["rxjs-no-exposed-subjects", convertNoExposedSubjects], + ["rxjs-no-finnish", convertNoFinnish], + ["rxjs-no-ignored-notifier", convertNoIgnoredNotifier], + ["rxjs-no-ignored-replay-buffer", convertNoIgnoredReplayBuffer], + ["rxjs-no-ignored-subscription", convertNoIgnoredSubscription], + ["rxjs-no-ignored-takewhile-value", convertNoIgnoredTakeWhileValue], + ["rxjs-no-implicit-any-catch", convertNoImplicitAnyCatch], + ["rxjs-no-index", convertNoIndex], + ["rxjs-no-internal", convertNoInternal], + ["rxjs-no-nested-subscribe", convertNoNestedSubscribe], + ["rxjs-no-redundant-notify", convertNoRedundantNotify], + ["rxjs-no-sharereplay", convertNoShareReplay], + ["rxjs-no-subject-unsubscribe", convertNoSubjectUnubscribe], + ["rxjs-no-subject-value", convertNoSubjectValue], + ["rxjs-no-unbound-methods", convertNoUnboundMethods], + ["rxjs-no-unsafe-subject-next", convertNoUnsafeSubjectNext], + ["rxjs-no-unsafe-takeuntil", convertNoUnsafeTakeUntil], ["semicolon", convertSemicolon], ["space-before-function-paren", convertSpaceBeforeFunctionParen], ["space-within-parens", convertSpaceWithinParens], @@ -491,8 +501,8 @@ export const ruleConverters = new Map([ ["template-accessibility-table-scope", convertTemplateAccessibilityTableScope], ["template-accessibility-valid-aria", convertTemplateAccessibilityValidAria], ["template-banana-in-box", convertTemplateBananaInBox], - ["template-conditional-complexity", convertTemplateConditionalComplexity], ["template-click-events-have-key-events", convertTemplateClickEventsHaveKeyEvents], + ["template-conditional-complexity", convertTemplateConditionalComplexity], ["template-cyclomatic-complexity", convertTemplateCyclomaticComplexity], ["template-i18n", convertTemplateI18N], ["template-mouse-events-have-key-events", convertTemplateMouseEventsHaveKeyEvents], @@ -521,36 +531,4 @@ export const ruleConverters = new Map([ ["use-pipe-transform-interface", convertUsePipeTransformInterface], ["use-primitive-type", convertUsePrimitiveType], ["variable-name", convertVariableName], - ["rxjs-no-async-subscribe", convertNoAsyncSubscribe], - ["rxjs-no-implicit-any-catch", convertNoImplicitAnyCatch], - ["rxjs-no-create", convertNoCreate], - ["rxjs-no-exposed-subjects", convertNoExposedSubjects], - ["rxjs-no-finnish", convertNoFinnish], - ["rxjs-no-ignored-notifier", convertNoIgnoredNotifier], - ["rxjs-no-ignored-replay-buffer", convertNoIgnoredReplayBuffer], - ["rxjs-no-ignored-subscription", convertNoIgnoredSubscription], - ["rxjs-no-ignored-takewhile-value", convertNoIgnoredTakeWhileValue], - ["rxjs-no-index", convertNoIndex], - ["rxjs-no-internal", convertNoInternal], - ["rxjs-no-nested-subscribe", convertNoNestedSubscribe], - ["rxjs-no-redundant-notify", convertNoRedundantNotify], - ["rxjs-no-sharereplay", convertNoShareReplay], - ["rxjs-no-subject-unsubscribe", convertNoSubjectUnubscribe], - ["rxjs-no-subject-value", convertNoSubjectValue], - ["rxjs-no-unbound-methods", convertNoUnboundMethods], - ["rxjs-no-unsafe-subject-next", convertNoUnsafeSubjectNext], - ["rxjs-no-unsafe-takeuntil", convertNoUnsafeTakeUntil], - - // These converters are all for rules that need more complex option conversions. - // Some of them will likely need to have notices about changed lint behaviors... - // If you're willing to take on that work, that'd be great! Please send PRs! 💖 - // As these are enabled, they should be added in sorted order to the list above. - - // TSLint core rules: - // ["ban", convertBan], // no-restricted-properties - - // tslint-microsoft-contrib rules: - // ["max-func-body-length", convertMaxFuncBodyLength], - // ["no-function-expression", convertNoFunctionExpression], // ban-syntax config - // ["no-suspicious-comment", convertNoSuspiciousComment], ]); diff --git a/src/converters/lintConfigs/rules/ruleConverters/codelyzer/template-i18n.ts b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/template-i18n.ts index f4e2868a5..ca644281f 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/codelyzer/template-i18n.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/codelyzer/template-i18n.ts @@ -8,7 +8,9 @@ export const convertTemplateI18N: RuleConverter = (tslintRule) => { ruleArguments: [ { ...(tslintRule.ruleArguments.includes("check-id") && { checkId: true }), - ...(tslintRule.ruleArguments.includes("check-text") && { checkText: true }), + ...(tslintRule.ruleArguments.includes("check-text") && { + checkText: true, + }), }, ], }), diff --git a/src/converters/lintConfigs/rules/ruleConverters/jsdoc-format.ts b/src/converters/lintConfigs/rules/ruleConverters/jsdoc-format.ts index f3a596319..e9c190c75 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/jsdoc-format.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/jsdoc-format.ts @@ -1,4 +1,4 @@ -import { RuleConverter, ConvertedRuleChanges } from "../ruleConverter"; +import { ConvertedRuleChanges, RuleConverter } from "../ruleConverter"; export const JSDocNoticeMsg = "ESLint does not support enforcing the first line of multiline JSDoc comments be empty."; diff --git a/src/converters/lintConfigs/rules/ruleConverters/max-func-body-length.ts b/src/converters/lintConfigs/rules/ruleConverters/max-func-body-length.ts index a4855cbb5..e0109d84e 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/max-func-body-length.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/max-func-body-length.ts @@ -11,24 +11,24 @@ const parseExtras = (ruleArguments: any[]) => { if (typeof max === "number") { return { ruleArguments: [max], - } + }; } const notices = [ - "ESLint's max-statements rule only supports a single maximum function length." + "ESLint's max-statements rule only supports a single maximum function length.", ]; if (max["ignore-comments"]) { - notices.push("ESLint's max-statements rule does not have an option to ignore comments.") + notices.push("ESLint's max-statements rule does not have an option to ignore comments."); } return { notices, ruleArguments: [ Math.max(...Object.values(max as Record).filter(isNumber)), - ] - } -} + ], + }; +}; export const convertMaxFuncBodyLength: RuleConverter = (tslintRule) => { return { diff --git a/src/converters/lintConfigs/rules/ruleConverters/no-empty-line-after-opening-brace.ts b/src/converters/lintConfigs/rules/ruleConverters/no-empty-line-after-opening-brace.ts index 664a400db..5f9592830 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/no-empty-line-after-opening-brace.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/no-empty-line-after-opening-brace.ts @@ -4,14 +4,16 @@ export const convertNoEmptyLineAfterOpeningBrace: RuleConverter = () => { return { rules: [ { - notices: ["ESLint's padded-blocks rule also bans a blank line before a closing brace."], + notices: [ + "ESLint's padded-blocks rule also bans a blank line before a closing brace.", + ], ruleArguments: [ { blocks: "never", }, { - "allowSingleLineBlocks": true, - } + allowSingleLineBlocks: true, + }, ], ruleName: "padded-blocks", }, diff --git a/src/converters/lintConfigs/rules/ruleConverters/no-suspicious-comment.ts b/src/converters/lintConfigs/rules/ruleConverters/no-suspicious-comment.ts index 13b3407b7..f63934bd1 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/no-suspicious-comment.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/no-suspicious-comment.ts @@ -5,13 +5,17 @@ export const convertNoSuspiciousComment: RuleConverter = (tslintRule) => { rules: [ { ...(tslintRule.ruleArguments.length !== 0 - ? { notices: ["ESLint's no-warning-comments does not allow an array of terms to match."] } + ? { + notices: [ + "ESLint's no-warning-comments does not allow an array of terms to match.", + ], + } : {}), ruleArguments: [ { location: "anywhere", - terms: ['BUG', 'HACK', 'FIXME', 'LATER', 'LATER2', 'TODO'] - } + terms: ["BUG", "HACK", "FIXME", "LATER", "LATER2", "TODO"], + }, ], ruleName: "no-warning-comments", }, diff --git a/src/converters/lintConfigs/rules/ruleConverters/prefer-array-literal.ts b/src/converters/lintConfigs/rules/ruleConverters/prefer-array-literal.ts index 00c47ed9f..5ce656b33 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/prefer-array-literal.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/prefer-array-literal.ts @@ -5,7 +5,7 @@ export const convertPreferArrayLiteral: RuleConverter = () => { rules: [ { ruleName: "no-array-constructor", - ruleSeverity: "off" + ruleSeverity: "off", }, { ruleName: "@typescript-eslint/no-array-constructor", diff --git a/src/converters/lintConfigs/rules/ruleConverters/semicolon.ts b/src/converters/lintConfigs/rules/ruleConverters/semicolon.ts index bf113ee67..162a0b6c7 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/semicolon.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/semicolon.ts @@ -30,7 +30,9 @@ export const convertSemicolon: RuleConverter = (tslintRule) => { ruleArguments: [ { multiline: { - delimiter: getMultilineDelimiter(tslintRule.ruleArguments[0] as "always" | "never"), + delimiter: getMultilineDelimiter( + tslintRule.ruleArguments[0] as "always" | "never", + ), requireLast: true, }, singleline: { diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/arrow-return-shorthand.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/arrow-return-shorthand.test.ts index 0e4d04b1e..b84e5970d 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/arrow-return-shorthand.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/arrow-return-shorthand.test.ts @@ -1,4 +1,4 @@ -import { convertArrowReturnShorthand, ARROW_RETURN_NOTICE } from "../arrow-return-shorthand"; +import { ARROW_RETURN_NOTICE, convertArrowReturnShorthand } from "../arrow-return-shorthand"; describe(convertArrowReturnShorthand, () => { test("conversion without arguments", () => { diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/ban-ts-ignore.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/ban-ts-ignore.test.ts index 0c6c47abb..fe9c2e135 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/ban-ts-ignore.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/ban-ts-ignore.test.ts @@ -1,4 +1,4 @@ -import { convertBanTsIgnore, BAN_TS_IGNORE_NOTICE } from "../ban-ts-ignore"; +import { BAN_TS_IGNORE_NOTICE, convertBanTsIgnore } from "../ban-ts-ignore"; describe(convertBanTsIgnore, () => { test("conversion without arguments", () => { diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/comment-format.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/comment-format.test.ts index 8db2a15c8..611cb320c 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/comment-format.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/comment-format.test.ts @@ -1,4 +1,4 @@ -import { convertCommentFormat, CapitalizedIgnoreMessage } from "../comment-format"; +import { CapitalizedIgnoreMessage, convertCommentFormat } from "../comment-format"; describe(convertCommentFormat, () => { test("conversion without arguments", () => { diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/max-func-body-length.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/max-func-body-length.test.ts index ccef17684..9e6a56577 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/max-func-body-length.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/max-func-body-length.test.ts @@ -32,17 +32,19 @@ describe(convertMaxFuncBodyLength, () => { test("conversion with a max object", () => { const result = convertMaxFuncBodyLength({ - ruleArguments: [{ - "ctor-body-length": 15, - "func-body-length": 5, - }], + ruleArguments: [ + { + "ctor-body-length": 15, + "func-body-length": 5, + }, + ], }); expect(result).toEqual({ rules: [ { notices: [ - "ESLint's max-statements rule only supports a single maximum function length." + "ESLint's max-statements rule only supports a single maximum function length.", ], ruleArguments: [15], ruleName: "max-statements", @@ -53,11 +55,13 @@ describe(convertMaxFuncBodyLength, () => { test("conversion with the ignore-comments option", () => { const result = convertMaxFuncBodyLength({ - ruleArguments: [{ - "ctor-body-length": 15, - "func-body-length": 5, - "ignore-comments": true, - }], + ruleArguments: [ + { + "ctor-body-length": 15, + "func-body-length": 5, + "ignore-comments": true, + }, + ], }); expect(result).toEqual({ @@ -65,7 +69,7 @@ describe(convertMaxFuncBodyLength, () => { { notices: [ "ESLint's max-statements rule only supports a single maximum function length.", - "ESLint's max-statements rule does not have an option to ignore comments." + "ESLint's max-statements rule does not have an option to ignore comments.", ], ruleArguments: [15], ruleName: "max-statements", diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/member-access.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/member-access.test.ts index bdbabf6dc..63f4d3b79 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/member-access.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/member-access.test.ts @@ -1,4 +1,4 @@ -import { convertMemberAccess, AccessibilityLevel } from "../member-access"; +import { AccessibilityLevel, convertMemberAccess } from "../member-access"; describe(convertMemberAccess, () => { test("conversion without arguments", () => { diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/no-empty-line-after-opening-brace.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/no-empty-line-after-opening-brace.test.ts index 0940b81d5..89f372f43 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/no-empty-line-after-opening-brace.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/no-empty-line-after-opening-brace.test.ts @@ -9,14 +9,16 @@ describe(convertNoEmptyLineAfterOpeningBrace, () => { expect(result).toEqual({ rules: [ { - notices: ["ESLint's padded-blocks rule also bans a blank line before a closing brace."], + notices: [ + "ESLint's padded-blocks rule also bans a blank line before a closing brace.", + ], ruleArguments: [ { blocks: "never", }, { - "allowSingleLineBlocks": true, - } + allowSingleLineBlocks: true, + }, ], ruleName: "padded-blocks", }, diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/no-suspicious-comment.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/no-suspicious-comment.test.ts index df72076e5..d08e586e2 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/no-suspicious-comment.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/no-suspicious-comment.test.ts @@ -12,8 +12,8 @@ describe(convertNoSuspiciousComment, () => { ruleArguments: [ { location: "anywhere", - terms: ['BUG', 'HACK', 'FIXME', 'LATER', 'LATER2', 'TODO'] - } + terms: ["BUG", "HACK", "FIXME", "LATER", "LATER2", "TODO"], + }, ], ruleName: "no-warning-comments", }, @@ -29,12 +29,14 @@ describe(convertNoSuspiciousComment, () => { expect(result).toEqual({ rules: [ { - notices: ["ESLint's no-warning-comments does not allow an array of terms to match."], + notices: [ + "ESLint's no-warning-comments does not allow an array of terms to match.", + ], ruleArguments: [ { location: "anywhere", - terms: ['BUG', 'HACK', 'FIXME', 'LATER', 'LATER2', 'TODO'] - } + terms: ["BUG", "HACK", "FIXME", "LATER", "LATER2", "TODO"], + }, ], ruleName: "no-warning-comments", }, diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/one-line.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/one-line.test.ts index 5049b73e3..3653d7ebf 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/one-line.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/one-line.test.ts @@ -1,4 +1,4 @@ -import { convertOneLine, CheckAllTokensMsg } from "../one-line"; +import { CheckAllTokensMsg, convertOneLine } from "../one-line"; describe(convertOneLine, () => { test("conversion without arguments", () => { 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 index 0e48424bf..3ad8f8a24 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-array-literal.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-array-literal.test.ts @@ -10,7 +10,7 @@ describe(convertPreferArrayLiteral, () => { rules: [ { ruleName: "no-array-constructor", - ruleSeverity: "off" + ruleSeverity: "off", }, { ruleName: "@typescript-eslint/no-array-constructor", diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-conditional-expression.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-conditional-expression.test.ts index 58135b201..acde446f2 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-conditional-expression.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-conditional-expression.test.ts @@ -1,4 +1,7 @@ -import { convertPreferConditionalExpression, PREFER_CONDITIONAL_EXPRESSION_NOTICE } from "../prefer-conditional-expression"; +import { + convertPreferConditionalExpression, + PREFER_CONDITIONAL_EXPRESSION_NOTICE, +} from "../prefer-conditional-expression"; describe(convertPreferConditionalExpression, () => { test("conversion without arguments", () => { @@ -18,7 +21,7 @@ describe(convertPreferConditionalExpression, () => { test("conversion with 'check-else-if' argument", () => { const result = convertPreferConditionalExpression({ - ruleArguments: ['check-else-if'], + ruleArguments: ["check-else-if"], }); expect(result).toEqual({ @@ -31,4 +34,4 @@ describe(convertPreferConditionalExpression, () => { plugins: ["eslint-plugin-unicorn"], }); }); -}); \ No newline at end of file +}); diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-switch.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-switch.test.ts index 73d6efe20..cf542909a 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-switch.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-switch.test.ts @@ -18,7 +18,7 @@ describe(convertPreferSwitch, () => { test("conversion with 'min-cases' argument", () => { const result = convertPreferSwitch({ - ruleArguments: [{ 'min-cases': 4 }], + ruleArguments: [{ "min-cases": 4 }], }); expect(result).toEqual({ diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/underscore-consistent-invocation.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/underscore-consistent-invocation.test.ts index 8e76a5e0a..3fb86f2c7 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/underscore-consistent-invocation.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/underscore-consistent-invocation.test.ts @@ -10,7 +10,7 @@ describe(convertUnderscoreConsistentInvocation, () => { plugins: ["eslint-plugin-lodash"], rules: [ { - ruleArguments: ['never'], + ruleArguments: ["never"], ruleName: "lodash/chaining", }, ], @@ -19,14 +19,14 @@ describe(convertUnderscoreConsistentInvocation, () => { test("conversion with an instance argument", () => { const result = convertUnderscoreConsistentInvocation({ - ruleArguments: ['instance'], + ruleArguments: ["instance"], }); expect(result).toEqual({ plugins: ["eslint-plugin-lodash"], rules: [ { - ruleArguments: ['never'], + ruleArguments: ["never"], ruleName: "lodash/chaining", }, ], @@ -35,14 +35,14 @@ describe(convertUnderscoreConsistentInvocation, () => { test("conversion with a static argument", () => { const result = convertUnderscoreConsistentInvocation({ - ruleArguments: ['static'], + ruleArguments: ["static"], }); expect(result).toEqual({ plugins: ["eslint-plugin-lodash"], rules: [ { - ruleArguments: ['always', 0], + ruleArguments: ["always", 0], ruleName: "lodash/chaining", }, ], diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/variable-name.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/variable-name.test.ts index b4c62fa05..7f9297ed1 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/tests/variable-name.test.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/variable-name.test.ts @@ -1,6 +1,6 @@ import { - convertVariableName, ConstRequiredForAllCapsMsg, + convertVariableName, ForbiddenLeadingTrailingIdentifierMsg, IgnoreLeadingTrailingIdentifierMsg, } from "../variable-name"; diff --git a/src/converters/lintConfigs/rules/ruleConverters/underscore-consistent-invocation.ts b/src/converters/lintConfigs/rules/ruleConverters/underscore-consistent-invocation.ts index 9819f6f16..54fe443b1 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/underscore-consistent-invocation.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/underscore-consistent-invocation.ts @@ -5,9 +5,11 @@ export const convertUnderscoreConsistentInvocation: RuleConverter = (tslintRule) plugins: ["eslint-plugin-lodash"], rules: [ { - ruleArguments: tslintRule.ruleArguments.length === 0 || tslintRule.ruleArguments[0] === 'instance' - ? ['never'] - : ['always', 0], + ruleArguments: + tslintRule.ruleArguments.length === 0 || + tslintRule.ruleArguments[0] === "instance" + ? ["never"] + : ["always", 0], ruleName: "lodash/chaining", }, ], diff --git a/src/converters/lintConfigs/rules/ruleConverters/variable-name.ts b/src/converters/lintConfigs/rules/ruleConverters/variable-name.ts index 7981d4926..9cc300883 100644 --- a/src/converters/lintConfigs/rules/ruleConverters/variable-name.ts +++ b/src/converters/lintConfigs/rules/ruleConverters/variable-name.ts @@ -80,16 +80,16 @@ export const convertVariableName: RuleConverter = (tslintRule) => { const getBlackListRuleOptions = () => { const blackListOptionArguments = tslintRule.ruleArguments.includes("ban-keywords") ? [ - "any", - "Number", - "number", - "String", - "string", - "Boolean", - "boolean", - "Undefined", - "undefined", - ] + "any", + "Number", + "number", + "String", + "string", + "Boolean", + "boolean", + "Undefined", + "undefined", + ] : []; return { diff --git a/src/converters/lintConfigs/rules/ruleMergers.ts b/src/converters/lintConfigs/rules/ruleMergers.ts index ce6fd5f26..ff6cb3b12 100644 --- a/src/converters/lintConfigs/rules/ruleMergers.ts +++ b/src/converters/lintConfigs/rules/ruleMergers.ts @@ -1,13 +1,13 @@ import { mergeBanTypes } from "./ruleMergers/ban-types"; import { mergeConsistentTypeAssertions } from "./ruleMergers/consistent-type-assertions"; import { mergeIndent } from "./ruleMergers/indent"; +import { mergeNoMemberDelimiterStyle } from "./ruleMergers/member-delimiter-style"; import { mergeNamingConvention } from "./ruleMergers/naming-convention"; import { mergeNoEmpty } from "./ruleMergers/no-empty"; import { mergeNoEval } from "./ruleMergers/no-eval"; -import { mergeNoMemberDelimiterStyle } from "./ruleMergers/member-delimiter-style"; import { mergeNoUnnecessaryTypeAssertion } from "./ruleMergers/no-unnecessary-type-assertion"; -import { mergeTripleSlashReference } from "./ruleMergers/triple-slash-reference"; import { mergeNoUseBeforeDefine } from "./ruleMergers/no-use-before-define"; +import { mergeTripleSlashReference } from "./ruleMergers/triple-slash-reference"; export const ruleMergers = new Map([ ["@typescript-eslint/ban-types", mergeBanTypes], diff --git a/src/converters/lintConfigs/rules/ruleMergers/no-use-before-define.ts b/src/converters/lintConfigs/rules/ruleMergers/no-use-before-define.ts index c532292cd..0e7933573 100644 --- a/src/converters/lintConfigs/rules/ruleMergers/no-use-before-define.ts +++ b/src/converters/lintConfigs/rules/ruleMergers/no-use-before-define.ts @@ -1,4 +1,5 @@ import { assignWith, isObject } from "lodash"; + import { RuleMerger } from "../ruleMerger"; const NO_USE_BEFORE_DEFINE_DEFAULT_OPTS = { diff --git a/src/converters/lintConfigs/summarization/summarizePackageRules.ts b/src/converters/lintConfigs/summarization/summarizePackageRules.ts index 4f66b31be..891b6d44b 100644 --- a/src/converters/lintConfigs/summarization/summarizePackageRules.ts +++ b/src/converters/lintConfigs/summarization/summarizePackageRules.ts @@ -3,8 +3,8 @@ import { ESLintConfiguration } from "../../../input/findESLintConfiguration"; import { OriginalConfigurations } from "../../../input/findOriginalConfigurations"; import { TSLintConfiguration } from "../../../input/findTSLintConfiguration"; import { uniqueFromSources } from "../../../utils"; -import { removeExtendsDuplicatedRules } from "../pruning/removeExtendsDuplicatedRules"; import { normalizeExtensions } from "../pruning/normalizeExtensions"; +import { removeExtendsDuplicatedRules } from "../pruning/removeExtendsDuplicatedRules"; import { RuleConversionResults } from "../rules/convertRules"; import { collectTSLintRulesets } from "./collectTSLintRulesets"; import { normalizeESLintRules } from "./normalizeESLintRules"; diff --git a/src/input/findESLintConfiguration.test.ts b/src/input/findESLintConfiguration.test.ts index 01529dc8f..145a5e36b 100644 --- a/src/input/findESLintConfiguration.test.ts +++ b/src/input/findESLintConfiguration.test.ts @@ -1,9 +1,9 @@ +import { createStubExec, createStubThrowingExec } from "../adapters/exec.stubs"; +import { TSLintToESLintSettings } from "../types"; import { findESLintConfiguration, FindESLintConfigurationDependencies, } from "./findESLintConfiguration"; -import { createStubExec, createStubThrowingExec } from "../adapters/exec.stubs"; -import { TSLintToESLintSettings } from "../types"; const createStubDependencies = (overrides: Partial = {}) => ({ exec: createStubExec({ stdout: "{}" }), diff --git a/src/input/findESLintConfiguration.ts b/src/input/findESLintConfiguration.ts index 5f8139ba1..6da2b1853 100644 --- a/src/input/findESLintConfiguration.ts +++ b/src/input/findESLintConfiguration.ts @@ -3,9 +3,9 @@ import { SansDependencies } from "../binding"; import { RawESLintRuleSeverity } from "../converters/lintConfigs/rules/types"; import { ConfigurationLocations } from "../types"; import { uniqueFromSources } from "../utils"; +import { OriginalConfigurations } from "./findOriginalConfigurations"; import { findRawConfiguration } from "./findRawConfiguration"; import { findReportedConfiguration } from "./findReportedConfiguration"; -import { OriginalConfigurations } from "./findOriginalConfigurations"; import { importer } from "./importer"; export type ESLintConfiguration = { diff --git a/src/input/findOriginalConfigurations.test.ts b/src/input/findOriginalConfigurations.test.ts index f509636a2..6d9f68a79 100644 --- a/src/input/findOriginalConfigurations.test.ts +++ b/src/input/findOriginalConfigurations.test.ts @@ -1,11 +1,11 @@ +import { ResultStatus, TSLintToESLintSettings } from "../types"; +import { ESLintConfiguration } from "./findESLintConfiguration"; import { findOriginalConfigurations, FindOriginalConfigurationsDependencies, OriginalConfigurations, } from "./findOriginalConfigurations"; -import { ResultStatus, TSLintToESLintSettings } from "../types"; import { TSLintConfiguration } from "./findTSLintConfiguration"; -import { ESLintConfiguration } from "./findESLintConfiguration"; const createRawSettings = (overrides: Partial = {}) => ({ config: "./eslintrc.js", diff --git a/src/input/findOriginalConfigurations.ts b/src/input/findOriginalConfigurations.ts index b69943408..bd81bfd92 100644 --- a/src/input/findOriginalConfigurations.ts +++ b/src/input/findOriginalConfigurations.ts @@ -6,15 +6,15 @@ import { SucceededDataResult, } from "../types"; import { isDefined } from "../utils"; -import { findESLintConfiguration, ESLintConfiguration } from "./findESLintConfiguration"; -import { PackagesConfiguration, findPackagesConfiguration } from "./findPackagesConfiguration"; +import { ESLintConfiguration, findESLintConfiguration } from "./findESLintConfiguration"; +import { findPackagesConfiguration, PackagesConfiguration } from "./findPackagesConfiguration"; +import { DeepPartial } from "./findReportedConfiguration"; +import { findTSLintConfiguration, TSLintConfiguration } from "./findTSLintConfiguration"; import { findTypeScriptConfiguration, TypeScriptConfiguration, } from "./findTypeScriptConfiguration"; -import { findTSLintConfiguration, TSLintConfiguration } from "./findTSLintConfiguration"; import { mergeLintConfigurations } from "./mergeLintConfigurations"; -import { DeepPartial } from "./findReportedConfiguration"; export type FindOriginalConfigurationsDependencies = { findESLintConfiguration: SansDependencies; @@ -117,7 +117,7 @@ export const findOriginalConfigurations = async ( const getMissingPackageMessage = (error: Error) => { const match = /(Cannot find module|could not require|couldn't find the plugin) ([a-zA-Z0-9-_"'@/]+)/.exec( - error.message.split('\n').slice(0, 2).join('\n'), + error.message.split("\n").slice(0, 2).join("\n"), ); if (match === null) { return undefined; diff --git a/src/input/findPackagesConfiguration.test.ts b/src/input/findPackagesConfiguration.test.ts index e0fd95008..767227a77 100644 --- a/src/input/findPackagesConfiguration.test.ts +++ b/src/input/findPackagesConfiguration.test.ts @@ -1,5 +1,5 @@ -import { findPackagesConfiguration } from "./findPackagesConfiguration"; import { createStubExec } from "../adapters/exec.stubs"; +import { findPackagesConfiguration } from "./findPackagesConfiguration"; describe("findPackagesConfiguration", () => { it("defaults the configuration file when one isn't provided", async () => { diff --git a/src/input/findTSLintConfiguration.ts b/src/input/findTSLintConfiguration.ts index 0947a1f40..8721d2fb6 100644 --- a/src/input/findTSLintConfiguration.ts +++ b/src/input/findTSLintConfiguration.ts @@ -1,10 +1,10 @@ -import { findRawConfiguration } from "./findRawConfiguration"; -import { findReportedConfiguration } from "./findReportedConfiguration"; import { Exec } from "../adapters/exec"; import { SansDependencies } from "../binding"; +import { TSLintRuleOptions } from "../converters/lintConfigs/rules/types"; import { uniqueFromSources } from "../utils"; +import { findRawConfiguration } from "./findRawConfiguration"; +import { findReportedConfiguration } from "./findReportedConfiguration"; import { importer } from "./importer"; -import { TSLintRuleOptions } from "../converters/lintConfigs/rules/types"; export type TSLintConfiguration = { extends?: string[]; diff --git a/src/input/findTslintConfiguration.test.ts b/src/input/findTslintConfiguration.test.ts index fd6958614..463bd19a6 100644 --- a/src/input/findTslintConfiguration.test.ts +++ b/src/input/findTslintConfiguration.test.ts @@ -1,8 +1,8 @@ +import { createStubExec, createStubThrowingExec } from "../adapters/exec.stubs"; import { findTSLintConfiguration, FindTSLintConfigurationDependencies, } from "./findTSLintConfiguration"; -import { createStubExec, createStubThrowingExec } from "../adapters/exec.stubs"; const createStubDependencies = (overrides: Partial = {}) => ({ exec: createStubExec({ stdout: "{}" }), diff --git a/src/input/findTypeScriptConfiguration.test.ts b/src/input/findTypeScriptConfiguration.test.ts index befb8d3bc..69994f329 100644 --- a/src/input/findTypeScriptConfiguration.test.ts +++ b/src/input/findTypeScriptConfiguration.test.ts @@ -1,5 +1,5 @@ -import { findTypeScriptConfiguration } from "./findTypeScriptConfiguration"; import { createStubExec, createStubThrowingExec } from "../adapters/exec.stubs"; +import { findTypeScriptConfiguration } from "./findTypeScriptConfiguration"; describe("findTypeScriptConfiguration", () => { it("returns an error when one occurs", async () => { diff --git a/src/input/mergeLintConfigurations.test.ts b/src/input/mergeLintConfigurations.test.ts index a5f1219b4..fb686157e 100644 --- a/src/input/mergeLintConfigurations.test.ts +++ b/src/input/mergeLintConfigurations.test.ts @@ -1,7 +1,7 @@ -import { mergeLintConfigurations } from "./mergeLintConfigurations"; import { ESLintConfiguration } from "./findESLintConfiguration"; import { OriginalConfigurations } from "./findOriginalConfigurations"; import { TSLintConfiguration } from "./findTSLintConfiguration"; +import { mergeLintConfigurations } from "./mergeLintConfigurations"; const stubTSLintConfiguration: OriginalConfigurations = { full: { diff --git a/src/reporting.ts b/src/reporting.ts index 579ff8cf0..0c70ecf5b 100644 --- a/src/reporting.ts +++ b/src/reporting.ts @@ -2,7 +2,7 @@ import chalk from "chalk"; import { EOL } from "os"; import { Logger } from "./adapters/logger"; -import { ResultWithStatus, ResultStatus } from "./types"; +import { ResultStatus, ResultWithStatus } from "./types"; export const logErrorResult = (result: ResultWithStatus, logger: Logger) => { switch (result.status) { diff --git a/src/utils.test.ts b/src/utils.test.ts index dd1fa9795..af8068235 100644 --- a/src/utils.test.ts +++ b/src/utils.test.ts @@ -1,4 +1,4 @@ -import { isDefined, isError, uniqueFromSources, separateErrors, removeEmptyMembers } from "./utils"; +import { isDefined, isError, removeEmptyMembers, separateErrors, uniqueFromSources } from "./utils"; describe("isDefined", () => { it("returns true when the item is defined", () => {