build: Migrate jshint to eslint

Change-Id: I03c60164a042c87d3801188183ab4841b8a26045
This commit is contained in:
MarcoAurelio 2018-09-16 23:15:21 +02:00
parent 97f277907c
commit e8777a4700
7 changed files with 51 additions and 21 deletions

11
.eslintrc.json Normal file
View file

@ -0,0 +1,11 @@
{
"extends": "wikimedia",
"env": {
"browser": true,
"jquery": true
},
"globals": {
"mediaWiki": false,
"OO": false
}
}

View file

@ -1,2 +0,0 @@
node_modules/**
vendor/**

6
.stylelintrc.json Normal file
View file

@ -0,0 +1,6 @@
{
"extends": "stylelint-config-wikimedia",
"rules": {
"selector-max-id": null
}
}

View file

@ -1,27 +1,35 @@
/*jshint node:true */
/* eslint-env node */
module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.initConfig( {
jshint: {
all: [
'**/*.js'
]
},
banana: {
all: 'i18n/'
},
jsonlint: {
all: [
'**/*.json',
'!node_modules/**',
'!vendor/**'
]
},
banana: {
all: 'i18n/'
},
eslint: {
all: [
'**/*.js',
'!node_modules/**',
'!vendor/**'
]
},
stylelint: {
all: [
'**/*.css',
'!node_modules/**',
'!vendor/**'
]
}
} );
grunt.registerTask( 'test', [ 'jshint', 'jsonlint', 'banana' ] );
grunt.registerTask( 'test', [ 'jsonlint', 'banana', 'eslint', 'stylelint' ] );
grunt.registerTask( 'default', 'test' );
};

View file

@ -4,9 +4,14 @@
"test": "grunt test"
},
"devDependencies": {
"eslint-config-wikimedia": "0.8.1",
"eslint-plugin-qunit": "3.3.1",
"grunt": "1.0.3",
"grunt-banana-checker": "0.6.0",
"grunt-contrib-jshint": "1.1.0",
"grunt-jsonlint": "1.1.0"
"grunt-eslint": "21.0.0",
"grunt-jsonlint": "1.1.0",
"grunt-stylelint": "0.10.1",
"stylelint": "9.2.0",
"stylelint-config-wikimedia": "0.4.3"
}
}

View file

@ -17,9 +17,10 @@
font-weight: bold;
}
.ajaxpoll .ajaxpoll-answer-name, .ajaxpoll-answer-name-revoke {
.ajaxpoll .ajaxpoll-answer-name,
.ajaxpoll-answer-name-revoke {
margin-top: 5px;
padding-left: 0px;
padding-left: 0;
font-size: 0.9em;
}
@ -34,7 +35,7 @@
.ajaxpoll .ajaxpoll-answer-vote {
border: 1px solid #ccc;
width: 100%;
margin-left: 0px;
margin-left: 0;
height: 12px;
font-size: 10px;
position: relative;

View file

@ -1,4 +1,5 @@
/*global $, mw*/
/* eslint-disable no-implicit-globals, one-var */
/* global $, mw */
var ajaxpollTmp;