Skip to content
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

--no-fix option is ignored by vue-cli-service when using typescript. #1112

Closed
BenoitAverty opened this issue Apr 11, 2018 · 7 comments
Closed

Comments

@BenoitAverty
Copy link

Version

3.0.0-beta.6

Reproduction link

https://github.com/BenoitAverty/vue-cli-test-tslint

Steps to reproduce

Run npm run lint -- --no-fix or npx run vue-cli-service lint --no-fix.

What is expected?

The lint errors should be reported but no file should be changed.

What is actually happening?

Errors are fixed in the file and not reported.


I would like to run linting in a precommit hook but not format the files. Currently this is not possible.

@dhensche
Copy link
Contributor

dhensche commented Apr 11, 2018

After some digging, appears to be related to https://github.com/substack/minimist/issues/54 and

@BenoitAverty
Copy link
Author

Nice catch. It's probably a unix convention. For example, in git, the --no-XXX options are used to override a previous --XXX. minimist seems to have this convention.

@dhensche
Copy link
Contributor

Yeah, I'm working on a fix right now. Not a ton of experience writing tests so that is taking most of my time 😨

@BenoitAverty
Copy link
Author

Awesome thanks. Don't hesitate to ask if you run into any difficulties (I'll help as best as I can but I'm not very familiar with vue cli 3 yet)

dhensche pushed a commit to dhensche/vue-cli that referenced this issue Apr 11, 2018
@BenoitAverty
Copy link
Author

in the meantime, I think npm run lint -- --no-fix=true should work as an ugly workaround.

@dhensche If you open a PR, I think the same bug is present in the eslint plugin (when typescript is not chosen)

@dhensche
Copy link
Contributor

@BenoitAverty The if block inverting the argument doesn't do anything, but because of the minimist conventions the --no-fix argument comes into the args property as fix: false and results in the argument working as expected.

if (args['no-fix']) {

Could probably just get rid of that whole if block

dhensche pushed a commit to dhensche/vue-cli that referenced this issue Apr 11, 2018
…pt plugin (vuejs#1112)

ninja_edit -- @BenoitAverty pointed out to me that the eslint plugin was handing --no-fix in a
similarly (possibly) broken manner. amending to remove the broken logic there as well
@yyx990803
Copy link
Member

fixed via #1115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants