Skip to content

Some rules are not working while using vue-class-component #1000

@horrylala

Description

@horrylala

My environment

  • ESLint version:6.7.1
  • eslint-plugin-vue version:6.0.1
  • Node version:v11.14.0

Please show your full configuration:

module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: [
    // airbnb
    'airbnb-base',
    // vue lint
    // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
    'plugin:vue/recommended',
    // https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
    'plugin:@typescript-eslint/recommended',
    // prettier
    'prettier',
    'prettier/@typescript-eslint',
    'prettier/vue',
    '@vue/typescript'
  ],
  plugins: [
    // 'html'
  ],
  rules: {
    // ... 
    'no-multiple-empty-lines': ["error", { "max": 1 }],
    // ===
    'eqeqeq': ["error", "always"],
    // max-len: 180
    'max-len': ['error', 180],
    // todo: vue/order-in-components, not working
    // todo: vue/prop-name-casing , not working,
    // todo: vue/no-async-in-computed-properties , not working
    // todo: vue/no-duplicate-attributes ,not working
    'vue/no-dupe-keys': ['error'], // still not working 
    /*--------------------- vue rules ---------------------*/
    // Vue component naming,PascalCase:'MyComponent ',kebab-case:'my-component'
    'vue/name-property-casing': ['error', 'PascalCase'],
    // vue template naming,PascalCase:<MyComponent></MyComponent>  kebab-case: '<my-component></my-component>'
		'vue/component-name-in-template-casing': ['error', 'kebab-case'],
    /*--------------------- ts rules ---------------------*/
		'@typescript-eslint/no-unused-vars': ['error'],
    // typescript-eslint
    '@typescript-eslint/interface-name-prefix': 'off',
    '@typescript-eslint/explicit-function-return-type': 'off',
  },
  parser: 'vue-eslint-parser',
  parserOptions: {
    'parser': '@typescript-eslint/parser',
    'project': 'tsconfig.json',
    'tsconfigRootDir': './',
    'extraFileExtensions': ['.vue']
  },
};

What did you do?

import { Vue } from "vue-property-decorator"

interface IState {
  arr: []
}
interface IProps {
  'prop-a': number
}

export default class Home extends Vue<IState, IProps> {
  // todo:eslint message: string = 'hello'
  message = 'hello'

  activated () {
    this.$el = 'nnn'
    console.log('actived')
  }

  onClick (): void {
    const message = 'dd'
    console.log(message)
    console.log(this.message)
    const longStr = 'str1234567…………189190191……str1………189190191……189190191……str1234567…………18919019str1234567…………189190191……str1234567…………189190191……str1234567…………189190191……1……'
    console.log(longStr)
  }

  get valA () {
    return Promise.all([new Promise((resolve) => {resolve('hhh')})])
  }
}

What did you expect to happen?
It should show some errors.

What actually happened?

Nothing errors are shown.

More description
I just import vue and typescript without using vue-cli. And i want using eslint-plugin-vue to lint my vue files which using vue-class-component.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions