Skip to content

Commit fc5a261

Browse files
authored
chore: Fix @typescript-eslint/sort-type-constituents errors (#1718)
1 parent fe28717 commit fc5a261

20 files changed

+31
-31
lines changed

src/adapters/globAsync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import glob from "glob";
22

33
export const globAsync = async (pattern: string) => {
4-
return new Promise<string[] | Error>((resolve) => {
4+
return new Promise<Error | string[]>((resolve) => {
55
glob(pattern, (error, matches) => {
66
resolve(error ?? matches);
77
});

src/comments/collectCommentFileNames.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type CommentFileNames = {
1616

1717
export const collectCommentFileNames = async (
1818
dependencies: CollectCommentFileNamesDependencies,
19-
filePathGlobs: true | string | string[],
19+
filePathGlobs: string[] | string | true,
2020
typescriptConfiguration?: TypeScriptConfiguration,
2121
): Promise<CommentFileNames | Error> => {
2222
if (filePathGlobs === true) {

src/converters/comments/convertFileComments.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { createStubConverter } from "../lintConfigs/rules/ruleConverter.stubs";
66
import { convertFileComments, ConvertFileCommentsDependencies } from "./convertFileComments";
77

88
const createStubDependencies = (
9-
readFileResult: string | Error,
9+
readFileResult: Error | string,
1010
): ConvertFileCommentsDependencies => ({
1111
converters: new Map([
1212
["ts-a", createStubConverter(["es-a"])],

src/converters/comments/parseFileComments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export type FileComment = {
99
ruleNames: string[];
1010
};
1111

12-
export type TSLintDirective = "tslint:disable" | "tslint:disable-next-line" | "tslint:enable";
12+
export type TSLintDirective = "tslint:disable-next-line" | "tslint:disable" | "tslint:enable";
1313

1414
/**
1515
* @see https://github.com/Microsoft/TypeScript/issues/21049

src/converters/editorConfigs/converters/convertVSCodeConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const knownMissingSettings = [
1313
];
1414

1515
export const convertVSCodeConfig: EditorConfigConverter = (rawEditorSettings, settings) => {
16-
const editorSettings: Record<string, string | number | symbol> = parseJson(rawEditorSettings);
16+
const editorSettings: Record<string, number | string | symbol> = parseJson(rawEditorSettings);
1717
const missing = knownMissingSettings.filter((setting) => editorSettings[setting]);
1818

1919
const autoFixOnSave =

src/converters/lintConfigs/formatConvertedRules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const formatConvertedRules = (
77
conversionResults: RuleConversionResults,
88
tslintConfiguration: TSLintConfiguration,
99
) => {
10-
const output: Record<string, string | any[]> = {};
10+
const output: Record<string, any[] | string> = {};
1111
const sortedRuleEntries = Array.from(conversionResults.converted).sort(
1212
([ruleNameA], [ruleNameB]) => ruleNameA.localeCompare(ruleNameB),
1313
);

src/converters/lintConfigs/rules/ruleConverters/import-blacklist.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ type ESLintOptionPath = {
88
};
99
type ESLintSimpleOption = string[];
1010
type ESLintComplexOption = RequireAtLeastOne<{
11-
paths: (string | ESLintOptionPath)[];
11+
paths: (ESLintOptionPath | string)[];
1212
patterns: string[];
1313
}>;
14-
type ESLintOptions = ESLintSimpleOption | ESLintComplexOption;
14+
type ESLintOptions = ESLintComplexOption | ESLintSimpleOption;
1515

1616
const NOTICE_MATCH_PATTERNS =
1717
"ESLint and TSLint use different strategies to match patterns. TSLint uses standard regular expressions, but ESLint .gitignore spec.";

src/converters/lintConfigs/rules/ruleConverters/trailing-comma.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ type TSLintArg = {
151151
esSpecCompliant?: boolean;
152152
};
153153

154-
type TSLintArgValue = TSLintStringValue | TSLintObject;
154+
type TSLintArgValue = TSLintObject | TSLintStringValue;
155155
type TSLintObjectKey = keyof TSLintObject;
156156

157157
type TSLintObject = {
@@ -166,8 +166,8 @@ type TSLintStringValue = "always" | "never";
166166
type TSLintStringValueForObject = TSLintStringValue | "ignore";
167167

168168
// ESLint
169-
type ESLintArgValue = ESLintStringValue | ESLintObject;
170-
type ESLintStringValue = "never" | "always" | "always-multiline" | "only-multiline" | "ignore";
169+
type ESLintArgValue = ESLintObject | ESLintStringValue;
170+
type ESLintStringValue = "always-multiline" | "always" | "ignore" | "never" | "only-multiline";
171171
type ESLintObject = {
172172
arrays?: ESLintStringValue;
173173
objects?: ESLintStringValue;

src/converters/lintConfigs/rules/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* @see https://palantir.github.io/tslint/usage/configuration
55
*/
6-
export type TSLintRuleSeverity = "warning" | "error" | "off";
6+
export type TSLintRuleSeverity = "error" | "off" | "warning";
77

88
/**
99
* Rich descriptor and options for an individual TSLint rule.
@@ -19,7 +19,7 @@ export type TSLintRuleOptions = {
1919
*
2020
* @see https://eslint.org/docs/user-guide/configuring#configuring-rules
2121
*/
22-
export type ESLintRuleSeverity = "warn" | "error" | "off";
22+
export type ESLintRuleSeverity = "error" | "off" | "warn";
2323

2424
/**
2525
* Permitted severities for an ESLint rule's configuration.

src/converters/lintConfigs/summarization/resolveExtensionNames.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const resolveExtensionNames = (rawExtensionNames: string | string[]) => {
1+
export const resolveExtensionNames = (rawExtensionNames: string[] | string) => {
22
if (typeof rawExtensionNames === "string") {
33
rawExtensionNames = [rawExtensionNames];
44
}

0 commit comments

Comments
 (0)