Thiemo Mättig (WMDE) has submitted this change and it was merged.
Change subject: Added type checks to wikibase.api.RepoApi functions
..
Added type checks to wikibase.api.RepoApi functions
Actually reflecting parameter documentation in the code instead of relying on
the back-end handling.
This resolves some wrong documentation as well.
Added tests testing the minimum of parameters required by each function.
Change-Id: I4d043f5cc43852970a489014bc5c106592ccfdc3
---
M .jshintrc
M README.md
M src/RepoApi.js
A tests/.jshintrc
M tests/RepoApi.tests.js
5 files changed, 557 insertions(+), 149 deletions(-)
Approvals:
Thiemo Mättig (WMDE): Verified; Looks good to me, approved
diff --git a/.jshintrc b/.jshintrc
index 09f9407..239b121 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -1,52 +1,52 @@
{
- bitwise : true, // Prohibit bitwise operators (, |, ^, etc.).
+ bitwise: true, // Prohibit bitwise operators (, |, ^, etc.).
camelcase: true, // Force variable names to be camelcase
- curly : true, // Require {} for every new block or scope.
- eqeqeq : true, // Require triple equals i.e. `===`.
+ curly: true, // Require {} for every new block or scope.
+ eqeqeq: true, // Require triple equals i.e. `===`.
es3: true, // Prohibit trailing comma in object literals (breaks
older versions of IE)
- forin : false, // Don't expect `for in` loops to call
`hasOwnPrototype`.
+ forin: false, // Don't expect `for in` loops to call
`hasOwnPrototype`.
freeze: true, // Prohibit overwriting prototypes of native objects
such as Array, Date and so on.
- immed : true, // Require immediate invocations to be wrapped in
parens e.g. `( function(){}() );`
- latedef : true, // Prohibit variable use before definition.
- newcap : true, // Require capitalization of all constructor functions
e.g. `new F()`.
- noarg : true, // Prohibit use of `arguments.caller` and
`arguments.callee`.
- noempty : true, // Prohibit use of empty blocks.
+ immed: true, // Require immediate invocations to be wrapped in parens
e.g. `( function(){}() );`
+ latedef: true, // Prohibit variable use before definition.
+ newcap: true, // Require capitalization of all constructor functions
e.g. `new F()`.
+ noarg: true, // Prohibit use of `arguments.caller` and
`arguments.callee`.
+ noempty: true, // Prohibit use of empty blocks.
nonbsp: true, // Prohibit nbsp
- nonew : true, // Prohibit use of constructors for side-effects.
- plusplus : false, // Allow use of `++` `--`.
- regexp : true, // Prohibit `.` and `[^...]` in regular expressions.
- undef : true, // Require all non-global variables be declared before
they are used.
- unused : false, // Don't warn about unused variables
- strict : true, // Require `use strict` pragma in every file.
- trailing : true, // Prohibit trailing whitespaces.
+ nonew: true, // Prohibit use of constructors for side-effects.
+ plusplus: false, // Allow use of `++` `--`.
+ regexp: true, // Prohibit `.` and `[^...]` in regular expressions.
+ undef: true, // Require all non-global variables be declared before
they are used.
+ unused: false, // Don't warn about unused variables
+ strict: true, // Require `use strict` pragma in every file.
+ trailing: true, // Prohibit trailing whitespaces.
- asi : false, // Don't tolerate Automatic Semicolon Insertion (no
semicolons).
- boss : false, // Don't tolerate assignments inside if, for while.
Usually conditions loops are for comparison, not assignments.
- debug : false, // Don't allow debugger statements e.g. browser
breakpoints.
- eqnull : false, // Don't tolerate use of `== null`.
- es5 : false, // Don't allow EcmaScript 5 syntax.
- esnext : false, // Don't allow ES.next specific features such as
`const` and `let`.
- evil : false, // Don't tolerate use of `eval`.
- expr : false, // Don't tolerate `ExpressionStatement` as Programs.
- funcscope : false, // Don't tolerate declarations of variables inside
of control structures while accessing them later from the outside.
- globalstrict : false, // Don't allow global use strict (also
enables 'strict').
- iterator : false, // Don't allow usage of __iterator__ property.
- lastsemic : false, // Don't tolerat missing semicolons when the it is
omitted for the last statement in a one-line block.
- laxbreak : true, // Tolerate unsafe line breaks e.g. `return [\n] x`
without semicolons.
- laxcomma : false, // Don't suppress warnings about comma-first coding
style.
- loopfunc : false, // Don't allow functions to be defined within loops.
- multistr : false, // Don't tolerate multi-line strings.
- onecase : false, // Don't tolerate switches with just one