Tslint: Incompatible with typescript 2.7

Created on 12 Feb 2018  路  12Comments  路  Source: palantir/tslint

Bug Report

  • __TSLint version__: 5.9.1
  • __TypeScript version__: 2.7.1
  • __Running TSLint via__: CLI

I'm getting a lot of errors thrown from within tslint when using tslint with typescript 2.7.1

Here's an abbreviated list of errors with the first location in the stack trace:

  • TypeError: Cannot read property 'declarations' of undefined at cb (node_modules/tslint/lib/rules/oneVariablePerDeclarationRule.js:57:73)
  • TypeError: Cannot read property 'kind' of undefined at cb (node_modules/tslint/lib/rules/noSparseArraysRule.js:50:70)
  • TypeError: Cannot read property 'kind' of undefined at cb (node_modules/tslint/lib/rules/noUnusedExpressionRule.js:109:75)
  • TypeError: Cannot read property 'kind' of undefined at cb (node_modules/tslint/lib/rules/objectLiteralShorthandRule.js:69:27)
  • TypeError: Cannot read property 'kind' of undefined at cb (node_modules/tslint/lib/rules/preferConstRule.js:163:98)
  • TypeError: Cannot read property 'kind' of undefined at cb (node_modules/tslint/lib/rules/tripleEqualsRule.js:67:37)
  • TypeError: Cannot read property 'kind' of undefined at isPlusExpression (node_modules/tslint/lib/rules/preferTemplateRule.js:112:69)
  • TypeError: Cannot read property 'length' of undefined at cb (node_modules/tslint/lib/rules/noDuplicateVariableRule.js:79:66)
  • TypeError: Cannot read property 'length' of undefined at cb (node_modules/tslint/lib/rules/noSparseArraysRule.js:59:54)
  • TypeError: Cannot read property 'length' of undefined at Object.mapDefined (node_modules/tslint/lib/utils.js:159:55)

It seems to me like some of the typescript AST nodes no longer has properties that tslint is using.

P1 Bug

Most helpful comment

When upgrading to Angular 6 I have accidentally left rxjs-tslint in the devDependencies which pulled typescript@^2.8.0 which caused this same issue.

As a workaround - make sure that nothing is pulling different versions of typescript.

All 12 comments

@andy-ms any idea what is going on?

If it helps, this is no longer a problem (for me) with TypeScript version 2.7.2.
Maybe it was a bug in 2.7.1?

I am also on 2.7.2 and everything looks fine as well

Same problem

OSX: 10.13.3 (17D102)
yarn: 1.5.1,
tslint: 5.9.1, 
typescript: 2.7.2

@vire Try using npm and installing tslint@latest and typescript@next. The vscode error only happened when using yarn too.

After installing latest react-scripts-ts the problem disappeared for now - I suspect their dependencies were somehow incorrect :/

Also worth to mention the issue was present also in the CLI not just vscode

I experience this with
yarn 1.5.1
tslint: 5.9.1,
typescript: 2.7.2

Downgrading to yarn 1.3.2 resolved the issue.

When upgrading to Angular 6 I have accidentally left rxjs-tslint in the devDependencies which pulled typescript@^2.8.0 which caused this same issue.

As a workaround - make sure that nothing is pulling different versions of typescript.

I believe this has been fixed.

image
(from latest master build)

@smoke, can I ask you how to do to know if there are any dependency pulling typescript@^8.2.0 ?

@cvgavio look at package-lock.json or yarn.lock - if you see different versions of typescript installed there will be at least 2 records.

... and I did typo in my comment, the version is ^2.8.0 if that matters.

Was this page helpful?
0 / 5 - 0 ratings