Repository: vuejs/eslint-plugin-vue

Issue #344: vue/script-indent is misbehaving
Created: 2018-01-11T21:31:30Z
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.

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:

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

Duplicate issue #347: vue/script-indent does not parse enhanced object literal properties correctly
Created: 2018-01-12T20:09:06Z
Tell us about your environment

ESLint Version: 4.11.0
eslint-plugin-vue Version: 4.2.0
Node Version: 6.11.4

Please show your full configuration:

module.exports = {
  extends: [
    // 'plugin:vue/recommended',
    'plugin:vue/base',
    '../../../.eslintrc.js',
  ],
  rules: {
    // <script> tag content in vue files should follow our indentation standard
    'vue/script-indent': [
      'error',
      2,
      {
        baseIndent: 1,
        switchCase: 0,
        ignores: [],
      },
    ],
  },
  plugins: [
    'vue',
  ],
};

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

<script type="text/babel">
  import fieldBlockList from '../../../components/field-block/list';
  import nameListItem from './name-list-item';
  import vForUniqueKey from '../../../mixins/v-for-unique-key';
  import listMutator from './data/name-list-mutator';

  module.exports = {
    name: 'contact-group-name',
    mixins: [vForUniqueKey],
    components: {
      fieldBlockList,
      nameListItem, // Expected indentation of 8 spaces, but found 6
      vForUniqueKey, // Expected indentation of 10 spaces, but found 6
      listMutator, // Expected indentation of 12 spaces, but found 6
    }, // Expected indentation of 14 spaces, but found 6
    data() {
      return {
        label: 'Name',
        groupName: 'person_name',
        items: listMutator.parseInitial(FW_DATA.person_names),
        listMutator: listMutator,
      };
    },
  };
</script>
What did you expect to happen?
The indentation, as written above, is correct, and as such i should not be getting any errors
What actually happened? Please include the actual, raw output from ESLint.
The errors shown in comments above were posted after linting.
line 12, col 1, Error - Expected indentation of 8 spaces but found 6 spaces. (vue/script-indent)
line 13, col 1, Error - Expected indentation of 10 spaces but found 6 spaces. (vue/script-indent)
line 14, col 1, Error - Expected indentation of 12 spaces but found 6 spaces. (vue/script-indent)
line 15, col 1, Error - Expected indentation of 14 spaces but found 4 spaces. (vue/script-indent)

To satisfy this rule, I have to continually indent subsequent properties by 1 multiplier, and the final closing mustache one additional multiplier after the last property as such:
<script type="text/babel">
  import fieldBlockList from '../../../components/field-block/list';
  import nameListItem from './name-list-item';
  import vForUniqueKey from '../../../mixins/v-for-unique-key';
  import listMutator from './data/name-list-mutator';


  module.exports = {
    name: 'contact-group-name',
    components: {
      fieldBlockList,
        nameListItem,
          vForUniqueKey,
            listMutator,
              },
    data() {
      . . .
    };
    },
  };
</script>

Closing comment (2018-01-13T19:28:27Z): Thank you for this report.
This seems a duplicate of #344 and we have a patch #346 already. Please track those.