Opened 10 months ago

Last modified 9 months ago

#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

Change History (8)

comment:1 Changed 10 months ago by erikvold

  • Description modified (diff)

comment:2 Changed 10 months ago by erikvold

  • Blocking 6833 added

comment:3 follow-up: Changed 10 months ago by sebastian

  • Cc sebastian added

Will circular dependencies still work with that rule?

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

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

comment:4 Changed 10 months ago by sebastian

  • Blocking 6833 removed

comment:5 in reply to: ↑ 3 Changed 10 months ago 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 10 months ago by greiner

  • Cc greiner added

comment:7 Changed 10 months ago 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 9 months ago by sebastian

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

Note: See TracTickets for help on using tickets.