Skip to content

Change the signature of spfx project upgrade rules to accepts object as args #7067

@waldekmastykarz

Description

@waldekmastykarz

Right now, our spfx project upgrade rules use distinct args in constructors, eg:

export abstract class DependencyRule extends JsonRule {
  constructor(protected packageName: string, protected packageVersion: string, protected isDevDep: boolean = false, protected isOptional: boolean = false, protected add: boolean = true) {
    super();
  }
  // ...
}

While it's convenient to use them in the rule, instantiating these classes gets confusing:

super('@microsoft/sp-office-ui-fabric-core', packageVersion, false, true);

What was the 3rd arg for again?

I suggest we wrap all args in an object so that we can call it more clearly like:

super({
  packageName: '@microsoft/sp-office-ui-fabric-core'
  packageVersion,
  isDevDep: false,
  isOptional: true
});

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions