Skip to content

Commit

Permalink
add more eslint-config-wikimedia rules. apply autofixes (#375)
Browse files Browse the repository at this point in the history
- add more eslint-config-wikimedia rules
- apply autofixes
- set un-autofixed errors to warn or off
- add server.js to .eslintignore since I couldn't figure out how to handle that error
  • Loading branch information
NovemLinguae authored Aug 26, 2024
1 parent 8bda236 commit 2523eb9
Show file tree
Hide file tree
Showing 7 changed files with 616 additions and 617 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
server.js
22 changes: 21 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"extends": "wikimedia",
"extends": [
"wikimedia/client/es6",
"wikimedia/jquery",
"wikimedia/mediawiki"
],
"env": {
"browser": true,
"jquery": true
Expand All @@ -25,15 +29,31 @@
"rules": {
"camelcase": "off",
"eqeqeq": "warn",
"es-x/no-array-prototype-includes": "warn",
"es-x/no-object-values": "warn",
"es-x/no-regexp-s-flag": "warn",
"max-len": "off",
"no-console": "off",
"no-global-assign": "warn",
"no-implicit-globals": "warn",
"no-jquery/no-animate": "warn",
"no-jquery/no-class-state": "off",
"no-jquery/no-each-util": "warn",
"no-jquery/no-extend": "off",
"no-jquery/no-global-selector": "off",
"no-jquery/no-grep": "warn",
"no-jquery/no-in-array": "warn",
"no-jquery/no-map-util": "warn",
"no-jquery/no-sizzle": "warn",
"no-jquery/no-slide": "warn",
"no-jquery/no-trim": "warn",
"no-jquery/variable-pattern": "warn",
"no-new": "warn",
"no-prototype-builtins": "off",
"no-shadow": "off",
"no-undef": "warn",
"no-underscore-dangle": "off",
"prefer-const": "warn",
"security/detect-non-literal-regexp": "off",
"security/detect-unsafe-regex": "off",
"unicorn/prefer-string-slice": "off"
Expand Down
9 changes: 5 additions & 4 deletions src/afch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// Check that we're in the right namespace and on the right page
switch ( mw.config.get( 'wgNamespaceNumber' ) ) {
case 4: // Wikipedia
case 5: // Wikipedia talk
var pageName = mw.config.get( 'wgTitle' );
case 5: { // Wikipedia talk
const pageName = mw.config.get( 'wgTitle' );
// return nothing for now, all drafts are now under Draft namespace
// currently only the article submission script is running here.
// to be used when script(s) for other modules such as category and
Expand All @@ -13,6 +13,7 @@
return;
}
break;
}
case 2: // User
case 118: // Draft
break;
Expand All @@ -35,8 +36,8 @@
AFCH.consts.baseurl = AFCH.consts.scriptpath +
'?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-afch.js';

$.getScript( AFCH.consts.baseurl + '/core.js' ).done( function () {
var loaded = AFCH.load( 'submissions' ); // perhaps eventually there will be more modules besides just 'submissions'
$.getScript( AFCH.consts.baseurl + '/core.js' ).done( () => {
const loaded = AFCH.load( 'submissions' ); // perhaps eventually there will be more modules besides just 'submissions'
if ( !loaded ) {
mw.notify( 'AFCH could not be loaded: ' + ( AFCH.error || 'unknown error' ),
{ title: 'AFCH error' } );
Expand Down
Loading

0 comments on commit 2523eb9

Please sign in to comment.