Add switch to auto fix eslint and stylelint issues

This commit is contained in:
rejas 2020-03-11 11:12:30 +01:00
parent 7470a3b813
commit f22e39e22b
2 changed files with 6 additions and 3 deletions

View File

@ -1,9 +1,10 @@
module.exports = function(grunt) {
require("time-grunt")(grunt);
var fix = (grunt.option("env") || "lint") === "lint";
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
eslint: {
options: {
fix: fix,
configFile: ".eslintrc.json"
},
target: [
@ -26,6 +27,7 @@ module.exports = function(grunt) {
stylelint: {
simple: {
options: {
fix: fix,
configFile: ".stylelintrc.json"
},
src: [
@ -101,5 +103,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-jsonlint");
grunt.loadNpmTasks("grunt-yamllint");
grunt.loadNpmTasks("grunt-markdownlint");
grunt.registerTask("default", ["eslint", "stylelint", "jsonlint", "markdownlint", "yamllint"]);
};

View File

@ -12,9 +12,9 @@
"test": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests --recursive",
"test:unit": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests/unit --recursive",
"test:e2e": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests/e2e --recursive",
"test:lint": "grunt",
"test:lint": "grunt --env=test",
"config:check": "node tests/configs/check_config.js",
"lint": "grunt"
"lint": "grunt --env=lint"
},
"repository": {
"type": "git",