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.

"not-reachable" rule

See original GitHub issue

Question (or feature request if it isn’t possible at the moment)

Is it possible to declare an “not-reachable” rule, which is an extension of the “no-orphans” rule, but also checks for modules with outgoing imports. This rule would require to specify a list of “entry points”.

Example

Given

src/index.js       -> src/mod_a.js
src/mod_a.js       -> src/mod_b.js
src/mod_orphan.js  -> src/mod_b.js

Then this rule should report src/mod_orphan.js as “not reachable” (given ["src/index.js"] as “entry point list”).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ulrichbcommented, Jun 11, 2019

=> I’ve added a comment to the PR.

1reaction
sverweijcommented, Jun 4, 2019

hello again @ulrichb. At this moment this is indeed not possible, but it’d be a useful extension of the orphan rule as a ‘dead wood detector’.

I’ll have to mull over what an intuitive interface and a reasonable implementation would be - but it’s likely to be doable.

Kicking around some ideas for a configured rule like that:

{
  forbidden: [{
    name: "only-reachables-from-index",
    from: {
      path: "src/index.ts" // should we limit this to single files or would wildcards yield sensible results?
    },
    to: {
      pathNot: "\\.spec\\.ts$", // we probably want to exclude test specs
      reachable: false // new 'to restriction' property or call it 'notReachable'? What would give the least mental mapping?
    }
  }]
}

and/ or as an allowed rule, which might be slightly more readable

{
  allowed: [{
    from: {
      path: "src/index.ts"
    },
    to: {
      reachable: true 
    }
  }]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Useless variables in context-free grammars
All variables not marked "reachable" are non-reachable (by a simple induction on the length of derivations). Observe that a CFG has no useless...
Read more >
no-unreachable - ESLint - Pluggable JavaScript Linter
This rule disallows unreachable code after return , throw , continue , and break statements. This rule also flags definitions of instance fields...
Read more >
The rule I created does not work - Microsoft Support
Cause: Rules run automatically on messages only as you receive or send them. Solution: Manually apply a rule to messages that you have...
Read more >
How to Fix It When Outlook Rules Are Not Working - Lifewire
Start by deleting the rule that's not working, then run the Inbox Repair Tool. Fix corruption using an Exchange account.
Read more >
Not available rule - Pega Community
Not available rule ... Validation skips, and these rules are invisible to the rule resolution algorithm for all users, including yourself. These rules...
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