Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: lint
  • Loading branch information
jdanil committed Jun 6, 2022
commit e7a1cbdad1c204b1278bc86706bf23a888b35db1
6 changes: 3 additions & 3 deletions packages/plugin-compat/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const PATCHES = new Map([

const plugin: Plugin<CoreHooks & PatchHooks> = {
hooks: {
registerPackageExtensions: async ({ registerPackageExtension }) => {
registerPackageExtensions: async ({registerPackageExtension}) => {
for (const [descriptorStr, extensionData] of packageExtensions) {
registerPackageExtension(structUtils.parseDescriptor(descriptorStr, true), extensionData);
}
},

getBuiltinPatch: async ({ name }) => {
getBuiltinPatch: async ({name}) => {
const TAG = `compat/`;
if (!name.startsWith(TAG))
return undefined;
Expand All @@ -31,7 +31,7 @@ const plugin: Plugin<CoreHooks & PatchHooks> = {
return typeof patch !== `undefined` ? patch : null;
},

reduceDependency: async ({ dependency }) => {
reduceDependency: async ({dependency}) => {
const patch = PATCHES.get(dependency.identHash);
if (typeof patch === `undefined`)
return dependency;
Expand Down
16 changes: 8 additions & 8 deletions packages/plugin-essentials/sources/commands/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,17 @@ export default class AddCommand extends BaseCommand {
let askedQuestions = false;

const afterWorkspaceDependencyAdditionList: Array<{
workspace: Workspace,
target: suggestUtils.Target,
descriptor: Descriptor,
strategies: Array<suggestUtils.Strategy>,
workspace: Workspace;
target: suggestUtils.Target;
descriptor: Descriptor;
strategies: Array<suggestUtils.Strategy>;
}> = [];

const afterWorkspaceDependencyReplacementList: Array<{
workspace: Workspace,
target: suggestUtils.Target,
fromDescriptor: Descriptor,
toDescriptor: Descriptor,
workspace: Workspace;
target: suggestUtils.Target;
fromDescriptor: Descriptor;
toDescriptor: Descriptor;
}> = [];

for (const [/*request*/, {suggestions}, target] of allSuggestions) {
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-essentials/sources/commands/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ export default class RemoveCommand extends BaseCommand {
let hasChanged = false;

const afterWorkspaceDependencyRemovalList: Array<{
workspace: Workspace,
target: suggestUtils.Target,
descriptor: Descriptor,
workspace: Workspace;
target: suggestUtils.Target;
descriptor: Descriptor;
}> = [];

for (const pattern of this.patterns) {
Expand Down
36 changes: 18 additions & 18 deletions packages/plugin-essentials/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ export interface Hooks {
* dependencies into the manifest and running `yarn install` won't trigger
* it.
*/
afterWorkspaceDependencyAddition?: ({ workspace, target, descriptor, strategies }: {
workspace: Workspace,
target: suggestUtils.Target,
descriptor: Descriptor,
strategies: Array<suggestUtils.Strategy>
afterWorkspaceDependencyAddition?: ({workspace, target, descriptor, strategies}: {
workspace: Workspace;
target: suggestUtils.Target;
descriptor: Descriptor;
strategies: Array<suggestUtils.Strategy>;
}) => Promise<void>;

/**
Expand All @@ -66,11 +66,11 @@ export interface Hooks {
* updating the dependencies from the manifest and running `yarn install`
* won't trigger it.
*/
afterWorkspaceDependencyReplacement?: ({ workspace, target, fromDescriptor, toDescriptor }: {
workspace: Workspace,
target: suggestUtils.Target,
fromDescriptor: Descriptor,
toDescriptor: Descriptor,
afterWorkspaceDependencyReplacement?: ({workspace, target, fromDescriptor, toDescriptor}: {
workspace: Workspace;
target: suggestUtils.Target;
fromDescriptor: Descriptor;
toDescriptor: Descriptor;
}) => Promise<void>;

/**
Expand All @@ -79,10 +79,10 @@ export interface Hooks {
* removing the dependencies from the manifest and running `yarn install`
* won't trigger it.
*/
afterWorkspaceDependencyRemoval?: ({ workspace, target, descriptor }: {
workspace: Workspace,
target: suggestUtils.Target,
descriptor: Descriptor,
afterWorkspaceDependencyRemoval?: ({workspace, target, descriptor}: {
workspace: Workspace;
target: suggestUtils.Target;
descriptor: Descriptor;
}) => Promise<void>;

/**
Expand All @@ -94,10 +94,10 @@ export interface Hooks {
* requested audit information (via `-X audit`), and call `registerData`
* with those information (retrieved dynamically) if they did.
*/
fetchPackageInfo?: ({ pkg, extra, registerData }: {
pkg: Package,
extra: Set<string>,
registerData: (namespace: string, data: Array<formatUtils.Tuple> | {[key: string]: formatUtils.Tuple | undefined}) => void,
fetchPackageInfo?: ({pkg, extra, registerData}: {
pkg: Package;
extra: Set<string>;
registerData: (namespace: string, data: Array<formatUtils.Tuple> | {[key: string]: formatUtils.Tuple | undefined}) => void;
}) => Promise<void>;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-git/sources/GitFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class GitFetcher implements Fetcher {
async downloadHosted(locator: Locator, options: FetchOptions) {
return options.project.configuration.reduceHook((hooks: Hooks) => {
return hooks.fetchHostedRepository;
}, {current: null as FetchResult | null, locator, options}, "current");
}, {current: null as FetchResult | null, locator, options}, `current`);
}

async cloneFromRemote(locator: Locator, opts: FetchOptions) {
Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-git/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export interface Hooks {
* supports downloading repository tarballs, which are more efficient than
* cloning the repository (even without its history).
*/
fetchHostedRepository?: ({ current, locator, options }: {
current: FetchResult | null,
locator: Locator,
options: FetchOptions,
fetchHostedRepository?: ({current, locator, options}: {
current: FetchResult | null;
locator: Locator;
options: FetchOptions;
}) => Promise<FetchResult | null>;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-github/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {GithubFetcher} from './GithubFetcher';

const plugin: Plugin<GitHooks> = {
hooks: {
async fetchHostedRepository({ previous, locator, options }) {
async fetchHostedRepository({previous, locator, options}) {
if (previous !== null)
return previous;

Expand Down
10 changes: 5 additions & 5 deletions packages/plugin-npm/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export interface Hooks {
* You can use this mechanism to dynamically query a CLI for the credentials for a
* specific registry.
*/
getNpmAuthenticationHeader?: ({ currentHeader, registry, configuration, ident }: {
currentHeader?: string,
registry: string,
configuration: Configuration,
ident?: Ident,
getNpmAuthenticationHeader?: ({currentHeader, registry, configuration, ident}: {
currentHeader?: string;
registry: string;
configuration: Configuration;
ident?: Ident;
}) => Promise<string | undefined>;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-npm/sources/npmHttpUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ async function getAuthenticationHeader(registry: string, {authType = AuthType.CO

const header = await configuration.reduceHook((hooks: Hooks) => {
return hooks.getNpmAuthenticationHeader;
}, {registry, configuration, ident}, "currentHeader");
}, {registry, configuration, ident}, `currentHeader`);

if (header)
return header;
Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-pack/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ export interface Hooks {
* parameter is allowed to be mutated at will, with the changes being only
* applied to the packed manifest (the original one won't be mutated).
*/
beforeWorkspacePacking?: ({ workspace, rawManifest }: {
workspace: Workspace,
rawManifest: object,
beforeWorkspacePacking?: ({workspace, rawManifest}: {
workspace: Workspace;
rawManifest: object;
}) => Promise<void> | void;
}

const DEPENDENCY_TYPES = [`dependencies`, `devDependencies`, `peerDependencies`];
const WORKSPACE_PROTOCOL = `workspace:`;

const beforeWorkspacePacking = ({ workspace, rawManifest }: { workspace: Workspace, rawManifest: any }) => {
const beforeWorkspacePacking = ({workspace, rawManifest}: { workspace: Workspace, rawManifest: any }) => {
if (rawManifest.publishConfig) {
if (rawManifest.publishConfig.type)
rawManifest.type = rawManifest.publishConfig.type;
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-pack/sources/packUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export async function genPackList(workspace: Workspace) {
project,
definePath: (path: PortablePath | null) => {
maybeRejectPath(path);
}
},
});

// All child workspaces are ignored
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-patch/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export interface Hooks {
* syntax: `patch:builtin<name>`. This is for instance how the TypeScript
* patch is automatically registered.
*/
getBuiltinPatch?: ({ project, name }: {
project: Project,
name: string,
getBuiltinPatch?: ({project, name}: {
project: Project;
name: string;
}) => Promise<string | null | void>;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-pnp/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const quotePathIfNeeded = (path: string) => {
return /\s/.test(path) ? JSON.stringify(path) : path;
};

async function setupScriptEnvironment({ project, env }: { project: Project, env: {[key: string]: string}, makePathWrapper: (name: string, argv0: string, args: Array<string>) => Promise<void> }) {
async function setupScriptEnvironment({project, env}: { project: Project, env: {[key: string]: string}, makePathWrapper: (name: string, argv0: string, args: Array<string>) => Promise<void> }) {
const pnpPath = getPnpPath(project);
let pnpRequire = `--require ${quotePathIfNeeded(npath.fromPortablePath(pnpPath.cjs))}`;

Expand All @@ -49,7 +49,7 @@ async function setupScriptEnvironment({ project, env }: { project: Project, env:
}
}

async function populateYarnPaths({ project, definePath }: { project: Project, definePath: (path: PortablePath | null) => void }) {
async function populateYarnPaths({project, definePath}: { project: Project, definePath: (path: PortablePath | null) => void }) {
const pnpPath = getPnpPath(project);
definePath(pnpPath.cjs);
definePath(pnpPath.esmLoader);
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-stage/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {PortablePath} from '@yarnpkg/fslib';
import stage from './commands/stage';

export interface Hooks {
populateYarnPaths?: ({ project, definePath }: {
project: Project,
definePath: (path: PortablePath | null) => void,
populateYarnPaths?: ({project, definePath}: {
project: Project;
definePath: (path: PortablePath | null) => void;
}) => Promise<void>;
}

Expand Down
14 changes: 7 additions & 7 deletions packages/plugin-typescript/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const getTypesName = (descriptor: Descriptor) => {
: `${descriptor.name}`;
};

const afterWorkspaceDependencyAddition = async ({ workspace, descriptor }: {
workspace: Workspace,
descriptor: Descriptor,
const afterWorkspaceDependencyAddition = async ({workspace, descriptor}: {
workspace: Workspace;
descriptor: Descriptor;
}) => {
if (descriptor.scope === `types`)
return;
Expand Down Expand Up @@ -105,9 +105,9 @@ const afterWorkspaceDependencyAddition = async ({ workspace, descriptor }: {
}
};

const afterWorkspaceDependencyRemoval = async ({ workspace, descriptor }: {
workspace: Workspace,
descriptor: Descriptor,
const afterWorkspaceDependencyRemoval = async ({workspace, descriptor}: {
workspace: Workspace;
descriptor: Descriptor;
}) => {
if (descriptor.scope === `types`)
return;
Expand Down Expand Up @@ -135,7 +135,7 @@ const afterWorkspaceDependencyRemoval = async ({ workspace, descriptor }: {
}
};

const beforeWorkspacePacking = ({ rawManifest }: { rawManifest: any }) => {
const beforeWorkspacePacking = ({rawManifest}: { rawManifest: any }) => {
if (rawManifest.publishConfig && rawManifest.publishConfig.typings)
rawManifest.typings = rawManifest.publishConfig.typings;

Expand Down
2 changes: 1 addition & 1 deletion packages/yarnpkg-core/sources/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,7 @@ export class Configuration {
if (!hook)
continue;

accumulator = await hook({ ...value, [attribute]: accumulator }, ...args);
accumulator = await hook({...value, [attribute]: accumulator}, ...args);
}

return accumulator;
Expand Down
10 changes: 5 additions & 5 deletions packages/yarnpkg-core/sources/CorePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {Descriptor, Locator} from './types';

export const CorePlugin: Plugin = {
hooks: {
reduceDependency: ({ dependency, project, locator, initialDependency, resolver, resolveOptions }: { dependency: Descriptor, project: Project, locator: Locator, initialDependency: Descriptor, resolver: Resolver, resolveOptions: ResolveOptions }) => {
reduceDependency: ({dependency, project, locator, initialDependency, resolver, resolveOptions}: { dependency: Descriptor, project: Project, locator: Locator, initialDependency: Descriptor, resolver: Resolver, resolveOptions: ResolveOptions }) => {
for (const {pattern, reference} of project.topLevelWorkspace.manifest.resolutions) {
if (pattern.from && pattern.from.fullName !== structUtils.stringifyIdent(locator))
continue;
Expand All @@ -32,10 +32,10 @@ export const CorePlugin: Plugin = {
return dependency;
},

validateProject: async ({ project, report}: { project: Project, report: {
validateProject: async ({project, report}: { project: Project; report: {
reportWarning: (name: MessageName, text: string) => void;
reportError: (name: MessageName, text: string) => void;
}}) => {
};}) => {
for (const workspace of project.workspaces) {
const workspaceName = structUtils.prettyWorkspace(project.configuration, workspace);

Expand All @@ -51,10 +51,10 @@ export const CorePlugin: Plugin = {
}
},

validateWorkspace: async ({ workspace, report }: { workspace: Workspace, report: {
validateWorkspace: async ({workspace, report}: { workspace: Workspace; report: {
reportWarning: (name: MessageName, text: string) => void;
reportError: (name: MessageName, text: string) => void;
}}) => {
};}) => {
// Validate manifest
const {manifest} = workspace;

Expand Down
Loading