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

"'const' is not defined" #2560

Closed
3 tasks done
garyking opened this issue Sep 14, 2020 · 2 comments
Closed
3 tasks done

"'const' is not defined" #2560

garyking opened this issue Sep 14, 2020 · 2 comments
Labels
fix: out of date packages user was on an old version of our tooling or ESLint, updating fixed it package: parser Issues related to @typescript-eslint/parser

Comments

@garyking
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

module.exports = {
  extends: [],
  parser: '@typescript-eslint/parser',
  plugins: ['@typescript-eslint'],
  rules: {}
}
const item = {
  a: 'a'
} as const;

export default item;

Expected Result

No error.

Actual Result

'const' is not defined no-undef

Versions

package version
@typescript-eslint/parser 4.1.1
TypeScript 4.0.2
ESLint 7.9.0
node 14.8.0
@garyking garyking added package: parser Issues related to @typescript-eslint/parser triage Waiting for maintainers to take a look labels Sep 14, 2020
@bradzacher
Copy link
Member

We have passing tests for this in master:

// https://github.com/typescript-eslint/typescript-eslint/issues/2477
`
const x = 1 as const;
`,

As this was fixed in #2499.

This implies that likely you have multiple versions of our tooling installed at the same time.

@bradzacher bradzacher added awaiting response Issues waiting for a reply from the OP or another party and removed triage Waiting for maintainers to take a look labels Sep 14, 2020
@garyking
Copy link
Contributor Author

rm -rf node_modules/ then yarn install did the trick.

@bradzacher bradzacher added fix: out of date packages user was on an old version of our tooling or ESLint, updating fixed it and removed awaiting response Issues waiting for a reply from the OP or another party labels Sep 14, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fix: out of date packages user was on an old version of our tooling or ESLint, updating fixed it package: parser Issues related to @typescript-eslint/parser
Projects
None yet
Development

No branches or pull requests

2 participants