Commit graph

14 commits

Author SHA1 Message Date
Mukunda Modell 2d6bd5f4b7 Remove comments from json file - won't pass scap's json lint
Comments in this json file preventing scap deploy

Change-Id: I71a3c29c0d0d6d125fff2803bb5d912536c1a4d0
2018-05-17 17:43:32 -05:00
Stephen Niedzielski 367b12a278 Hygiene: bump ESLint to ES6 and lint more files
- Bump the ESLint configuration ECMAScript 2015 given that we use Babel
  and have a safeguard to verify build products are ES5.

- Lint more files including all tests and the Webpack and Grunt configs.

Change-Id: I099cbe009eda2349ddc051976ace0d9f6c55fa30
2018-05-01 14:47:51 -05:00
jdlrobson 3245a2ac6e Hygiene: restrict use of $.each and fix offenders
Bug: T190142
Change-Id: I5da7a4a1ffe14647ec70b10b3a7ab9b935c5ca84
2018-03-21 14:24:22 -05:00
Stephen Niedzielski 007cc5ab7c Hygiene: favor string templates over concatenation
Update the ESLint config to favor ES6 strings where variables or string
concatenation is used and fix *all* offenders automatically via:

  eslint \
    --cache \
    --max-warnings 0 \
    --report-unused-disable-directives \
    --fix \
    src tests

Change-Id: I1a9345162348e5ded21d541e7a2ce251ea72ab5a
2018-03-21 08:05:55 -05:00
Stephen Niedzielski e284163014 Hygiene: use consistent ESLint severity syntax
Bug: T165036
Change-Id: I43a500fceb8179d30240dbec8ed56f8d4c7551e9
2018-03-21 10:45:09 +00:00
Stephen Niedzielski 57762e0417 Hygiene: favor const
Bug: T165036
Change-Id: I17d374eaac6627ca6a8ba178862b2a9cff2538c0
2018-03-21 10:44:24 +00:00
jenkins-bot 875789adf2 Merge "Hygiene: replace var with let and const" 2018-03-21 10:41:34 +00:00
Timo Tijhof 0f08ac9a9c Tooling: Remove some redundant max-len patterns
- `///` is not used in any linted files.
  It is/was used in webpack dist, but those are not and should not
  be passed through ESLint.
- `QUnit` was presumably added prematurely on the assumption
  that overly long test names should not be broken over multiple
  lines. However, being strings, they are already ignored.
- `// (?!eslint..)` was redundant. Ignoring warnings from max-len
  about an eslint-disable line has no influence on the actual
  parsing of those lines by ESLint.

Follows-up 807100b.

Bug: T185295
Change-Id: I2be2492848190b53d45240b38a08784b4a370819
2018-03-20 17:23:14 -07:00
Stephen Niedzielski 0bee0906d4 Hygiene: replace var with let and const
eslint \
    --cache \
    --max-warnings 0 \
    --report-unused-disable-directives \
    --fix \
    src tests

Change-Id: I051275126ae7fa9affd16c2504017c0584f2d9c7
2018-03-20 14:14:02 -05:00
joakin 807100bcca Limit line length to 80 characters
Enforce it with eslint.

Ignore:
* Comment lines with eslint disable directives
* QUnit test lines as they contain long subjects (QUnit.* (only, test,
  module, skip, etc)
* Strings, since long strings are used extensively in tests
  * Ignore template literals for similar reasons
* Regex literals as they may be too long, but can't be easily
  split in several lines
* Long urls

See bug for more general proposal for eslint-wikimedia-config.

Bug: T185295
Change-Id: I3aacaf46e61a4d96547c513073e179ef997deb09
2018-01-19 14:20:39 +01:00
joakin 4ed09011c2 Explicitly set ecmaVersion for eslint
Before, because of the use of sourceType: "module", ecmaVersion would be
assumed to be ES2015, but we write ES5 here at the moment.

This enables linting against ES2015 features like let and const.

See https://gerrit.wikimedia.org/r/#/c/374789/ for failing POC.

Change-Id: Id1d147866c37de3794213378a5e8a08af6f796a1
2017-08-30 13:47:49 +02:00
joakin e6081106f1 Use EcmaScript modules instead of common.js modules
Why: Because they are the approved standard by TC39 and Ecma for
JavaScript modules.

Changes:
  * Wrap mw-node-qunit in run.js to register babel to transpile modules
    for node v6
  * Change all sources in src/ to use ES modules
    * Change constants.js to be able to run without
      jQuery.bracketedDevicePixelRatio given ES modules are hoisted to
      the top by spec so we can't patch globals before importing it
  * Change all tests in tests/node-qunit/ to use ES modules
  * Drop usage of mock-require given ES modules are easy to stub with
    sinon

Additional changes:
  * Rename tests/node-qunit/renderer.js to renderer.test.js to follow
    the convention of all the other files
  * Make npm run test:node run only .test.js test files so that it
    doesn't run the stubs.js or run.js file.

Bug: T171951
Change-Id: I17a0b76041d5e2fd18e2d54950d9d7c0db99a941
2017-07-31 23:05:44 +00:00
jdlrobson 49df4b9572 Tooling: Begin to use webpack for JS code generation
Generate changeListeners via webpack
We now use a build folder to build the JavaScript for
our ResourceLoader modules. This is the first change
in a line of changes.
A source map is provided for debug support.

Bug: T156333
Change-Id: I771843d1ddb4b50adedc3fa53b30c2f1d8a76acb
2017-02-13 13:42:22 +01:00
joakin 4ca333e577 Remove jshint/jscs, add eslint and stylelint
...with the wikimedia presets.

For automatically fixing most of the JS lint problems run

      grunt eslint:fix

Some rules of stylelint were disabled given they cause problems with
existing popups code (like no id selectors for example).

Change-Id: I2153047c3ddbea50572dd329989088bb20787515
2016-12-16 13:35:34 +01:00