vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.45k stars 667 forks source link

False positive on chained filters from vue/no-multi-spaces #1033

Closed LolliDepp closed 4 years ago

LolliDepp commented 4 years ago

Tell us about your environment

Please show your full configuration:

module.exports = {
  parser: 'vue-eslint-parser',
  env: { browser: true },
  plugins: ['@typescript-eslint'],
  extends: [
    'airbnb-base',
    'plugin:vue/recommended',
    'plugin:vue-a11y/recommended',
    'plugin:@typescript-eslint/recommended',
    'prettier',
    'prettier/@typescript-eslint'
  ],
  globals: {
    $: 'readonly'
  },
  rules: {
    'max-classes-per-file': 'off',
    'no-extend-native': ['error', { exceptions: ['Date'] }], // error if extending a native prototype - add to expections if needed. This should be a very consciuous decision
    'no-console': 'error',
    'max-len': 'off',
    'no-debugger': 'warn', // create separate configuration, and make this an error for production build
    'no-param-reassign': [
      'error',
      {
        props: true,
        ignorePropertyModificationsFor: [
          'acc', // for reduce accumulators
          'accumulator', // for reduce accumulators
          'e', // for e.returnvalue
          'state', // for state[values]
          'store' // for store.state[values]
        ]
      }
    ],
    'prefer-promise-reject-errors': 'error',
    'class-methods-use-this': 'off', // would be nice, but using static methods in Vue template is not pretty so this has been disabled
    'no-empty-function': 'off', // sometimes needed for Vue default props
    'no-restricted-globals': 'off',
    'object-shorthand': 'off', // disabled since we may need to explicitly set the name to avoid issues to to rename refactorings (ex: for API calls params)
    'prefer-destructuring': 'error',
    'no-useless-constructor': 'off', // conflicts with new ts features
    'prefer-const': 'error',
    'no-restricted-syntax': 'error',
    'guard-for-in': 'error',
    'dot-notation': 'error',
    'no-useless-return': 'error',
    radix: 'off',
    'no-bitwise': 'off',
    'import/extensions': [
      'off',
      'ignorePackages',
      {
        js: 'never',
        jsx: 'never',
        ts: 'never',
        tsx: 'never'
      }
    ],
    'import/order': 'error',
    'import/no-extraneous-dependencies': 'error',
    'import/no-unresolved': 'off', // handled by TSC
    'import/prefer-default-export': 'off',
    'lines-between-class-members': 'off',
    'no-return-assign': 'off',
    'no-lonely-if': 'off', // rule is bugged, "else if" are sometimes treated as a lonely if
    'no-plusplus': 'off',
    semi: 'off',
    camelcase: 'off',
    // TYPESCRIPT
    '@typescript-eslint/explicit-function-return-type': 'off',
    '@typescript-eslint/array-type': ['warn', { default: 'array' }],
    '@typescript-eslint/explicit-member-accessibility': 'off',
    '@typescript-eslint/no-unused-vars': 'off', // handled by TSC
    '@typescript-eslint/camelcase': [
      'error',
      { properties: 'always', ignoreDestructuring: true }
    ],
    '@typescript-eslint/class-name-casing': 'error',
    '@typescript-eslint/interface-name-prefix': ['error', 'always'],
    '@typescript-eslint/member-ordering': [
      'error',
      {
        default: [
          'constructor',

          'public-static-method',
          'protected-static-method',
          'private-static-method',
          'static-method',

          'public-static-field',
          'protected-static-field',
          'private-static-field',
          'static-field',

          'public-instance-field',
          'protected-instance-field',
          'private-instance-field',
          'instance-field',

          'public-field',
          'protected-field',
          'private-field',
          'field',

          'public-instance-method',
          'protected-instance-method',
          'private-instance-method',
          'instance-method',

          'public-method',
          'protected-method',
          'private-method',
          'method'
        ]
      }
    ], // error once fixed
    '@typescript-eslint/consistent-type-assertions': [
      'error',
      {
        assertionStyle: 'as',
        objectLiteralTypeAssertions: 'allow-as-parameter'
      }
    ],
    '@typescript-eslint/no-explicit-any': 'error', // or mabe warn?
    '@typescript-eslint/no-for-in-array': 'error', // error once fixed - IMPORTANT FIX! - using "for in" with arrays causes confusion since it loops by index!
    '@typescript-eslint/no-magic-numbers': [
      'error',
      {
        ignoreNumericLiteralTypes: true,
        ignoreEnums: true,
        ignore: [-1, 0, 1],
        detectObjects: true
      }
    ], // allow -1, 0 and 1 everywhere, and all magic numbers in enums and type literals, disallow all others
    '@typescript-eslint/no-misused-new': 'error',
    '@typescript-eslint/no-unnecessary-type-assertion': 'error',
    '@typescript-eslint/prefer-string-starts-ends-with': 'error',
    '@typescript-eslint/semi': 'off', // handled by TSX
    '@typescript-eslint/no-non-null-assertion': 'off', // turn this on with separate ticket
    '@typescript-eslint/unbound-method': 'off', // this would actually be nice, but conflicts with Vue, since Vue binds methods automatically
    '@typescript-eslint/no-inferrable-types': 'off',
    '@typescript-eslint/no-parameter-properties': 'off',
    '@typescript-eslint/prefer-interface': 'off',
    '@typescript-eslint/no-use-before-define': ['error', { functions: false }],
    '@typescript-eslint/ban-ts-ignore': 'off',
    '@typescript-eslint/no-empty-function': 'off',
    // VUE
    'vue/max-attributes-per-line': 'off',
    'vue/attribute-hyphenation': ['error', 'never'],
    'vue/component-name-in-template-casing': [
      'warn',
      'PascalCase',
      {
        ignores: [
          '/^el-/',
          '/^router-/',
          'transition',
          'transition-group',
          'keep-alive',
          'component'
        ],
        registeredComponentsOnly: false
      }
    ],
    'vue/match-component-file-name': [
      'warn',
      {
        extensions: ['tsx', 'vue'],
        shouldMatchCase: true
      }
    ],
    'vue/v-on-function-call': ['warn', 'never'],
    'vue/v-slot-style': [
      'warn',
      {
        atComponent: 'v-slot',
        default: 'v-slot',
        named: 'longform'
      }
    ],
    'vue/valid-v-slot': 'warn',
    'vue/v-on-function-call': 'off', // TODO: re-enable once it works - 18/12/2019 causes build to crash,
    'vue/multiline-html-element-content-newline': 'off', // would be nice, but conflicts with prettier
    'vue/html-self-closing': ['warn', { html: { void: 'always' } }], // defaults would give error for <br /> and expect <br> instead - confusing
    'vue/singleline-html-element-content-newline': 'off', // would be nice, but conflicts with prettier
    'vue/no-v-html': 'off',
    'vue/mustache-interpolation-spacing': 'off',
    'vue-a11y/mouse-events-have-key-events': 'off', // TODO: turn on then fix issues!
    'vue-a11y/click-events-have-key-events': 'off', // TODO: turn on then fix issues!
    'vue-a11y/label-has-for': 'off', // TODO: turn on then fix issues
  },
  parserOptions: {
    parser: '@typescript-eslint/parser',
    ecmaFeatures: {
      jsx: true
    },
    project: './tsconfig.json',
    extraFileExtensions: ['.vue']
  }
};

What did you do?

<p>{{ myData | firstFilter | secondFilter }}</p>

What did you expect to happen? No messages as the line is valid See "Filters can be chained" in: https://vuejs.org/v2/guide/filters.html

What actually happened? I get a warning for a violation: Multiple spaces found before '|' vue/no-multi-spaces

ota-meshi commented 4 years ago

Thank you for this issue.

I can't reproduce this issue. Could you share your minimal repository?

ota-meshi commented 4 years ago

This issue cannot be reproduced, so I close this issue.