Skip to content

Commit f34e018

Browse files
authored
style: enforce member delimiter style (#3645)
* style: enforce member delimiter style * chore: release eslint-config instead of esbuild-plugin-pnp * style: use semi for multiline types
1 parent a7519c7 commit f34e018

File tree

85 files changed

+661
-606
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+661
-606
lines changed

.eslintignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@
1414
/packages/*/bin/**
1515
/packages/*/build/**
1616
/packages/**/*fixtures*/**
17-
packages/yarnpkg-libzip/artifacts/**
17+
/packages/yarnpkg-libzip/artifacts/**
18+
19+
# Files generated by Gatsby
20+
/packages/gatsby/public/**
21+
# Files generated by TypeDoc
22+
/packages/gatsby/static/api/**

.yarn/versions/5a495b6a.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
releases:
2+
"@yarnpkg/eslint-config": minor
3+
4+
declined:
5+
- "@yarnpkg/esbuild-plugin-pnp"
6+
- "@yarnpkg/plugin-constraints"
7+
- "@yarnpkg/plugin-essentials"
8+
- "@yarnpkg/plugin-git"
9+
- "@yarnpkg/plugin-interactive-tools"
10+
- "@yarnpkg/plugin-nm"
11+
- "@yarnpkg/plugin-npm"
12+
- "@yarnpkg/plugin-npm-cli"
13+
- "@yarnpkg/plugin-patch"
14+
- "@yarnpkg/plugin-pnp"
15+
- "@yarnpkg/plugin-pnpm"
16+
- "@yarnpkg/plugin-stage"
17+
- "@yarnpkg/plugin-typescript"
18+
- "@yarnpkg/plugin-version"
19+
- "@yarnpkg/core"
20+
- "@yarnpkg/fslib"
21+
- "@yarnpkg/json-proxy"
22+
- "@yarnpkg/libui"
23+
- "@yarnpkg/nm"
24+
- "@yarnpkg/parsers"
25+
- "@yarnpkg/pnp"
26+
- "@yarnpkg/pnpify"
27+
- "@yarnpkg/sdks"
28+
- "@yarnpkg/shell"

packages/acceptance-tests/pkg-tests-core/sources/utils/tests.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export enum RequestType {
4545

4646
export type Request = {
4747
type: RequestType.Login;
48-
username: string,
48+
username: string;
4949
} | {
5050
type: RequestType.PackageInfo;
5151
scope?: string;
@@ -57,7 +57,7 @@ export type Request = {
5757
version?: string;
5858
} | {
5959
type: RequestType.Whoami;
60-
login: Login
60+
login: Login;
6161
} | {
6262
type: RequestType.Repository;
6363
} | {
@@ -229,8 +229,8 @@ export const getPackageDirectoryPath = async (
229229
};
230230

231231
const packageServerUrls: {
232-
http: string | null,
233-
https: string | null,
232+
http: string | null;
233+
https: string | null;
234234
} = {http: null, https: null};
235235

236236
export const startPackageServer = ({type}: { type: keyof typeof packageServerUrls } = {type: `http`}): Promise<string> => {
@@ -592,18 +592,18 @@ export interface PackageDriver {
592592
export type RunFunction = (
593593
{path, run, source}:
594594
{
595-
path: PortablePath,
596-
run: (...args: Array<string> | [...Array<string>, Partial<RunDriverOptions>]) => Promise<ExecResult>,
597-
source: (script: string, callDefinition?: Record<string, any>) => Promise<Record<string, any>>
595+
path: PortablePath;
596+
run: (...args: Array<string> | [...Array<string>, Partial<RunDriverOptions>]) => Promise<ExecResult>;
597+
source: (script: string, callDefinition?: Record<string, any>) => Promise<Record<string, any>>;
598598
}
599599
) => void;
600600

601601
export const generatePkgDriver = ({
602602
getName,
603603
runDriver,
604604
}: {
605-
getName: () => string,
606-
runDriver: PackageRunDriver,
605+
getName: () => string;
606+
runDriver: PackageRunDriver;
607607
}): PackageDriver => {
608608
const withConfig = (definition: Record<string, any>): PackageDriver => {
609609
const makeTemporaryEnv: PackageDriver = (packageJson, subDefinition, fn) => {

packages/acceptance-tests/pkg-tests-specs/sources/exports.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export async function writeTestPackage(path: PortablePath, manifest: Manifest, f
2020
}
2121

2222
export type Assertions = {
23-
pass?: Array<[/*request: */string, /*resolved: */string]>,
24-
fail?: Array<[/*request: */string, /*error: */string | {message: string, code?: string, pnpCode?: string}]>,
23+
pass?: Array<[/*request: */string, /*resolved: */string]>;
24+
fail?: Array<[/*request: */string, /*error: */string | {message: string, code?: string, pnpCode?: string}]>;
2525
};
2626

