Commit graph

45 commits

Author SHA1 Message Date
Stephen Niedzielski f4f7f3623c [dev] Run npm t on Git pre-commit hook
Execute `npm test` prior to committing. This saves back-and-forth with
Jenkins. This is the same configuration used by Popups,
MobileFrontend, MinervaNeue, NearbyPages, ContentTranslation, and
others.

Change-Id: If61ab4f28b0ccd38492d11a4cd8a92a97b2eb582
2020-03-11 07:49:48 -06:00
libraryupgrader e9d9949048 build: Updating acorn to 7.1.1
* https://npmjs.com/advisories/1488

Change-Id: I4a6240c578be9b490cb824e24dbc252be60d9c7b
2020-03-08 19:06:33 +00:00
AronDemian b9968d9d93 build: Add 'svgo', SVG minifier script and unify SVGO rules
Adds:
- npm run svgmin
- .svgo.yaml: unified SVGO rules from Wikimedia coding conventions

Bug: T247004
Change-Id: I7017ecfebb811fa8d626747a830ad000774bbf2f
2020-03-07 19:47:58 -08:00
AronDemian 1b340724d4 Separate scripts npm test and npm run build, remove npm run doc from test
- npm doc: unchanged, but no longer called by 'test'
  * it is run on its own by 'mwext-node10-rundoc-docker' CI job.
  * successful build of the documentation is necessary for JenkinsBot to accept the patch
- npm test: runs only 'lint' as of now, future possibility: qunit tests too
  * run by CI job 'mwgate-node10-docker'
- npm build: runs 'test' and 'doc'
  * NOT run by CI jobs

Bug: T247004
Change-Id: I3e6e1ebb220ceb1a1591cb7087bbd071b1bacf8f
2020-03-05 23:43:39 +00:00
AronDemian 71ec758beb Add script 'npm run lint:fix' to fix trivial lint errors
Bug: T247004
Change-Id: Id40b82f64a5c29af4a8e2c7935623df6761d25b1
2020-03-05 22:26:06 +01:00
AronDemian 834f4f837f Port 'storybook' scripts to windows, merge 'jsdoc' into 'doc'
additional changes:
* the jsdoc npm command is removed intentionally to
avoid polluting package.json with too many jobs.

Change-Id: Ie49de1c4b7a40a835ea1b3f8bcdbb779ba919860
2020-03-05 17:48:01 +00:00
jenkins-bot 5b1d77fb9d Merge "Replace Grunt tasks with npm scripts in package.json" 2020-02-27 17:48:52 +00:00
Jan Drewniak 98b70067c9 Replace Grunt tasks with npm scripts in package.json
Adds the following npm scripts:
- npm run lint
- npm run lint:js
- npm run lint:styles
- npm run lint:i18n

Bug: T242781
Change-Id: I0c2cfce73a02029b9d0c4d329309aff477cb02d4
2020-02-27 16:32:12 +01:00
Nicholas Ray 7b7c948bf6 Add 'jsdoc-wmf-theme' to jsdoc
This adds the wmf theme styles to our jsdoc as can be seen on
https://doc.wikimedia.org/Parsoid/master/.

There is a caveat with this though. jsdoc-wmf-theme adds warnings for
unlinked symbols (e.g. 'return {jQuery}') [1] which causes the jsdoc doc
generation to fail since it is set to fail on warnings (we have it
configured with `pedantic: true`).

If we add the jsdoc-wmf-theme, we will need to be stricter about our
symbol usage which could be a good thing or just be tedious and
annoying.

What do you think?

[1] https://github.com/cscott/jsdoc-wmf-theme/blob/master/publish.js#L29

Bug: T239258
Change-Id: Icade62a278d7e685cbda28a8ca26a1b703e64f19
2020-02-14 10:43:46 -07:00
Nicholas Ray a79bb8dff4 build: Replace JSDuck with JSDoc
* jsdoc.json was copied from Minerva. The markdown plugin from that
config was removed since there no usages of that in Vector.

* Added latest jsdoc dependency to package.json

