ESLint executes on one file at a time, it doesn’t retain any information about 
scope or variables between executions, so detecting an unused method anywhere 
in the project would not be possible at this point. We do want to investigate 
retaining information between executions on different files, but there’s a huge 
number of problems we would need to resolve in order to do that. So this is not 
something we are planning on doing in the immediate future.

 

Thanks,

 

                                Ilya Volodin

 

From: [email protected] [mailto:[email protected]] On Behalf Of 
voyti
Sent: Tuesday, November 14, 2017 6:45 PM
To: ESLint <[email protected]>
Subject: Re: [ESLint] Dead code eliminator?

 

A follow-up question then - is there a way an unused method can be detected 
within a project? I'm guessing not, but I want to make sure before posting 
feature proposal (I've searched as well with no results).

What I mean is a method definition, with no calls  to that method anywhere in 
the project. A simplest approach would be to define a pseudo-privacy prefix 
(usually underscore), that Eslint would use to determine method/function as 
private to the current class/module. 



W dniu środa, 11 maja 2016 17:06:33 UTC+2 użytkownik Ilya Volodin napisał:

ESLint only executes on one file at a time, so it can't trace cross-file 
dependencies. Within a context of a single file we have 
http://eslint.org/docs/rules/no-unreachable rule which would find code that's 
not possible to execute. 

Thanks, 

                Ilya Volodin 

-----Original Message----- 
From: [email protected] <javascript:>  [mailto:[email protected] 
<javascript:> ] On Behalf Of Eric Prickett 
Sent: Wednesday, May 11, 2016 12:15 AM 
To: ESLint <[email protected] <javascript:> > 
Subject: [ESLint] Dead code eliminator? 

Hi everyone, I just introduced eslint at work on our node/react projects and 
love it. I was wondering if there's a rule or plugin that can identify dead 
code? We all know that guy that leaves it around... I don't want a cemetery in 
my projects though! 

As an example some IDEs like IntelliJ are able to identify that a function 
isn't called anywhere in a project. 

Thanks, 
Eric 

-- 
You received this message because you are subscribed to the Google Groups 
"ESLint" group. 
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected] <javascript:> . 
For more options, visit https://groups.google.com/d/optout. 

-- 
You received this message because you are subscribed to the Google Groups 
"ESLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected] 
<mailto:[email protected]> .
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"ESLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to