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

space-infix-ops fails with vue and typescript #10260

Closed
KaelWD opened this issue Apr 24, 2018 · 4 comments
Closed

space-infix-ops fails with vue and typescript #10260

KaelWD opened this issue Apr 24, 2018 · 4 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules

Comments

@KaelWD
Copy link

KaelWD commented Apr 24, 2018

Tell us about your environment

  • ESLint Version: 4.19.0
  • Node Version: 8.9.4
  • npm Version: 5.6.0

What parser (default, Babel-ESLint, etc.) are you using?
typescript-eslint-parser

Please show your full configuration:

Configuration
module.exports = {
  root: true,
  parserOptions: {
    parser: require.resolve('typescript-eslint-parser'),
    ecmaVersion: '2017',
    sourceType: 'module'
  },
  env: {
    browser: true,
  },
  extends: [
    'standard',
    'plugin:vue/recommended'
  ],
  plugins: [
    'typescript',
    'vue'
  ],
  // add your custom rules here
  rules: {
    // https://github.com/eslint/typescript-eslint-parser#known-issues
    'no-undef': 'off',
    'no-unused-vars': 'off',
    // https://github.com/eslint/typescript-eslint-parser/issues/445
    // 'typescript/no-unused-vars': 'error'
    'vue/require-default-prop': 'off',
    'no-console': 'off',
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
  },
  overrides: [
    {
      files: '**/*.vue',
      rules: {
        indent: false,
        'vue/script-indent': ['error', 2, {
          baseIndent: 1,
          switchCase: 0
        }],
        'vue/max-attributes-per-line': [2, {
          singleline: 5,
          multiline: {
            max: 1,
            allowFirstLine: false
          }
        }],
      }
    },
  ]
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

<script lang="ts">
  import Vue from 'vue'

  function foo (bar: string): string {
    return bar
  }

  export default Vue.extend({
    created () {
      let baz: any = ''
    }
  })
</script>
eslint --ext .ts,.js,.vue src

It only happens in a .vue file, the same code works fine in a .ts
Removing the assignment fixes it (so just let baz: any)

What did you expect to happen?
No errors

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

src/components/Test.vue
  4:20  error  Infix operators must be spaced  space-infix-ops

✖ 1 problem (1 error, 0 warnings)
  1 error, 0 warnings potentially fixable with the `--fix` option.

Error is at the : in bar: string, but if I add a space then it moves to the next one.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Apr 24, 2018
@kaicataldo
Copy link
Member

Apologies for losing track of this. Is this still an issue?

@kaicataldo kaicataldo added bug ESLint is working incorrectly rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Jul 23, 2018
@Antipyrine101
Copy link

i have the same problem as well, what bother me is i have no infix operators in the line the error occurs,my config are:
"eslint": "5.2.0",
"typescript": "3.0.3"、
"typescript-eslint-parser": "18.0.0"、
"eslint-plugin-typescript": "0.12.0"、
my eslintrc is:
`
module.exports = {
parserOptions: {
parser: 'typescript-eslint-parser',
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
globalReturn: false,
jsx: true
}
},
env: {
browser: true,
node: true,
commonjs: true,
'shared-node-browser': true,
worker: true,
serviceworker: true
},
globals: {},

plugins: ['typescript'],
extends: ['standard', 'plugin:vue/recommended'],
root: true,
rules: {
'vue/html-indent': [2, 4],
'vue/html-self-closing': 0
}
}
but where the error tell is like this:import { getPlugins, Children } from '@/pages/dashboard/util.ts' groupMap: [], components: {
VPlugin
},`
i am confused about this problem,because i have no idea if { or [ is an infix operator and how to fix it

@ilyavolodin
Copy link
Member

This could be an issue with typescript-eslint-parser. Not all of the rules are supported when using that parser, so it might be reporting something that's triggering space-infix-ops rule.

@KaelWD
Copy link
Author

KaelWD commented Sep 13, 2018

vuejs/vue-eslint-parser#31 (comment)

I don't think there's anything actionable for this repository.

@KaelWD KaelWD closed this as completed Sep 13, 2018
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Mar 13, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Mar 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

4 participants