* Copied 'jsdoc' task from Minerva into Vector. Revised storybook output
so that multiple docs (storybook + jsdoc) could be in /docs

* Made collapsibleTabs.js JSDoc compliant (This was really the only
thing using jsduck syntax)

* Modified Gruntfile stylelinter to ignore docs folder

Bug: T239258
Change-Id: Id07d591ffe7bf0ac021109051e89b91ffdcf4c78
2020-02-14 10:29:00 -07:00
jdlrobson ea2bcd44f2 Add storybook to Vector
- Update package.json with the new dependencies.
- A script storybook.sh pulls down CSS and LESS imports from external
dependencies. This copies the approach taken in Popups and MobileFrontend.
- Icons from external repos are maintained within the repo in SVG-only form.
Using load.php modules is also possible, but will pull down other unnecessary icons
and break if any of these modules are changed. Decided that we should manually maintain
these for the time being given there are only 3 icons.
- Several LESS files now import the variables file. I think it's useful for stories
to only import the CSS they use as this encourages us to modularise our CSS. Before these
imports were not necessary as they inherit imports from index.less. This will have no impact
on the bundle size as the LESS compiler silently discards duplicate imports
- stories/utils.js provides a useful placeholder function for generalising our hook entry
points.

Bug: T242674
Change-Id: I722e84d2fb57653a2f96142dc3e5248043261746
2020-01-31 16:59:15 +08:00
libraryupgrader 24b72c8bfa build: Updating npm dependencies
* grunt-stylelint: 0.12.0 → 0.13.0
* stylelint-config-wikimedia: 0.7.0 → 0.8.0

Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: I59abf3b90868ae225a70bc3c0ba287f2c2335c8b
2020-01-10 18:36:03 +00:00
Ed Sanders c61f6469db build: Update linters
Change-Id: I17a65638e0c7d074d4c1db282b278798e875fbe1
2019-10-31 21:43:20 +00:00
Ed Sanders 370f52e692 build: Update linters
Change-Id: I58969b531c70eba70a7fa7a8fc0ba1ad521ba9f5
2019-10-07 16:41:27 +01:00
libraryupgrader 5914274354 build: Updating npm dependencies for security issues
* Updated stylelint-config-wikimedia to 0.6.0, addressing:
  * https://npmjs.com/advisories/786

Committed package-lock.json (T179229) too.

Change-Id: I8eafeb13195b405344ea6ce3da85a4c0f1c4e2a8
2019-06-09 06:51:07 +00:00
WMDE-Fisch 673fed9ac0 build: Upgrade eslint-config-wikimedia 0.12.0, drop grunt-jsonlint
Change-Id: Ie898fb12b4f144fcfa19c654fed48805df1ebe2d
2019-06-06 18:08:32 +02:00
Ed Sanders 7e76377bf8 build: Update eslint-config-wikimedia to 0.11.0
Change-Id: Idae38d2dff51827f7aff510d40b2358bf939b5e2
2019-03-13 23:23:14 +00:00
Ed Sanders e09e880e2f build: Update to eslint-config-wikimedia 0.10.1
Change-Id: Ie4363abc9c60291ef4a69f35973f3c25f5e3a3ec
2019-02-09 18:17:44 +00:00
Ed Sanders 8634a77d0e build: Update linters
Change-Id: I8b99db813f12dc2031b5a1c195e6480f5512792a
2019-01-11 13:03:15 +00:00
Volker E 20cbac1f5b build: Remove 'stylelint' package as it gets pulled-in by 'stylelint-config-wikimedia'
Change-Id: I164512519c0b34fc9d9a9415e55f265ebf3d1ad0
2019-01-09 13:14:10 -08:00
Volker E 0e089a0d4c build: Update 'stylelint-config-wikimedia' and make pass
Change-Id: I147ea18307c58c5091c5ad79585b5acec9d46235
2018-12-02 14:40:28 -08:00
Ed Sanders 828452ff27 build: Update eslint-config-wikimedia to 0.9.0
Change-Id: I3ea907f6ef3b6337c1e793668ae889610fc6a635
2018-11-26 23:39:36 +00:00
Ed Sanders 329f0c7327 build: Update devDependencies
eslint-config-wikimedia  0.7.2  →  0.8.1

