codeclimate-tslint icon indicating copy to clipboard operation
codeclimate-tslint copied to clipboard

TSLint does not seem executed in the correct directory

Open victornoel opened this issue 7 years ago • 7 comments

I have the following directory structure:

  • frontend/
    • tslint.json
    • src/
  • backend
    • ...

I configured the plugin with config: frontend/tslint.json and because my configuration contains:

{
  "extends": [
    "./tslint-ng.json",
    "tslint-config-prettier"
  ],
  ...
}

I get the following error when executing the analysis:

Running tslint: Done!
error: (CC::CLI::Analyze::EngineFailure) engine tslint failed with status 1 and stderr 
/usr/src/app/node_modules/tslint/lib/configuration.js:55
        throw new error_1.FatalError("Failed to load " + configPath + ": " + error.message, error);
        ^

FatalError: Failed to load /tmp/codeclimate-tslint/9ddea5fbe123e05b4a94f1fd95a13b767785a76dd11b5242cac373a8bedca685.json: Invalid "extends" configuration value - could not require "./tslint-ng.json". Review the Node lookup algorithm (https://nodejs.org/api/modules.html#modules_all_together) for the approximate method TSLint uses to find the referenced configuration file.
    at FatalError.Error (native)
    at new FatalError (/usr/src/app/node_modules/tslint/lib/error.js:27:28)
    at Object.findConfiguration (/usr/src/app/node_modules/tslint/lib/configuration.js:55:15)
    at new TsLinter (/usr/src/app/dist/tsLinter.js:33:57)
    at Object.<anonymous> (/usr/src/app/dist/index.js:26:18)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)

victornoel avatar Feb 28 '18 14:02 victornoel

Hey @tkqubo! Stumbled across this issue because I was also investigating it. I was able to replicate a similar issue on a few open source projects:

https://github.com/ReactiveX/rxjs https://github.com/angular/material2

/usr/src/app/node_modules/tslint/lib/configuration.js:55
        throw new error_1.FatalError("Failed to load " + configPath + ": " + error.message, error);
        ^

larkinscott avatar Mar 15 '18 21:03 larkinscott

Me too! Need any help fixing this?

jakeleboeuf avatar Apr 09 '18 22:04 jakeleboeuf

having the same problem here...

cice avatar May 08 '18 08:05 cice

any updates on this? any workarounds? at the moment we are not able to use tslint in codeclimate at all...

cice avatar May 24 '18 12:05 cice

Bump. Would be nice to get some sort of feedback on this one.

PhilippMeissner avatar Aug 09 '18 05:08 PhilippMeissner

There seems to be a bunch of issues connected to this problem, such as: https://github.com/tkqubo/codeclimate-tslint/issues/51

arboleya avatar Sep 21 '18 20:09 arboleya

Does anybody have any idea why this is happening? I'm having the same problem trying to use "rulesDirectory": ["codelyzer"]:

FatalError: Failed to load /tmp/codeclimate-tslint/05f2da994f0ff2d0b33365fad2d0b1298e0e03b0f232cb890ff97b4ecc48f69b.json: Could not find custom rule directory: /code/codelyzer
    at new FatalError (/usr/src/app/node_modules/tslint/lib/error.js:27:28)
    at Object.findConfiguration (/usr/src/app/node_modules/tslint/lib/configuration.js:57:15)
    ...

Is this an issue with this plugin, or an issue in CodeClimate's plugin system?

mltsy avatar May 31 '19 00:05 mltsy