16 Commits

Author SHA1 Message Date
Andrew Nicols
a8897c3517 MDL-72013 js: Configure eslint-jsdoc plugin
This change adds configuration for the eslint-jsdoc plugin in order to
detect the following errors with jsdoc blocks:
* missing params
* params in incorrect order
* params with no type defined
* properties incorrectly defined
* incorrect use of @package
* incorrect values for @access

In addition, warnings will be thrown where indentation is incorrect.
2021-10-21 13:28:04 +08:00
Andrew Nicols
1a62c82fef MDL-71113 js: Add jsdoc configuration and Grunt 2021-06-18 09:38:04 +08:00
Andrew Nicols
61fca0e05c MDL-68496 grunt: Restructure grunt tasks into subdirectories
Prior to this change all Grunt features were in a single Gruntfile.js
but this has become difficult to manage and maintain.

This commit moves the existing dependencies for component calculation
and babel moduel definition into a new .grunt directory, and
restructures the existing tasks in Gruntfile.js into separate task
configuration files.

This improves the maintainability of the Grunt build system and allows
for easier future expansion.
2021-03-19 12:56:35 +08:00
Andrew Nicols
324f76308d MDL-66265 javascript: More specific overrides in eslintrc 2019-09-04 10:47:21 +08:00
Andrew Nicols
f59ac4166c MDL-66265 javascript: Add jshint ignore for ES6 files in root dir 2019-09-04 06:48:11 +08:00
Andrew Nicols
9ea892d216 MDL-66192 javascript: Allow subdirs in AMD module names 2019-07-26 07:04:08 +08:00
Ryan Wyllie
c53f86d408 MDL-62497 javascript: add babel transpiling to Grunt for ES6 support 2019-07-19 14:12:48 +08:00
Dan Poltawski
6f601313f0 MDL-59761 eslint: support glob-based configuration
Since ESlint 4.1.0 [1], it's possible to support glob-based
configuration, this means we can move glob configuration out of grunt
and into the config file, which means tools will respect the glob rules
now too. :)

[1] http://eslint.org/blog/2017/06/eslint-v4.1.0-released
2017-09-06 08:53:50 +01:00
Dan Poltawski
9702503f6b MDL-59761 eslint: Upgrade to v4.4.1
Including adding some new default rules.
2017-09-06 08:53:50 +01:00
Dan Poltawski
66a91ddada MDL-57139 eslint: enable eslint-plugin-promise rules
For promise best practices
2017-06-01 10:27:58 +01:00
Dan Poltawski
00c714f05c MDL-55835 eslint: bump to v3.7.1
1) Bump eslint verson in npm
2) Enable tabs rule introduced in 3.2.0
3) With rules deprecated in 3.3.0 to their replacements
   http://eslint.org/blog/2016/08/eslint-v3.3.0-released
4) Deprecate the use of M.str (fixes MDLSITE-3646) with new
   no-restricted-properties introduced in 3.5.0
5) Fixup no-unused-vars - remove argsIgnorePattern which shouldn't have allowed
   partial matches and turns out to be uncesssary
   (detected because of https://github.com/eslint/eslint/issues/7250 in 3.6.0)
2016-10-07 10:00:26 +01:00
Dan Poltawski
ad3f8cd18c MDL-54944 eslint: make the .eslintrc default stricter
Instead of using the more rollup-tolerant config for all files, make the
configuration stricter by default but lower in grunt for yui modules.

This means that manual runs (prechecker) or editor integrations will
flag up the errors as well as grunt.

Also add ignore lines to the core files so that eslint isn't noisy when
not running with grunt.
2016-07-11 12:44:34 +01:00
Dan Poltawski
037de71996 MDL-54944 eslint: Add rules from Policy decision
Also bump eslint to v2.13.1 and make the version explicit in
package.json
2016-07-07 12:10:49 +01:00
Dan Poltawski
0d06a20038 MDL-54939 eslint: tweak rules
1) Allow jsdoc descriptions to be empty. I think that matches our phpdoc
checker, and I think its probably better than me filling the
descriptions in poorly.

2) For the captilisation rules, don't apply to object properties (this
is because jQuery has lots of violators of this rule)
2016-06-16 19:33:00 +01:00
Dan Poltawski
be4b3cc6c7 MDL-52127 js: switch to a more YUI tolerant eslint config
Instead of having the stricter configuration for all files, use
the less strict default config and switch to the stricter config
for building AMD modules.

This means that the eslint commandline/editor inspections will work
better for all files and not generate false positives when using editor
integrations. But since grunt is required to build AMD modules we still
get the stricter checking for those files on build.
2016-06-14 00:37:28 +01:00
Dan Poltawski
3adb62b727 MDL-52127 js: check amd files with eslint grunt task
I have spent quite a lot of time working through the current list of
eslint options and configuring them for Moodle style and I think this is
a very good basis to start us at (as well as taking some of out jshint
options out with https://www.npmjs.com/package/polyjuice ). Thanks to
Andrew Nicols, Mark Johnson and Frédéric Massart for some refinements.

With this configuration the grunt build will fail if errors are present
in the js (though you can of course tell jshint to ignore some errors,
as I have done in admin/tool/lp/amd/src/competency_rule_points.js and
defining the Y global in lib/amd/src/yui.js ).

The grunt task will not report warnings by default, but a new
--show-lint-warnings flag will help achieve that. Editor
integrations/stanadalone eslint tool will surely be a better way of
getting eslint errors rather than using the grunt task.
2016-06-11 10:14:35 +01:00