Skip to content

vue/script-indent is misbehaving #344

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

Closed
MicroDroid opened this issue Jan 11, 2018 · 1 comment
Closed

vue/script-indent is misbehaving #344

MicroDroid opened this issue Jan 11, 2018 · 1 comment
Assignees
Labels

Comments

@MicroDroid
Copy link

MicroDroid commented Jan 11, 2018

I followed the issue template, but, see the last section for a quick look.

Tell us about your environment

Linting a front-end with difference .vue and .js files with help of SublimeLinter plugin for Sublime Text 3.

  • ESLint Version: 4.7.2
  • eslint-plugin-vue Version: 4.2.0
  • Node Version: 9.3.0

Please show your full configuration:

{
    ...
    "rules": {
        "linebreak-style": [
            "error",
            "unix"
        ],
        "quotes": [
            "error",
            "single"
        ],
        "semi": [
            "error",
            "always"
        ],
        "vue/script-indent": [
            "error",
            "tab",
            {"baseIndent": 1}
        ],
    }
    ...
}

What did you do? Please include the actual source code causing the issue.

Umm, I wrote code? I mean it happened when I tried to use vue/script-indent.

<script type="text/javascript">
	export default {
		...

		destroyed: function() {
			...
		},

		methods: {
			moment: moment.utc,
			shorten, summarize,
		}, // This is line 101
		...
	};
</script>

What did you expect to happen?

I expected no lint issues to be reported.

What actually happened? Please include the actual, raw output from ESLint.

image

From terminal:

  101:1    error  Expected indentation of 4 tabs but found 2 tabs               vue/script-indent

Also it's not this only specific case, it happens everywhere in my files. I was able to capture this pattern:

image

ifs like this make the line unrelated to the if statement required to be indented to if's block level too.

@mysticatea
Copy link
Member

Thank you for the report.
I confirmed that I can reproduce it: Oneline demo

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

No branches or pull requests

2 participants