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

A lot of no-undef in Vue @Component decorators after parser update #2942

Closed
3 tasks done
Maxim-Mazurok opened this issue Jan 19, 2021 · 1 comment · Fixed by #2943
Closed
3 tasks done

A lot of no-undef in Vue @Component decorators after parser update #2942

Maxim-Mazurok opened this issue Jan 19, 2021 · 1 comment · Fixed by #2943
Labels
bug Something isn't working package: parser Issues related to @typescript-eslint/parser

Comments

@Maxim-Mazurok
Copy link
Contributor

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

.eslintrc.js:

module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: [
    "plugin:vue/essential",
    "eslint:recommended",
    "@vue/typescript/recommended",
    "@vue/prettier",
    "@vue/prettier/@typescript-eslint",
  ],
  parserOptions: {
    ecmaVersion: 2020,
  },
  rules: {
    "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
  },
  overrides: [
    {
      files: [
        "**/__tests__/*.{j,t}s?(x)",
        "**/tests/unit/**/*.spec.{j,t}s?(x)",
      ],
      env: {
        jest: true,
      },
    },
  ],
};

App.vue:

@Component({
  components: {
    AppBar,
  },
})

tsconfig.json:

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": ["webpack-env", "jest", "vuetify"],
    "paths": {
      "@/*": ["src/*"]
    },
    "lib": ["esnext", "dom", "dom.iterable", "scripthost"]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": ["node_modules"]
}

Expected Result

When I use "@typescript-eslint/parser": "4.13.0" - tests are passing, no lining errors.

Actual Result
When I use "@typescript-eslint/parser": "4.14.0" - tests are failing, because of the lining errors:

> vue-cli-service lint **/*.{js,jsx,vue,ts,tsx,json} "--no-fix" "--max-warnings" "0"

error: 'components' is not defined (no-undef) at src/App.vue:48:3:
  46 | 
  47 | @Component({
> 48 |   components: {
     |   ^
  49 |     AppBar,
  50 |   },
  51 |   data: (): {


error: 'data' is not defined (no-undef) at src/App.vue:51:3:
  49 |     AppBar,
  50 |   },
> 51 |   data: (): {
     |   ^
  52 |     tabs: InterfaceTab[];
  53 |     cssVars: { "--min-drawer-width": string };
  54 |   } => ({


error: 'tabs' is not defined (no-undef) at src/App.vue:52:5:
  50 |   },
  51 |   data: (): {
> 52 |     tabs: InterfaceTab[];
     |     ^
  53 |     cssVars: { "--min-drawer-width": string };
  54 |   } => ({
  55 |     tabs: Object.keys(topLevelTabs).map((x) => ({

Additional Info

Versions

package version
@typescript-eslint/parser 4.14.0
TypeScript 4.1.3
ESLint 7.18.0
node 14.15.4
@Maxim-Mazurok Maxim-Mazurok added package: parser Issues related to @typescript-eslint/parser triage Waiting for maintainers to take a look labels Jan 19, 2021
@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Jan 19, 2021
@bradzacher
Copy link
Member

Same cause as #2941 - a regression introduced in a recent update in the scope analyser.

bradzacher added a commit that referenced this issue Jan 19, 2021
…ass method default params

Fixes #2941
Fixes #2942

This was a regression introduced by #2751
bradzacher added a commit that referenced this issue Jan 19, 2021
…ass method default params (#2943)

Fixes #2941
Fixes #2942

This was a regression introduced by #2751
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: parser Issues related to @typescript-eslint/parser
Projects
None yet
2 participants