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

rules vue/script-indent unexpected error report while force using semicolon #443

Closed
noe132 opened this issue Mar 25, 2018 · 4 comments
Closed
Labels

Comments

@noe132
Copy link

noe132 commented Mar 25, 2018

code
tim 20180325184012
when using semicolon, it reports invalid indentation.
while remove the semi, indentation is valid, but it reports semi missing.
tim 20180325184134

minimal reproduce repo https://github.com/noe132/eslint-plugin-vue-test

Tell us about your environment

  • ESLint Version: 4.19.1
  • eslint-plugin-vue Version: 4.4.0
  • Node Version: 8.8.1

Please show your full configuration:

// http://eslint.org/docs/user-guide/configuring
module.exports = {
  parserOptions: {
    sourceType: 'module',
  },
  env: {
    browser: true,
  },
  extends: [
    'plugin:vue/essential',
  ],
  plugins: [
    'vue'
  ],
  rules: {
    'vue/script-indent': ['error', 2, {
      'baseIndent': 1,
      'switchCase': 0,
      'ignores': []
    }],
    'semi': ['error', 'always'],
  },
}

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

<template>
  <div class="">
  </div>
</template>

<script>
  export default {
    name: 'Test',
    methods: {
      testMethod() {
        Promise.resolve()
          .then(() => {
            // SOME CODE HERE
          })
      },
    },
  };
</script>

What did you expect to happen?
linting good with no error

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

λ  yarn eslint .\index.vue
yarn run v1.3.2
$ C:\Users\noe\src\eslint-plugin-vue-test\node_modules\.bin\eslint .\index.vue

C:\Users\noe\src\eslint-plugin-vue-test\index.vue
  13:1  error  Expected indentation of 10 spaces but found 12 spaces  vue/script-indent
  14:1  error  Expected indentation of 8 spaces but found 10 spaces   vue/script-indent

✖ 2 problems (2 errors, 0 warnings)
  2 errors, 0 warnings potentially fixable with the `--fix` option.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@noe132 noe132 changed the title rules vue/script-indent behave differently with eslint rule indent rules vue/script-indent unexpected error report while force using semicolon Mar 25, 2018
@wmash
Copy link

wmash commented Mar 25, 2018

I am also experiencing this issue (similar one)

Versions:

  • eslint-plugin-vue: 4.4.0
  • node: 8.9.1
  • eslint: 4.18.2

Image below has error:

Expected indentation of 9 tabs but found 8 tabs

indent-fail

This image has the error:

Expected semicolon

semi-fail

My eslint configuration around indentation is:

"indent": "off",
"vue/script-indent": ["error", "tab", {
    "baseIndent": 1,
    "switchCase": 1,
}],

@noe132
Copy link
Author

noe132 commented Mar 26, 2018

by the way, this issue was not only got false positive error report with semicolon, also with trailing comma

<script>
  Promise.all([
    Promise.resolve()
      .then(() => {
      
      }), // Expected indentation of 4 spaces but found 6 spaces   vue/script-indent
  ])
</script>

and if remove that comma indent was fine but with missing trailing comma if trailing comma rule was set to always

@michalsnik michalsnik added the bug label Apr 1, 2018
@michalsnik
Copy link
Member

Yeah, I confirmed it, seems that this line is causing that: c6d25af#r27776203
cc @mysticatea

@michalsnik
Copy link
Member

I'm closing it in favour of #441

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

3 participants