Change-Id: I7a5553e9abf44fb681825c83c1984aae883f9c72
2018-11-01 11:20:46 +00:00
Ed Sanders 0b7cc4ffce build: Update linters
Change-Id: Ic11eea77b944cfc98e9494a9d215a138f386f1eb
2018-09-09 18:30:26 +00:00
James D. Forrester 2cd16d6012 build: Bump devDependencies to latest
grunt                        1.0.1  →   1.0.2
 grunt-banana-checker         0.5.0  →   0.6.0
 grunt-eslint                20.0.0  →  20.1.0
 grunt-stylelint              0.8.0  →   0.9.0
 stylelint                    7.8.0  →   8.2.0
 stylelint-config-wikimedia   0.4.1  →   0.4.2

Change-Id: I3b1c13f3fe5c4f1f90dd1db658700aecda0d0724
2018-02-26 10:29:23 -08:00
Ed Sanders 8842f744ee build: Update eslint-config-wikimedia 0.4->0.5, eslint 19->20
Change-Id: I61a9bc5567036dfcbc7697276583facbefac8b93
2017-08-25 16:21:21 +01:00
Antoine Musso 60d6ecbaad Define npm peer dependency explicitly
npm 3 requires dependencies to be explicitly defined.

Bug: T172094
Change-Id: Ic640ccf0f577e47036d473892522ea758014fab4
2017-07-31 12:04:32 +02:00
Ed Sanders ea6f33eff7 build: Update eslint to 0.4.0
Change-Id: I16ee2a0414cc79ae4fe32a55637f0d075956c1ba
2017-05-04 17:01:53 +01:00
Fomafix 0ce7fe792e Use tabs instead of spaces for indenting
Change-Id: Id88ed98763265f0eea75514e52fbd0f546ef72b4
2017-03-25 14:56:54 +01:00
James D. Forrester 298af67c06 build: Bump stylelint and make pass
grunt-stylelint              0.6.0  →   0.7.0
 stylelint-config-wikimedia   0.3.0  →   0.4.1

Change-Id: Id87b8df04d415e1f1058a4042a31408236402037
2017-02-17 16:34:04 -08:00
Ed Sanders 5cad73068e build: Update package versions and sort
Change-Id: Icfda010166b29916e2b3217873c30d459b4c041c
2017-01-23 15:04:05 +00:00
James D. Forrester 0019f6d5a5 build: Introduce stylelint and make pass
Change-Id: I48d542580d767df2d17ce4c6668e9e233a0f7904
2016-11-29 08:40:03 -08:00
James D. Forrester 9bd5ce5a1e build: Replace jshint and jscs with eslint
Change-Id: I48d542580d767df2d17ce4c6668e9e233a0f7903
2016-11-29 08:39:55 -08:00
Timo Tijhof 1f26153a5d collapsibleTabs: Clean up and simplify code
* Rename 'rtl' to 'isRTL' and use DOM to compute its value.
* Document code with JSDuck similar to other extensions.
* Remove unused 'prevElement' property. Not used in Vector
  nor anywhere else in Wikimedia Git.
* Make 'boundEvent' property private. Not used anywhere in
  Wikimedia Git outside this file.

* Simplify 'instances' tracking.
  The jQuery object stored in this property wasn't used beyond
  calling each(). Convert to a plain array.
  Preserve and re-use the jQuery object first created
  by collapsibleTabs().

* Simplify calculateTabDistance() by using getElementById() and
  getBoundingClientRect(). Its support includes IE 5.
  The "new" version (since Firefox 3.5 and IE 9) also includes
  'height' and 'width' properties and is supported in all
  browsers supported by the MediaWiki 1.28 startup feature test.

  This helps avoid code in offset() and width(), which is fairly
  expensive in jQuery 1.x.

