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

Upgrading to 4.14.0 causes error on decorator properties #2945

Closed
3 tasks done
slaweet opened this issue Jan 19, 2021 · 2 comments
Closed
3 tasks done

Upgrading to 4.14.0 causes error on decorator properties #2945

slaweet opened this issue Jan 19, 2021 · 2 comments
Labels
duplicate This issue or pull request already exists package: parser Issues related to @typescript-eslint/parser

Comments

@slaweet
Copy link

slaweet commented Jan 19, 2021

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages. - that's why the problem started to happen
  • I have read the FAQ and my problem is not listed.

Repro

.eslint.json

{
  "root": true,
  "parser": "vue-eslint-parser",
  "parserOptions": {
    "project": "./tsconfig.json",
    "ecmaVersion": 2020,
    "extraFileExtensions": [".vue"],
    "createDefaultProgram": true,
    "parser": "@typescript-eslint/parser"
  },
  "plugins": [
    "@typescript-eslint",
    "vuejs-accessibility",
    "import"
  ],
  "extends": [
    "eslint:recommended",
    "airbnb-typescript",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended",
    "prettier/@typescript-eslint",
    "plugin:vue/vue3-recommended",
    "plugin:vuejs-accessibility/recommended"
  ],
  "ignorePatterns": ["dist/", "node_modules/", "*.js"],
  "env": {
    "browser": true,
    "node": true,
    "amd": true
  },
  "rules": {
    "quotes": ["error", "single", { "avoidEscape": true }],
    "indent": ["error", 2],
    "semi": ["error", "always"],
    "camelcase": "off",
    "@typescript-eslint/camelcase": "off",
    "@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }],
    "@typescript-eslint/no-explicit-any": "off",
    "class-methods-use-this": "off"
  },
  "settings": {
    "import/parsers": {
      "@typescript-eslint/parser": [".ts"]
    },
    "import/resolver": {
      "typescript": {
        "project": "./tsconfig.json"
      }
    }
  }
}

src/EslintErrorDemo.vue

<template>
  <div>
    <h1>Demo</h1>
    <child-component-demo />
  </div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import ChildComponentDemo from '@/ChildComponentDemo.vue';

@Component({
  components: { ChildComponentDemo },
})
export default class EslintErrorDemo extends Vue { }
</script>

src/ChildComponentDemo.vue

<template>
  <div>Child Demo</div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';

@Component
export default class ChildComponentDemo extends Vue { }
</script>

Expected Result

Eslint run passes on the code exmaple

 DONE  No lint errors found!

Actual Result

error: 'components' is not defined (no-undef) at src/EslintErrorDemo.vue:13:3:

Additional Info

■■■■[slaweet:~/git/demo] $ yarn add --dev @typescript-eslint/parser@4.13.0
yarn add v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ @typescript-eslint/parser@4.13.0
info All dependencies
└─ @typescript-eslint/parser@4.13.0
Done in 7.60s.
■■■■[slaweet:~/git/demo] $ yarn lint src/EslintErrorDemo.vue
yarn run v1.22.5
$ vue-cli-service lint src/EslintErrorDemo.vue
 DONE  No lint errors found!
Done in 6.26s.
■■■■[slaweet:~/git/demo] $ yarn add --dev @typescript-eslint/parser@4.14.0
yarn add v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved 0 new dependencies.
Done in 6.25s.
■■■■[slaweet:~/git/demo] $ yarn lint src/EslintErrorDemo.vue --debug
yarn run v1.22.5
$ vue-cli-service lint src/EslintErrorDemo.vue --debug
error: 'components' is not defined (no-undef) at src/EslintErrorDemo.vue:13:3:
  11 | 
  12 | @Component({
> 13 |   components: { ChildComponentDemo },
     |   ^
  14 | })
  15 | export default class EslintErrorDemo extends Vue { }
  16 | </script>


1 error found.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Versions

package version
@typescript-eslint/parser 4.14.0
TypeScript 4.1.3
ESLint 7.18.0
node 12.7.0
@slaweet slaweet added package: parser Issues related to @typescript-eslint/parser triage Waiting for maintainers to take a look labels Jan 19, 2021
@bradzacher
Copy link
Member

Duplicate of #2941, #2942
Please use the search.

@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for maintainers to take a look labels Jan 19, 2021
@slaweet
Copy link
Author

slaweet commented Jan 19, 2021

Duplicate of #2941, #2942
Please use the search.

Thanks for such a quick response. I was looking at open issues and didn't see any relevant. I didn't realize it could have been fixed so fast.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists package: parser Issues related to @typescript-eslint/parser
Projects
None yet
Development

No branches or pull requests

2 participants