Page MenuHomePhabricator

Integrate with LibUp
Closed, ResolvedPublic

Description

Get Toolhub setup so that https://www.mediawiki.org/wiki/Libraryupgrader will send us patches for library version bumps so nobody has to have a recurring calendar task to do that kind of work manually.

Event Timeline

Change 690803 had a related patch set uploaded (by Legoktm; author: Jforrester):

[labs/libraryupgrader/config@master] Run on wikimedia/toolhub

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

Change 690803 merged by jenkins-bot:

[labs/libraryupgrader/config@master] Run on wikimedia/toolhub

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

LibUp hit an error: https://libraryupgrader2.wmcloud.org/logs2/272265

$ ./node_modules/.bin/eslint . -f json

Oops! Something went wrong! :(

ESLint: 7.26.0

ESLint couldn't find the config "plugin:es/restrict-to-es5" to extend from. Please check that the name of the config is correct.

The config "plugin:es/restrict-to-es5" was referenced from the config file in "/src/repo/node_modules/eslint-config-wikimedia/vue-es5.js".

To reproduce:

  • Fresh clone of wikimedia/toolhub
  • Run npm ci
  • Edit package.json to switch eslint-config-wikimedia to 0.20.0
  • Run npm install && npm update eslint -depth 10
  • Then run ./node_modules/.bin/eslint . and hit the error.

Other things I noticed:

  • Running npm test doesn't seem to run the various linters, why not?
  • LibUp will work better if the eslint config is in .eslintrc.json rather than package.json, it'll be able to auto-disable failing rules by turning them into warnings so the upgrade happens and humans can re-enable the failing rules at their convenience.

Funny enough when I documented this in T279471: Upgrade to eslint-config-wikimedia 0.20.0, you replied implying that LibUp would magically fix everything. :)

Other things I noticed:

  • Running npm test doesn't seem to run the various linters, why not?

Because that's not how I wrote the package.json I guess. The test target runs unit tests and the lint target runs linters. Is there documentation somewhere of expected entrypoints for Wikimedia nodejs projects?

  • LibUp will work better if the eslint config is in .eslintrc.json rather than package.json, it'll be able to auto-disable failing rules by turning them into warnings so the upgrade happens and humans can re-enable the failing rules at their convenience.

I think the formats of the package.json eslintConfig section and a .eslintrc.json config file are the same. Would you be just as happy with a patch for LibUp that taught it how to check for the combined config like toolhub uses so that it would work with either setup?

Funny enough when I documented this in T279471: Upgrade to eslint-config-wikimedia 0.20.0, you replied implying that LibUp would magically fix everything. :)

Hah :D Let me look into it further...

Other things I noticed:

  • Running npm test doesn't seem to run the various linters, why not?

Because that's not how I wrote the package.json I guess. The test target runs unit tests and the lint target runs linters. Is there documentation somewhere of expected entrypoints for Wikimedia nodejs projects?

See https://www.mediawiki.org/wiki/Continuous_integration/Entry_points and https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Linting

  • LibUp will work better if the eslint config is in .eslintrc.json rather than package.json, it'll be able to auto-disable failing rules by turning them into warnings so the upgrade happens and humans can re-enable the failing rules at their convenience.

I think the formats of the package.json eslintConfig section and a .eslintrc.json config file are the same. Would you be just as happy with a patch for LibUp that taught it how to check for the combined config like toolhub uses so that it would work with either setup?

Yep, that would be fine too.

Change 692349 had a related patch set uploaded (by Legoktm; author: Legoktm):

[labs/libraryupgrader@master] Support reading ESLint config from package.json

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

Change 692349 merged by jenkins-bot:

[labs/libraryupgrader@master] Support reading ESLint config from package.json

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

Change 692673 had a related patch set uploaded (by BryanDavis; author: Bryan Davis):

[wikimedia/toolhub@main] npm: Use `npm test` as entrypoint for both lint and test

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

Change 692673 merged by jenkins-bot:

[wikimedia/toolhub@main] npm: Use `npm test` as entrypoint for both lint and test

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

bd808 assigned this task to Legoktm.

It's alive! https://gerrit.wikimedia.org/r/c/wikimedia/toolhub/+/692689

Thanks for your help in a) hacking your project to support us and b) sorting out our nodejs deps @Legoktm!