Page MenuHomePhabricator

Streamline import/require format in the frontend
Closed, ResolvedPublic

Description

Description

There are currently 2 different ways dependencies are implemented in the codebase.

// The dependency is directly extracted from the require call
var Foo = require('<path>' ).Foo;

// The dependency is extracted through destructuring
var { Foo } = require('<path>');

Note

  • There is currently no preferred approach to importing dependencies.
  • We need to pick an approach for importing dependencies and convert all imports to use the same approach.
  • This will aid with consistency and reduction of tech debt.

Desired behavior/Acceptance criteria

  • Convert all import statements in JS files to use a consistent import strategy
  • Convert all import statements in Vue files to use a consistent import strategy

Completion checklist

Event Timeline

As of writing, we have 194 matches to … = require(…).Foo and 58 for { Foo } = require(…). I slightly prefer the latter, but happy to be convinced either way.

Change #1069187 had a related patch set uploaded (by Daphne Smit; author: Daphne Smit):

[mediawiki/extensions/WikiLambda@master] Require: Streamline import/require format in the frontend

https://gerrit.wikimedia.org/r/1069187

Change #1069187 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Require: Streamline import/require format in the frontend

https://gerrit.wikimedia.org/r/1069187

Change #1072214 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] code: Streamline import/require format in the frontend's JS files

https://gerrit.wikimedia.org/r/1072214

Change #1072214 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] code: Streamline import/require format in the frontend's JS files

https://gerrit.wikimedia.org/r/1072214

Jdforrester-WMF updated the task description. (Show Details)