question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Processes and reports false positives for non-project files

See original GitHub issue

Thanks for creating ts-prune, it works really well! It just correctly found 80 unused exports from our project!

One problem that I have though is ts-prune processes some files that are not specified in tsconfig.json’s “include” property, and also reports false positives for those files.

The exports (not unused) that are reported incorrectly are in the path .circleci/ecs-deployment/src/aws.ts and they’re imported from .circleci/ecs-deployment/src/index.ts, in case these file paths are somehow causing the bug.

My tsconfig.json
{
  "compilerOptions": {
    "allowJs": false,
    "jsx": "react",
    "moduleResolution": "node",
    "outDir": "out",
    "sourceMap": true,
    "strictNullChecks": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true,
    "skipLibCheck": true,
    "target": "es6",
    "module": "commonjs",
    "lib": [
      "dom",
      "es2017"
    ]
  },
  "include": [
    "backend",
    "client",
    "common",
    "migrations",
    "scripts",
    "test",
    "types"
  ]
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
nadeeshacommented, Jun 11, 2019

Thanks for reporting this @emlai.

If it’s not specified in the tsconfig.json, and if you still want to ignore them, what you outlined in #13 seems like a good option.

I’m putting most of my effort right now in performance improvements. It would be a while before I get to this. However, if you want to do a PR for it, I’m more than happy to guide you through it.

In the meantime, ts-prune | grep -v .circleci/ecs-deployment/src might work for that directory?

0reactions
emlaicommented, Aug 5, 2019

@nadeesha Yeah I can confirm 1 is what’s happening. The directory structure looks like this (so e.g. we have a separate tsconfig there):

Screen Shot 2019-08-05 at 10 36 08

A file inside .circleci/ecs-deployment/src is being imported from one of the main project files.

If I add .circleci/ecs-deployment to the main tsconfig, then the false positives go away. Adding only .circleci doesn’t work. However, adding .circleci/ecs-deployment to the main tsconfig causes the project to not compile, so we can’t simply do that.

Still, would be nice if there were no false positives reported when we import files not specified in tsconfig.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Combining the red flag approach with process mining
The aim of our research is to reduce the number of false positives by combining the red flag-based approach with process mining.
Read more >
False-Positive Results in Rapid Antigen Tests for SARS-CoV-2
This study examines the incidence of false-positive results in a sample of rapid antigen tests used to serially screen asymptomatic workers ...
Read more >
7 ways to filter out cyber alert false positives - GCN
2. Test the rules as silent rules before committing them. This will help determine whether the rules are generating false positives without ...
Read more >
Determining Occurrence Dynamics when False Positives Occur
We demonstrate how to simultaneously account for non-detection (false negatives) and misclassification (false positives) when estimating ...
Read more >
On Their Watch - Human Rights Watch
Seven years after the false positives scandal erupted, ... the army reported as killed in military operations grew from 27 in 2004, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found