eslint / typescript-eslint-parser

An ESLint custom parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.
Other
915 stars 92 forks source link

Parse error with TypeScript 3 #498

Closed texastoland closed 5 years ago

texastoland commented 5 years ago

FIXED; if you get an error paste:

  1. the exact error message
  2. your eslint config except rules
  3. your lockfile in a gist

What version of TypeScript are you using?

3.0.0-rc

What version of typescript-eslint-parser are you using?

16.0.1

What code were you trying to parse?

Any codes.

What did you expect to happen?

It parses.

What happened?

Parsing error: ts.unescapeIdentifier is not a function

Deprecated functions were removed for the major version update.

https://github.com/eslint/typescript-eslint-parser/blob/3c874ec8b795fcf021c9634403a012c28a300dc6/lib/node-utils.js#L510

nikitavoloboev commented 5 years ago

I updated this library to v17.0.1 and still get these lint errors. Any way to fix them?

texastoland commented 5 years ago

@nikitavoloboev it sounds like ESLint is picking up a different version of the parser from node_modules. Paste your ESLint config and [dev]Dependencies.

sandrocsimas commented 5 years ago

The same here! Here's my dev dependencies:

"devDependencies": {
    "@angular/animations": "6.1.0",
    "@angular/common": "6.1.0",
    "@angular/compiler": "6.1.0",
    "@angular/core": "6.1.0",
    "@angular/forms": "6.1.0",
    "@angular/platform-browser": "6.1.0",
    "@angular/platform-browser-dynamic": "6.1.0",
    "@angular/router": "6.1.0",
    "@fortawesome/angular-fontawesome": "0.1.1",
    "@fortawesome/fontawesome-svg-core": "1.2.2",
    "@fortawesome/free-regular-svg-icons": "5.2.0",
    "@fortawesome/free-solid-svg-icons": "5.2.0",
    "@ng-bootstrap/ng-bootstrap": "2.2.1",
    "@types/lodash-es": "4.17.1",
    "@types/node": "10.5.5",
    "angular-calendar": "0.25.2",
    "angular2-template-loader": "0.6.2",
    "bootstrap": "4.1.3",
    "chart.js": "2.7.2",
    "clean-webpack-plugin": "0.1.19",
    "core-js": "2.5.7",
    "css-loader": "1.0.0",
    "date-fns": "1.29.0",
    "eslint": "5.2.0",
    "eslint-config-airbnb-base": "13.0.0",
    "eslint-plugin-import": "2.13.0",
    "file-loader": "1.1.11",
    "hash-code": "1.0.1",
    "html-loader": "0.5.5",
    "html-webpack-plugin": "3.2.0",
    "less": "3.8.0",
    "less-loader": "4.1.0",
    "lodash-es": "4.17.10",
    "mini-css-extract-plugin": "0.4.1",
    "ngx-clipboard": "11.1.2",
    "ngx-mask": "6.1.2",
    "ngx-masonry": "1.1.2",
    "optimize-css-assets-webpack-plugin": "5.0.0",
    "purgecss-webpack-plugin": "1.2.0",
    "release-n-publish": "0.0.6",
    "rxjs": "6.2.2",
    "rxjs-compat": "6.2.2",
    "rxjs-tslint": "0.1.5",
    "ts-loader": "4.4.2",
    "tslint-angular": "1.1.2",
    "tslint-config-airbnb": "5.9.2",
    "tslint-eslint-rules": "5.3.1",
    "typescript": "3.0.1",
    "webpack": "4.16.3",
    "webpack-cli": "3.1.0",
    "zone.js": "0.8.26"
},

My dependencies are updated (just two outdated, non related to eslint):

npm outdated
Package        Current  Wanted  Latest  Location
ngx-clipboard   11.1.2  11.1.2  11.1.3  project
webpack         4.16.3  4.16.3  4.16.4  project
texastoland commented 5 years ago

@sandrocsimas I should've asked for the exact error message and your lockfile in a gist. I don't see any dependencies (typically eslint-{config,plugin}.*) that export this project. See https://github.com/eslint/typescript-eslint-parser#usage-with-eslint.

theseyi commented 5 years ago

FWIW, moving to "typescript-eslint-parser": "^17.0.1" and "eslint": "^5.2.0" fixed this for me