Skip to content

fix(@angular/cli): schematics commands should fail on unknown options #13480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2019
Merged

fix(@angular/cli): schematics commands should fail on unknown options #13480

merged 1 commit into from
Jan 30, 2019

Conversation

alan-agius4
Copy link
Collaborator

When an addition argument is parsed the schematic commands should fail with an error.

Fixes #12549

@alan-agius4 alan-agius4 added the target: patch This PR is targeted for the next patch release label Jan 19, 2019
@alan-agius4 alan-agius4 reopened this Jan 19, 2019
When an addition argument is parsed the schematic commands should fail with an error.

Fixes #12549
@alan-agius4 alan-agius4 requested a review from clydin January 20, 2019 13:08
@clydin clydin added target: major This PR is targeted for the next major release and removed target: patch This PR is targeted for the next patch release labels Jan 29, 2019
Copy link
Member

@clydin clydin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this has the potential to cause unintentional failures for existing users, targeting 8.0 may be the safer option.

@alan-agius4
Copy link
Collaborator Author

alan-agius4 commented Jan 29, 2019

caretaker: this is for version 8

@@ -437,6 +437,15 @@ export abstract class SchematicCommand<
args = await this.parseArguments(schematicOptions || [], o);
}

// ng-add is special because we don't know all possible options at this point
if (args['--'] && schematicName !== 'ng-add') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing schematicName == ng-add why not use a this.validateAdditionalArgs() or maybe a allowAdditionalArgs getter that is false for the base command class, true for add?

People can still ng generate something:ng-add and it would trigger this condition.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will follow up on this as I like the idea.

@hansl hansl merged commit f8e873b into angular:master Jan 30, 2019
@alan-agius4 alan-agius4 deleted the fix-unknown-options-schematics branch January 30, 2019 20:51
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ng new should error on multiple args
4 participants