2727
export function makeTemporaryExportsEnv(testPackageName: string, manifest: Omit<Manifest, 'name'>, files: Array<string>, {pass, fail}: Assertions) {

packages/esbuild-plugin-pnp/sources/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async function defaultOnLoad(args: OnLoadArgs): Promise<OnLoadResult> {
4949

5050
type OnResolveParams = {
5151
resolvedPath: string | null;
52-
watchFiles: Array<string>
52+
watchFiles: Array<string>;
5353
error?: Error;
5454
};
5555

@@ -81,11 +81,11 @@ async function defaultOnResolve(args: OnResolveArgs, {resolvedPath, error, watch
8181
}
8282

8383
export type PluginOptions = {
84-
baseDir?: string,
85-
extensions?: Array<string>,
86-
filter?: RegExp,
87-
onResolve?: (args: OnResolveArgs, params: OnResolveParams) => Promise<OnResolveResult | null>,
88-
onLoad?: (args: OnLoadArgs) => Promise<OnLoadResult>,
84+
baseDir?: string;
85+
extensions?: Array<string>;
86+
filter?: RegExp;
87+
onResolve?: (args: OnResolveArgs, params: OnResolveParams) => Promise<OnResolveResult | null>;
88+
onLoad?: (args: OnLoadArgs) => Promise<OnLoadResult>;
8989
};
9090

9191
export function pnpPlugin({

packages/eslint-config/rules/style.js

+22
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,28 @@ module.exports = {
3434
ignoredNodes: [`TSTypeParameterInstantiation`],
3535
}],
3636

37+
'@typescript-eslint/member-delimiter-style': [`error`, {
38+
multiline: {
39+
delimiter: `semi`,
40+
requireLast: true,
41+
},
42+
singleline: {
43+
requireLast: false,
44+
},
45+
overrides: {
46+
interface: {
47+
singleline: {
48+
delimiter: `semi`,
49+
},
50+
},
51+
typeLiteral: {
52+
singleline: {
53+
delimiter: `comma`,
54+
},
55+
},
56+
},
57+
}],
58+
3759
'@typescript-eslint/quotes': [`error`, `backtick`],
3860

3961
'@typescript-eslint/semi': 2,

packages/gatsby/src/types/queries.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
export type SiteMetadata = {
2-
title: string,
3-
description: string,
4-
author: string,
2+
title: string;
3+
description: string;
4+
author: string;
55
};
66

77
export type Site = {
8-
siteMetadata: SiteMetadata,
8+
siteMetadata: SiteMetadata;
99
};
1010

1111
export type Query = {
12-
site: Site,
12+
site: Site;
1313
};

packages/plugin-constraints/sources/Constraints.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ import {linkProjectToSession} from './tauModule';
1212
plLists(pl);
1313

1414
export type EnforcedDependency = {
15-
workspace: Workspace,
16-
dependencyIdent: Ident,
17-
dependencyRange: string | null,
18-
dependencyType: DependencyType,
15+
workspace: Workspace;
16+
dependencyIdent: Ident;
17+
dependencyRange: string | null;
18+
dependencyType: DependencyType;
1919
};
2020

2121
export type EnforcedField = {
22-
workspace: Workspace,
23-
fieldPath: string,
24-
fieldValue: string | null,
22+
workspace: Workspace;
23+
fieldPath: string;
24+
fieldValue: string | null;
2525
};
2626

2727
export enum DependencyType {

packages/plugin-essentials/sources/commands/entries/clipanion.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import {Cli, Definition as ClipanionDefinition} from 'clipanion';
44

55
type ExtendedDefinition = ClipanionDefinition & {
66
plugin: {
7-
name: string,
8-
isDefault: boolean,
9-
},
7+
name: string;
8+
isDefault: boolean;
9+
};
1010
};
1111

1212
// eslint-disable-next-line arca/no-default-export

packages/plugin-essentials/sources/commands/explain/peerRequirements.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ export async function explainPeerRequirements(peerRequirementsHash: string, proj
172172
const Mark = formatUtils.mark(configuration);
173173

174174
const requirements: Array<{
175-
stringifiedLocator: string,
176-
prettyLocator: string,
177-
prettyRange: string,
178-
mark: string
175+
stringifiedLocator: string;
176+
prettyLocator: string;
177+
prettyRange: string;
178+
mark: string;
179179
}> = [];
180180

181181
for (const {pkg, peerDependency} of miscUtils.sortMap(allRequesters, requester => structUtils.stringifyLocator(requester.pkg))) {

packages/plugin-essentials/sources/dedupeUtils.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import {formatUtils, structUtils, IdentHash, LocatorHash, MessageName, Fetcher,
33
import micromatch from 'micromatch';
44

55
export type Algorithm = (project: Project, patterns: Array<string>, opts: {
6-
resolver: Resolver,
7-
resolveOptions: ResolveOptions,
8-
fetcher: Fetcher,
9-
fetchOptions: FetchOptions,
6+
resolver: Resolver;
7+
resolveOptions: ResolveOptions;
8+
fetcher: Fetcher;
9+
fetchOptions: FetchOptions;
1010
}) => Promise<Array<Promise<{
11-
descriptor: Descriptor,
12-
currentPackage: Package,
13-
updatedPackage: Package,
11+
descriptor: Descriptor;
12+
currentPackage: Package;
13+
updatedPackage: Package;
1414
} | null>>>;
1515

1616
export enum Strategy {
@@ -93,10 +93,10 @@ const DEDUPE_ALGORITHMS: Record<Strategy, Algorithm> = {
9393
};
9494

9595
export type DedupeOptions = {
96-
strategy: Strategy,
97-
patterns: Array<string>,
98-
cache: Cache,
99-
report: Report,
96+
strategy: Strategy;
97+
patterns: Array<string>;
98+
cache: Cache;
99+
report: Report;
100100
};
101101

102102
export async function dedupe(project: Project, {strategy, patterns, cache, report}: DedupeOptions) {

packages/plugin-essentials/sources/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,26 @@ export interface Hooks {
5151
target: suggestUtils.Target,
5252
descriptor: Descriptor,
5353
strategies: Array<suggestUtils.Strategy>
54-
) => Promise<void>,
54+
) => Promise<void>;
5555

5656
afterWorkspaceDependencyReplacement?: (
5757
workspace: Workspace,
5858
target: suggestUtils.Target,
5959
fromDescriptor: Descriptor,
6060
toDescriptor: Descriptor,
61-
) => Promise<void>,
61+
) => Promise<void>;
6262

6363
afterWorkspaceDependencyRemoval?: (
6464
workspace: Workspace,
6565
target: suggestUtils.Target,
6666
descriptor: Descriptor,
67-
) => Promise<void>,
67+
) => Promise<void>;
6868

6969
fetchPackageInfo?: (
7070
pkg: Package,
7171
extra: Set<string>,
7272
registerData: (namespace: string, data: Array<formatUtils.Tuple> | {[key: string]: formatUtils.Tuple | undefined}) => void,
73-
) => Promise<void>,
73+
) => Promise<void>;
7474
}
7575

7676
declare module '@yarnpkg/core' {

packages/plugin-essentials/sources/suggestUtils.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ import semver
66
const WORKSPACE_PROTOCOL = `workspace:`;
77

88
export type Suggestion = {
9-
descriptor: Descriptor,
10-
name: string,
11-
reason: string,
9+
descriptor: Descriptor;
10+
name: string;
11+
reason: string;
1212
};
1313

1414
export type NullableSuggestion = {
15-
descriptor: Descriptor | null,
16-
name: string,
17-
reason: string,
15+
descriptor: Descriptor | null;
16+
name: string;
17+
reason: string;
1818
};
1919

2020
export type Results = {
21-
suggestions: Array<NullableSuggestion>,
22-
rejections: Array<Error>,
21+
suggestions: Array<NullableSuggestion>;
22+
rejections: Array<Error>;
2323
};
2424

2525
export enum Target {
@@ -72,7 +72,7 @@ export enum Strategy {
7272
CACHE = `cache`,
7373
}
7474

75-
export function getModifier(flags: {exact: boolean; caret: boolean; tilde: boolean}, project: Project): Modifier {
75+
export function getModifier(flags: {exact: boolean, caret: boolean, tilde: boolean}, project: Project): Modifier {
7676
if (flags.exact)
7777
return Modifier.EXACT;
7878
if (flags.caret)
@@ -118,8 +118,8 @@ export function makeWorkspaceDescriptor(workspace: Workspace, modifier: Modifier
118118

119119
export async function findProjectDescriptors(ident: Ident, {project, target}: {project: Project, target: Target}) {
120120
const matches: Map<DescriptorHash, {
121-
descriptor: Descriptor,
122-
locators: Array<Locator>,
121+
descriptor: Descriptor;
122+
locators: Array<Locator>;
123123
}> = new Map();
124124

125125
const getDescriptorEntry = (descriptor: Descriptor) => {

packages/plugin-git/sources/gitUtils.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ export function isGitUrl(url: string): boolean {
4646
export type RepoUrlParts = {
4747
repo: string;
4848
treeish: {
49-
protocol: TreeishProtocols | string | null,
50-
request: string,
51-
},
49+
protocol: TreeishProtocols | string | null;
50+
request: string;
51+
};
5252
extra: {
53-
[key: string]: string,
54-
},
53+
[key: string]: string;
54+
};
5555
};
5656

5757
export function splitRepoUrl(url: string): RepoUrlParts {
@@ -102,7 +102,7 @@ export function splitRepoUrl(url: string): RepoUrlParts {
102102
repo,
103103
treeish: {protocol, request},
104104
extra: extra as {
105-
[key: string]: string,
105+
[key: string]: string;
106106
},
107107
};
108108
} else {

packages/plugin-git/sources/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface Hooks {
99
current: FetchResult | null,
1010
locator: Locator,
1111
opts: FetchOptions,
12-
) => Promise<FetchResult | null>,
12+
) => Promise<FetchResult | null>;
1313
}
1414

1515
declare module '@yarnpkg/core' {

0 commit comments

Comments
 (0)