angelozerr / tslint-language-service

TypeScript 2.2.1 plugin for tslint
MIT License
188 stars 22 forks source link

Dynamic import: unused expression #45

Closed screendriver closed 7 years ago

screendriver commented 7 years ago

TypeScript code being linted

if (process.env.NODE_ENV !== 'production') {
  import('my-dev-package');
}

with tslint.json configuration:

{
  "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"]
}

Actual behavior

In Visual Studio Code I get following error: [tslint] unused expression, expected an assignment or function call (no-unused-expression)

Strangely if I run tslint from the command line I don't get this error

Expected behavior

No error should be shown.

screendriver commented 7 years ago

Nevermind. I forgot to change the TypeScript language level in my VSCode workspace to 2.4.1 🙄