Skip to content

Unexpected no-use-before-define error dependent on preceding code and/or tags #208

@dmshvetsov

Description

@dmshvetsov

Tell us about your environment

  • ESLint Version: 4.8.0
  • eslint-plugin-vue Version: 3.13.0
  • Node Version: 7.10.1

Please show your full configuration:

// eslintrc.json
{
    "env": {
        "browser": true,
        "node": true
    },
    "plugins": [
        "vue"
    ],
    "extends": [
        "eslint:recommended",
        "plugin:vue/recommended"
    ],
    "parserOptions": {
        "parser": "babel-eslint",
        "sourceType": "module",
        "ecmaVersion": 2017
    },
    "rules": {
        "no-use-before-define": "error"
    }
}

// babelrc
{
  "presets": [
    ["env", { "targets": { "node": "7.10" } }]
  ],
  "plugins": [
    ["transform-object-rest-spread", { "useBuiltIns": true }],
    "babel-plugin-transform-decorators-legacy",
    "transform-runtime"
  ]
}

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

https://github.com/shvetsovdm/eslint-plugin-vue-no-use-before-issue repo to reproduce the issue

What did you expect to happen?

expect no [Error/no-use-before-define] error

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

$ npx eslint src/*.vue

/Users/shvetsovdm/TempProjects/eslint-plugin-vue-no-use-before-issue/src/issue.vue
  18:16  error  'a' was used before it was defined  no-use-before-define
  18:20  error  'b' was used before it was defined  no-use-before-define

/Users/shvetsovdm/TempProjects/eslint-plugin-vue-no-use-before-issue/src/issue2.vue
  13:16  error  'a' was used before it was defined  no-use-before-define
  13:20  error  'b' was used before it was defined  no-use-before-define

/Users/shvetsovdm/TempProjects/eslint-plugin-vue-no-use-before-issue/src/issue3.vue
  19:16  error  'a' was used before it was defined  no-use-before-define

/Users/shvetsovdm/TempProjects/eslint-plugin-vue-no-use-before-issue/src/issue4.vue
  18:12  error  'a' was used before it was defined  no-use-before-define
  18:16  error  'b' was used before it was defined  no-use-before-define

✖ 7 problems (7 errors, 0 warnings)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions