Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to prevent npm run lint from fixing errors automatically?

I created a Vue3 app using the Vue CLI with a Prettier/Eslint setup. When modifying the main.ts file to

import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";

createApp(App)
.use(router).mount("#app");

and run npm run serve I get the following warning

6:15 warning Delete prettier/prettier

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

as expected. Running npm run lint fixes it. But wich flag is required to only check for the style?

I have a Github action workflow checking the code style and using npm run lint is wrong because the workflow fixes the code style and passes.

When searching for a flag I run npx vue-cli-service help lint which tells me to use --no-fix

enter image description here

but running npm run lint --no-fix it still fixes the file

enter image description here

So which command should I use inside my Github action to ensure the workflow fails on invalid code style?

>Solution :

You have to use a double dash before your arguments, so use npm run lint -- --no-fix with -- as extra prefix instead of npm run lint --no-fix. See also this answer.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading