Opened on 10/31/2018 at 01:21:46 AM

Last modified on 11/20/2018 at 02:51:44 AM

#7084 new defect

Add no-use-before-define rule to our eslint config

Reported by: erikvold Assignee:
Priority: Unknown Milestone:
Module: Infrastructure Keywords:
Cc: sebastian, greiner Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by erikvold)

I'm not sure why we are not using the no-use-before-define in our eslint config.

https://eslint.org/docs/rules/no-use-before-define

Attachments (0)

Change History (8)

comment:1 Changed on 10/31/2018 at 01:23:15 AM by erikvold

  • Description modified (diff)

comment:2 Changed on 10/31/2018 at 01:34:42 AM by erikvold

  • Blocking 6833 added

comment:3 follow-up: Changed on 10/31/2018 at 09:45:10 PM by sebastian

  • Cc sebastian added

Will circular dependencies still work with that rule?

function foo()
{
  if (...)
    bar();
}

function bar()
{
  if (...)
    foo();
}

comment:4 Changed on 10/31/2018 at 10:05:13 PM by sebastian

  • Blocking 6833 removed

comment:5 in reply to: ↑ 3 Changed on 11/01/2018 at 08:44:09 AM by erikvold

Replying to sebastian:

Will circular dependencies still work with that rule?

function foo()
{
  if (...)
    bar();

I'm pretty sure this line would break the rule.

We'd just have to add an exception for this pattern when we want to use it, or find an alternative implementation.

comment:6 Changed on 11/02/2018 at 01:06:08 PM by greiner

  • Cc greiner added

comment:7 Changed on 11/02/2018 at 01:18:01 PM by agiammarchi

my 2 cents: I think in UI we are very aware of how functions hoisting work so, as long as { "functions": false } is used, I personally wouldn't mind having this rule in.

comment:8 Changed on 11/20/2018 at 02:51:44 AM by sebastian

No objections either from my end, with functions: false.

Add Comment

Modify Ticket

Change Properties
Action
as new .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from (none).
Next status will be 'reviewing'.
 
Note: See TracTickets for help on using tickets.