* moveToCollapsed()
  - Remove redundant jQuery object creation (only caller passes a
    jQuery object already).
  - Remove redundant re-receiving of expContainerSettings inside
    the animate() callback. Already in the main scope.
    Relates to a bunch of patches that work around a problem
    caused by use of remove() instead of detach() in an earlier
    version of the code. Which was only a problem because the
    other settings object was also not used from the main scope.
    (See pre-Gerrit commits 1f93310e and e7900807.)

Change-Id: I48d542580d767df2d17ce4c6668e9e233a0f7902
2016-11-29 02:25:00 +00:00
Paladox 43207bb62d Update three packages
Update grunt-contrib-jshint to 1.0.0

Update grunt-banana-checker to 0.5.0

Update grunt-jscs to 2.8.0

Change-Id: I2875efab17acc9007725f1e79b9353cb8b0ceb3f
2016-03-30 22:36:42 +01:00
Paladox 0f7f31f519 Update grunt-jscs to 2.6.0
Change-Id: I765880ee81a466f302dd677372e32ad0a3ff302e
2016-01-19 14:26:27 +00:00
Paladox 76b668eaf5 Update grunt-jsonlint to 1.0.7 and MW codesniffer to 0.5.1
Change-Id: If8c4cc68156467746a679144039b978fe0247401
2015-12-29 11:33:41 +00:00
Paladox f43716fcfe Update grunt-jscs to 2.5.0
Change-Id: I79bda05766997f4bb73b8948215ed1b41c3e2d49
2015-12-09 22:13:37 +00:00
Paladox a4134557e9 Update packages
Update grunt-jscs to 2.3.0

Update grunt-jsonlint to 1.0.6

Add new jscs-preset-wikimedia package.

Change-Id: Ie175abf1d692dac78afe02b2d70867c1369353b4
2015-11-07 17:45:46 +00:00
Paladox 6aef338da9 Update grunt-jscs to 2.2.0
Change-Id: I9452e2c89030e7d5d391bda9fdc73e09b4392c09
2015-10-26 19:09:11 +00:00
Paladox b0f69b2dc4 Update grunt-banana-checker to 0.4.0
Difference between 0.2.2 and 0.4.0

0.4.0

* Make disallowUnusedTranslations default to false (Ed Sanders)
* Make disallowDuplicateTranslations default to false (Ed Sanders)
* build: Remove use of global grunt-cli (Timo Tijhof)
* build: Add Node.js v0.12 and v4.0 (Timo Tijhof)
* tests: Migrate Travis to container-based infrastructure (James D.
* Forrester)
* readme: Add line break between images and h1 (Timo Tijhof)

0.3.0

* Fail if the target directory doesn't exist (James D. Forrester)
* Allow individual checks to be disabled in config (James D. Forrester)
* Be able to require complete translations, or specific messages in all
* translations (James D. Forrester)
* build: Bump grunt-jscs to latest version (James D. Forrester)
* Enforce disallowBlankTranslations, disallowDuplicateTranslations and
* disallowUnusedTranslations (James D. Forrester)

Change-Id: I68c5c747d2f92fdedd7e4450f618f577f493fb4a
2015-10-22 00:55:15 +01:00
paladox 95ef8f2cc6 Update jscs to 2.1.0
Change-Id: Ibba453510c8e15c3e915d28f7ecf7c296bca7894
2015-10-22 00:38:01 +01:00
Paladox fabd6209fe Update grunt-jsonlint to 1.0.5
Change-Id: Ie5f30e6a95fb0a185f74caf6c89dd1a77a507acd
2015-10-19 21:47:57 +01:00
James D. Forrester 3f3bde51c8 build: Bump grunt-contrib-jshint from 0.11.2 to 0.11.3 to fix upstream issue
Change-Id: I768203d6fbdf47bcc845a301a883e84b0c743c2e
2015-09-03 14:14:23 -07:00
Kunal Mehta 1a3fb084ba build: Configure jshint, jsonlint, banan-checker & jscs
Change-Id: Ifab90f787bd2c4d8539698c3828c3486a3559bdb
2015-06-25 23:35:53 +00:00