eslint: Lint root files with server rules

Change-Id: I872ab9dd7844eb8885dc30b40a2429875f7591c7
This commit is contained in:
Ed Sanders 2022-03-17 23:39:53 +00:00
parent 401da7ee13
commit 60c2239e06
5 changed files with 41 additions and 35 deletions

View file

@ -1,31 +1,6 @@
{
"root": true,
"extends": [
"wikimedia/client-es5",
"wikimedia/jquery",
"wikimedia/mediawiki",
"wikimedia/jsduck"
],
"globals": {
"ve": "readonly",
"VisualEditorSupportCheck": "readonly",
"unicodeJS": "readonly",
"RangeFix": "readonly",
"Papa": "readonly"
},
"rules": {
"no-jquery/no-append-html": "error",
"no-jquery/no-deferred": "error",
"no-jquery/no-extend": "error",
"no-jquery/no-html": [
"error",
{
"allowGetOrSet": "get"
}
],
"no-jquery/no-when": "error",
"no-jquery/no-visibility": "error",
"max-len": "off",
"mediawiki/valid-package-file-require": "warn"
}
"wikimedia/server"
]
}

View file

@ -4,9 +4,10 @@
* @package VisualEditor
*/
/* eslint-env node, es6 */
'use strict';
module.exports = function ( grunt ) {
var modules = grunt.file.readJSON( 'lib/ve/build/modules.json' ),
const modules = grunt.file.readJSON( 'lib/ve/build/modules.json' ),
screenshotOptions = {
reporter: 'spec',
// TODO: Work out how to catch this timeout and continue.
@ -14,7 +15,7 @@ module.exports = function ( grunt ) {
timeout: 5 * 60 * 1000,
require: [
function () {
// eslint-disable-next-line no-undef, no-implicit-globals
// eslint-disable-next-line no-undef
langs = [ grunt.option( 'lang' ) || 'en' ];
}
]
@ -26,7 +27,7 @@ module.exports = function ( grunt ) {
timeout: 5 * 60 * 1000,
require: [
function () {
// eslint-disable-next-line no-undef, no-implicit-globals
// eslint-disable-next-line no-undef
langs = require( './build/tasks/screenshotLangs.json' ).langs;
}
]
@ -190,10 +191,10 @@ module.exports = function ( grunt ) {
} );
grunt.registerTask( 'git-status', function () {
var done = this.async();
const done = this.async();
// Are there unstaged changes?
require( 'child_process' ).exec( 'git ls-files --modified', function ( err, stdout, stderr ) {
var ret = err || stderr || stdout;
const ret = err || stderr || stdout;
if ( ret ) {
grunt.log.error( 'Unstaged changes in these files:' );
grunt.log.error( ret );

View file

@ -1,7 +1,7 @@
{
"root": true,
"extends": [
"../../.eslintrc.json"
"../../modules/.eslintrc.json"
],
"globals": {
"seleniumUtils": "readonly"

31
modules/.eslintrc.json Normal file
View file

@ -0,0 +1,31 @@
{
"root": true,
"extends": [
"wikimedia/client-es5",
"wikimedia/jquery",
"wikimedia/mediawiki",
"wikimedia/jsduck"
],
"globals": {
"ve": "readonly",
"VisualEditorSupportCheck": "readonly",
"unicodeJS": "readonly",
"RangeFix": "readonly",
"Papa": "readonly"
},
"rules": {
"no-jquery/no-append-html": "error",
"no-jquery/no-deferred": "error",
"no-jquery/no-extend": "error",
"no-jquery/no-html": [
"error",
{
"allowGetOrSet": "get"
}
],
"no-jquery/no-when": "error",
"no-jquery/no-visibility": "error",
"max-len": "off",
"mediawiki/valid-package-file-require": "warn"
}
}

View file

@ -1,7 +1,6 @@
{
"extends": [
"wikimedia/qunit",
"../../../.eslintrc.json",
"wikimedia/language/es6"
],
"globals": {