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

vue/order-in-components ceases to work when typecasting Vue component #575

Closed
ffxsam opened this issue Sep 16, 2018 · 1 comment
Closed

Comments

@ffxsam
Copy link

ffxsam commented Sep 16, 2018

Tell us about your environment

  • ESLint Version: 4.19.1
  • eslint-plugin-vue Version: 4.7.1
  • Node Version: 8.10.0

Please show your full configuration:

module.exports = {
  root: true,
  env: {
    node: true,
  },
  globals: {
    describe: true,
    it: true,
    cy: true,
  },
  extends: ['plugin:vue/recommended', '@vue/standard', '@vue/typescript'],
  rules: {
    // Plain JS rules
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'comma-dangle': ['error', 'always-multiline'],
    semi: ['error', 'always'],
    'space-before-function-paren': ['error', 'never'],
    'no-var': 'error',
    'no-const-assign': 'error',
    // 'no-unused-vars': 'warn',
    'no-await-in-loop': 'error',
    'default-case': 'error',
    eqeqeq: 'warn',
    'no-alert': 'warn',
    'no-console': 'off', //process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-unreachable': 'warn',
    'no-else-return': 'warn',
    'no-multi-spaces': 'warn',
    'no-useless-return': 'warn',
    'no-case-declarations': 'error',
    yoda: 'error',
    'no-use-before-define': 'warn',
    camelcase: ['error', { properties: 'never' }],
    'no-mixed-spaces-and-tabs': 'error',
    'no-duplicate-imports': 'error',
    'prefer-const': 'warn',
    indent: 'off',
    'space-before-function-paren': 'off',
    'standard/computed-property-even-spacing': 'off',

    // Extra Vue rules
    'vue/html-closing-bracket-spacing': 'warn',
    'vue/html-closing-bracket-newline': [
      'warn',
      {
        singleline: 'never',
        multiline: 'always',
      },
    ],
    'vue/require-prop-types': 'never', // temporary, till Array junk is fixed
  },
  parserOptions: {
    parser: 'typescript-eslint-parser',
  },
};

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

export default (Vue as VueConstructor<
  Vue &
    AudioState & {
      $refs: {
        audio: HTMLAudioElement;
      };
    }
>).extend({
  data() { /* ... */ },
  props: { /* ... */ },
  // etc.
});

What did you expect to happen?

  • ESLint error about props coming after data

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

  • No warnings/errors

Notes:

If I replace the export line with export default Vue.extend({ then it works as expected. Extending the type interface seems to break this rule.

@michalsnik
Copy link
Member

Hello @ffxsam ! Thanks for posting this issue. I know what's the problem here and I might solve it by the way while working on #564. In the meanwhile you can use // @vue/component comment above >).extend({ to tell ESLint that the object below is a Vue component.

@michalsnik michalsnik self-assigned this Sep 18, 2018
armano2 added a commit to armano2/eslint-plugin-vue that referenced this issue Oct 17, 2018
* Add "as" helper
* Fix vue/require-default-prop
* Fix vue/require-prop-types
* Allow to use export default (Vue as VueConstructor<Vue>).extend({ syntax
Fix issues: vuejs#564 vuejs#575
armano2 added a commit to armano2/eslint-plugin-vue that referenced this issue Oct 17, 2018
* Add "as" helper
* Fix vue/require-default-prop
* Fix vue/require-prop-types
* Allow to use `export default (Vue as VueConstructor<Vue>).extend({` syntax

Fix issues: vuejs#564 vuejs#575
armano2 added a commit to armano2/eslint-plugin-vue that referenced this issue Oct 19, 2018
* Add "as" helper
* Fix vue/require-default-prop
* Fix vue/require-prop-types
* Allow to use `export default (Vue as VueConstructor<Vue>).extend({` syntax

Fix issues: vuejs#564 vuejs#575
armano2 added a commit to armano2/eslint-plugin-vue that referenced this issue Oct 20, 2018
* Add "as" helper
* Fix vue/require-default-prop
* Fix vue/require-prop-types
* Allow to use `export default (Vue as VueConstructor<Vue>).extend({` syntax

Fix issues: vuejs#564 vuejs#575
michalsnik pushed a commit that referenced this issue Nov 6, 2018
* Add typescript specific changes

* Add "as" helper
* Fix vue/require-default-prop
* Fix vue/require-prop-types
* Allow to use `export default (Vue as VueConstructor<Vue>).extend({` syntax

Fix issues: #564 #575

* Fix vue/require-prop-type-constructor

* Fix vue/require-valid-default-prop

* Add more tests in utils
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants