Skip to content

Commit

Permalink
Update eslint-config-wikimedia
Browse files Browse the repository at this point in the history
    npm i --engine-strict eslint-config-wikimedia@latest

And disable all the warnings for various reasons. I don’t find
n/no-unsupported-features/node-builtins useful at all – if the features
in question (global fetch, FormData, buffer.File, Response) were
declared experimental on the older Node versions we target, but have
since been stabilized in a stable release, and already work in the older
Node versions, then I think it’s fair to consider them supported there
too: I don’t see why they would be broken in newer releases on those
older branches. (And CI already checks that they work in the oldest Node
we target.) implicit-arrow-linebreak would require either an overlong
line or converting the expression into a block, neither of which I like
in combineParams(). And prefer-arrow-callback is explained in the
disable comment.

Also note that in the last two commits I used the npm option with a
wrong name – it’s --engine-strict, not --engines-strict. Apparently npm
silently ignores unknown options. (AFAICT it didn’t make a difference
for those particular commits anyway.)
  • Loading branch information
lucaswerkmeister committed Jan 1, 2025
1 parent 3717f93 commit ce23b6f
Show file tree
Hide file tree
Showing 5 changed files with 302 additions and 219 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"no-use-before-define": [ "error", "nofunc" ],
"no-shadow": "off",
"prefer-const": [ "error", { "destructuring": "all" } ],
"es/no-promise-any": "off"
"es/no-promise-any": "off",
"n/no-unsupported-features/node-builtins": "off"
},
"overrides": [
{
Expand Down
2 changes: 2 additions & 0 deletions combine.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ class CombiningSession extends Session {
*/
combineParams( paramsA, paramsB ) {
// never combine generator/continue with titles/pageids/revids
/* eslint-disable implicit-arrow-linebreak */
const hasParam = ( params, key ) =>
this.transformParamSingle( params[ key ] ) !== undefined;
const hasParams = ( params, ...keys ) =>
keys.some( ( key ) => hasParam( params, key ) );
/* eslint-enable */
if ( hasParams( paramsA, 'generator', 'continue' ) &&
hasParams( paramsB, 'titles', 'pageids', 'revids' ) ||
hasParams( paramsB, 'generator', 'continue' ) &&
Expand Down
Loading

0 comments on commit ce23b6f

Please sign in to comment.