3

I am running vue-cli-service lint --fix on my vuejs/typescript project. Like expected most of the linting errors/warning gets fixed automatically.

But there is specific tslint rule("semicolon": [true, "always", "ignore-interfaces"]) I want to auto fix with this command. Say my typescript interface looks like this(expected lint result).

interface component {
    type: "input" | "dropdown" | "checkbox",
    hidden?: boolean
}

After running lint it formats it like this. Message is [eslint] Replace,with;(prettier/prettier)

interface component {
    type: "input" | "dropdown" | "checkbox";
    hidden?: boolean;
}

I have added this rule "semicolon": [true, "always", "ignore-interfaces"] to the tslint file, but it doesn't change the result.

1 Answer 1

1

The console message ([eslint] Replace , with ; (prettier/prettier)) suggests you had selected the ESLint + Prettier option when generating your project with Vue CLI; but ESLint doesn't support tslint.json out of the box (a plugin is needed, but YMMV).

An alternative is to switch to TSLint, and edit the generated tslint.json to include your desired semicolon rule.

Sign up to request clarification or add additional context in comments.

3 Comments

I tried that plugin but it doesn't seem to go well with the templates in the .vue files. Also fount this. github.com/vuejs/vue-cli/issues/761. Thanks for your response.
This seems to be a known Prettier quirk. Is it not feasible to regenerate the project and select the TSLint linter option?
I can but for the current moment it is trivial to do that. I will play a with github.com/alexjoverm/tslint-config-prettier . But looking at the issues for vue-cli it looks like it is in the works getting tslint-prettier part of the vue create.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.