Skip to content

Arguments after files option should be considered files. #13078

@michaeljota

Description

@michaeljota

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [x] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Angular CLI: 7.1.0
Node: 8.12.0
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.11.0
@angular-devkit/core         7.1.0
@angular-devkit/schematics   7.1.0
@schematics/angular          7.1.0
@schematics/update           0.11.0
rxjs                         6.3.3

Repro steps

I'm using lint-staged to run several cli tools when commiting, including linting. As @angular/cli@6.1.9 I was able to use it as:

  "lint-staged": {
    "*.{ts,html}": [
      "ng lint my-app --fix",
      "git add"
    ],
  },

And in only ran on staged files. However, after upgrading to @angular/cli@7.1.0 it throws Unknown option:{// The route of the file that lint-staged passed as an argument}.

The log given by the failure

× ng lint my-app --fix --files found some errors. Please fix them and try committing again.
�[37mLinting "my-app"...�[39m

�[1m�[31mUnknown option: '~~~route\my.component.html'�[39m�[22m
�[1m�[31mUnknown option: '~~~route\my.component.ts'�[39m�[22m
�[1m�[31mUnknown option: '~~~route\.component.spec.ts'�[39m�[22m

Desired functionality

I think Angular CLI should be able to parse additional arguments in this scenario. ng lint --files should handle the arguments that comes from lint-staged.

Mention any other details that might be useful

I research, and find a "fix" in lint-staged#534. I upgrade the version of lint-staged and add the --files argument at the end of the command. Still, this doesn't work, I think because --files is expecting an array of files. lint-staged has an issue 138(open since March 2017, almost two years) requesting for a way to be able to tell how you want to pass the arguments.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions