Skip to content

allowUnreachableCode has to be turned off due to third party libraries. #10233

Closed
@Vaccano

Description

@Vaccano

This is a feature request:

I get the following error when I build my webpack project:

[default] C:\myPath\my-project\node_modules\bluebird\js\release\util.js:201:5
Unreachable code detected.
[default] Checking finished with 1 errors

This is a problem in the bluebird npm library.

But I don't want to have errors in my build. So I have to add this to my tsconfig.json to get this error to turn off:

"allowUnreachableCode": true

But that is kind of a shame, because I don't want to allow unreachable code in my code, I just don't want to see errors for unreachable code that is in my node_modules. (I can't change node_module files without messing up my autobuild.)

So:
I am seeing code in node_modules inspected for unreachable code.

What I would expect (or want) to see is that node_modules is excluded from the unreachable code inspection.

In case it matters, here is my tsconfig.json:

{
  "compilerOptions": {
    "target": "es2015",
    "module": "es2015",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "sourceMap": true,
    "allowJs": true,
    "allowUnreachableCode": true
  },
  "awesomeTypescriptLoaderOptions": {
    "doTypeCheck": true,
    "forkChecker": true,
    "useBabel": true,
    "useCache": true,
    "babelOptions": {
      "presets": ["es2015-loose-native-modules"]
    }
  },
  "exclude": [
    "node_modules",
    "dist",
    "release",
    "index.js",
    "webpack.config.js",
    "config"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design LimitationConstraints of the existing architecture prevent this from being fixedOut of ScopeThis idea sits outside of the TypeScript language design constraintsSuggestionAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it adds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions