Skip to content

vue/order-in-components throws eslint rule schema validation error on custom order #73

Closed
@tom-kitchin

Description

@tom-kitchin

Tell us about your environment
Vue client-side web application, base build from vue-cli, with eslint-plugin-vue@beta added.

  • ESLint Version: 4.2.0
  • eslint-plugin-vue Version: 3.5.0
  • Node Version: 8.0.0

Please show your full configuration:

// http://eslint.org/docs/user-guide/configuring

const OFF = 0
const WARN = 1
const ERROR = 2

module.exports = {
  root: true,
  parser: 'vue-eslint-parser',
  parserOptions: {
    parser: 'babel-eslint',
    sourceType: 'module'
  },
  env: {
    browser: true,
  },
  plugins: [
    'vue',
    'mocha'
  ],
  // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
  extends: [
    'standard',
    'plugin:vue/recommended'
  ],
  // add your custom rules here
  'rules': {
    // allow paren-less arrow functions
    'arrow-parens': OFF,
    // allow async-await
    'generator-star-spacing': OFF,
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? ERROR : OFF,
    // Set up vue eslint rules, starting from the base vue/recommended set.
    'vue/html-no-self-closing': OFF,
    // 'vue/no-invalid-v-on': OFF,
    'vue/html-quotes': ERROR,
    'vue/no-duplicate-attributes': ERROR,
    'vue/no-template-key': ERROR,
    'vue/order-in-components': [ERROR, {
      order: [
        'name',
        'render',
        'renderError',
        'template',
        'props',
        'propsData',
        'inject',
        'data',
        'computed',
        'watch',
        'methods',
        'provide',
        'directives',
        'filters',
        'parent',
        'extends',
        'mixins',
        'components',
        'LIFECYCLE_HOOKS'
      ]
    }],
    'vue/v-bind-style': ERROR,
    'vue/v-on-style': ERROR,
    "mocha/no-exclusive-tests": ERROR,
    "mocha/no-mocha-arrows": ERROR,
    "mocha/no-global-tests": ERROR,
    "mocha/no-identical-title": ERROR,
    "mocha/no-top-level-hooks": ERROR,
    "mocha/valid-test-description": WARN
  }
}

What did you do? Please include the actual source code causing the issue.
Ran eslint --ext .js,.vue src test/unit/specs with the above configuration.

What did you expect to happen?
For the linter to run the rules and possibly throw a few failures since I've just changed them.

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

$ eslint --ext .js,.vue src test/unit/specs
[object Object]:
	Configuration for rule "vue/order-in-components" is invalid:
	Value "[object Object]" should NOT have more than 0 items.

Error: [object Object]:
	Configuration for rule "vue/order-in-components" is invalid:
	Value "[object Object]" should NOT have more than 0 items.

    at validateRuleOptions (/Users/tom/projects/content-builder/node_modules/eslint/lib/config/config-validator.js:112:15)
    at Object.keys.forEach.id (/Users/tom/projects/content-builder/node_modules/eslint/lib/config/config-validator.js:152:9)
    at Array.forEach (native)
    at validateRules (/Users/tom/projects/content-builder/node_modules/eslint/lib/config/config-validator.js:151:30)
    at Object.validate (/Users/tom/projects/content-builder/node_modules/eslint/lib/config/config-validator.js:206:5)
    at loadFromDisk (/Users/tom/projects/content-builder/node_modules/eslint/lib/config/config-file.js:549:19)
    at Object.load (/Users/tom/projects/content-builder/node_modules/eslint/lib/config/config-file.js:592:20)
    at Config.getLocalConfigHierarchy (/Users/tom/projects/content-builder/node_modules/eslint/lib/config.js:228:44)
    at Config.getConfigHierarchy (/Users/tom/projects/content-builder/node_modules/eslint/lib/config.js:182:43)
    at Config.getConfigVector (/Users/tom/projects/content-builder/node_modules/eslint/lib/config.js:287:21)

To me it looks like the eslint rule validator is taking the provided schema on the rule (which is []) and interpreting that as expecting an empty array, but I only skimmed the validator code fairly cursorily. At the least I can't see any issues with my order-in-components config compared to the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions