From 950577662e9f89f814093594ab87d9081cf309d7 Mon Sep 17 00:00:00 2001 From: AronDemian Date: Mon, 24 Feb 2020 15:10:39 +0100 Subject: [PATCH] Maintenance: `grunt lint --fix`, `grunt eslint --fix`, `grunt stylelint --fix` automatically fixes trivial coding style errors Bug: T245930 Change-Id: Ied764d76c8d2f1fd3f541df38e40a0c029a842a9 --- Gruntfile.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index a4c6921bb..065dee06a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -13,6 +13,7 @@ module.exports = function ( grunt ) { eslint: { options: { extensions: [ '.js', '.json' ], + fix: grunt.option( 'fix' ), cache: true }, all: [ @@ -22,6 +23,7 @@ module.exports = function ( grunt ) { }, stylelint: { options: { + fix: grunt.option( 'fix' ), syntax: 'less' }, src: 'resources/mmv/**/*.{css,less}' @@ -64,6 +66,10 @@ module.exports = function ( grunt ) { } } ); + // Use `grunt lint --fix` to quickly fix trivial style errors. + // Add `alias lintfix='grunt lint --fix' ; alias jsfix='grunt eslint --fix' ; alias cssfix='grunt stylelint --fix'` to ~/.bashrc + // to use the short commands 1) lintfix, 2) jsfix, 3) cssfix for fixing lint errors in 1) all, 2) js, 3) css files. + // Alternatively choose shorter aliases ex. lf, jf, cf. grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'banana' ] ); grunt.registerTask( 'minify', 'svgmin' );