Kibana: [DISCUSS] Remove unused params and vars and enforce

Created on 21 May 2019  路  3Comments  路  Source: elastic/kibana

We have a lot of unused params and variables in our codebase. For the most part this is harmless, but I'm working on removing angular dependency injection and for this concern it adds confusion. There are many places where dependencies are defined as function params yet are unused.

In some portions of the codebase we're modifying or disabling the no-unused-vars eslint rule. I'm uncertain if this is intentional moving forward or if it was an easy way to pass CI in a tough moment.

One particular use case for unused vars is when you need to skip some positional arguments to a function. There are two ways of addressing this. You can disable the eslint rule for the line or you can assign the variable to an empty object - {}. While terse, the empty object is indirect about its intention.

Thoughts?

New Vis AppServices discuss

Most helpful comment

I'd be on board with enabling something like no-unused-vars after-used throughout the entire code-base, but I'd prefer we don't further implement the precedent set by https://github.com/elastic/kibana/pull/37051 where we have to litter the non-angular code with eslint ignores when we have unused positional arguments in non-angular code. This is rather common, and I think it's going to lead to a poor developer experience if we have to commonly specify eslint ignores.

All 3 comments

I'd be on board with enabling something like no-unused-vars after-used throughout the entire code-base, but I'd prefer we don't further implement the precedent set by https://github.com/elastic/kibana/pull/37051 where we have to litter the non-angular code with eslint ignores when we have unused positional arguments in non-angular code. This is rather common, and I think it's going to lead to a poor developer experience if we have to commonly specify eslint ignores.

I honestly didn't even know that "all" was an option for this lint rule -- if you need the 2nd variable passed to a function but not the first, how are you supposed to access it?

That said, in general I like using "after-used" which makes much more sense to me, probably just because that's what I'm used to. :)

Pinging @elastic/kibana-app-arch

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cafuego picture cafuego  路  3Comments

socialmineruser1 picture socialmineruser1  路  3Comments

timroes picture timroes  路  3Comments

timroes picture timroes  路  3Comments

spalger picture spalger  路  3Comments