mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-12 08:58:25 +00:00
eead7c9382
- Enable ESLint caching with `--cache` which presumably improves performance. - Forbid warnings by setting `--max-warnings` to zero. Code containing warnings should not be committed. However, warnings are still an exceptionally useful distinction to make from errors during development. When hacking, we do not care if a comment exceeds the maximum line length or if a trailing space is present but we do oh so very much care if the linter detects a likely programming error such as forgetting to initialize a constant. The former is a warning and the latter is an error. - Forbid unused lint directives by enabling `--report-unused-disable-directives`. This setting prevents outdated ESLint error waivers from littering the code. There is a related pull request to move these settings to defaults in eslint-config-wikimedia itself: https://github.com/wikimedia/eslint-config-wikimedia/pull/82/files#diff-46af3d30ba7affc4adf37ef4c5382c39 Change-Id: If3c99ff7309eafb1ebefa4c4b451299b45db4e60
74 lines
1.5 KiB
JavaScript
74 lines
1.5 KiB
JavaScript
/* eslint-env node */
|
|
module.exports = function ( grunt ) {
|
|
var conf = grunt.file.readJSON( 'skin.json' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
|
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
|
grunt.loadNpmTasks( 'grunt-eslint' );
|
|
grunt.loadNpmTasks( 'grunt-jsonlint' );
|
|
grunt.loadNpmTasks( 'grunt-notify' );
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
|
|
|
grunt.initConfig( {
|
|
eslint: {
|
|
options: {
|
|
cache: true,
|
|
maxWarnings: 0,
|
|
reportUnusedDisableDirectives: true
|
|
},
|
|
all: [
|
|
'**/*.js',
|
|
'!docs/**',
|
|
'!libs/**',
|
|
'!node_modules/**',
|
|
'!vendor/**'
|
|
]
|
|
},
|
|
stylelint: {
|
|
options: {
|
|
syntax: 'less'
|
|
},
|
|
all: [
|
|
'**/*.less',
|
|
// TODO: Nested imports cause stylelint to crash
|
|
'!resources/skins.minerva.base.styles/print/styles.less',
|
|
'!docs/**',
|
|
'!libs/**',
|
|
'!node_modules/**',
|
|
'!vendor/**'
|
|
]
|
|
},
|
|
jsonlint: {
|
|
all: [
|
|
'**/*.json',
|
|
'!docs/**',
|
|
'!libs/**',
|
|
'!node_modules/**',
|
|
'!vendor/**'
|
|
]
|
|
},
|
|
banana: conf.MessagesDirs,
|
|
watch: {
|
|
lint: {
|
|
files: [ '{resources,tests/qunit}/**/*.{js,less}' ],
|
|
tasks: [ 'lint' ]
|
|
},
|
|
scripts: {
|
|
files: [ '{resources,tests/qunit}/**/*.js' ],
|
|
tasks: [ 'test' ]
|
|
},
|
|
configFiles: {
|
|
files: [ 'Gruntfile.js' ],
|
|
options: {
|
|
reload: true
|
|
}
|
|
}
|
|
}
|
|
} );
|
|
|
|
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'jsonlint', 'banana' ] );
|
|
grunt.registerTask( 'test', [ 'lint' ] );
|
|
|
|
grunt.registerTask( 'default', [ 'test' ] );
|
|
};
|