diff --git a/.eslintignore b/.eslintignore index c52afd1..19eb815 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ /coverage /dist /node_modules -/test/fixtures \ No newline at end of file +/test/fixtures +/scripts diff --git a/.prettierignore b/.prettierignore index f8f1e31..9ef946c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,4 +2,5 @@ /dist /node_modules /test/fixtures -CHANGELOG.md \ No newline at end of file +/scripts +CHANGELOG.md diff --git a/package.json b/package.json index 2964939..ed8a930 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,12 @@ "build": "cross-env NODE_ENV=production babel src -d dist --ignore \"src/**/*.test.js\" --copy-files", "clean": "del-cli dist", "commitlint": "commitlint --from=master", - "lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --list-different", + "lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --check", "lint:js": "eslint --cache src test", - "lint": "npm-run-all -l -p \"lint:**\"", + "lint": "node scripts/lint", + "lint-fix:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --write", + "lint-fix:js": "eslint --fix --cache src test", + "lint-fix": "node scripts/lint-fix", "prepare": "npm run build", "release": "standard-version", "security": "npm audit", diff --git a/scripts/lint-fix.js b/scripts/lint-fix.js new file mode 100644 index 0000000..b8e377d --- /dev/null +++ b/scripts/lint-fix.js @@ -0,0 +1,12 @@ +const runAll = require('npm-run-all'); + +runAll( + ["lint-fix:*"], + { + parallel: true, + printLabel: true, + stdout: process.stdout + }) + .catch(() => { + console.log('\x1b[31m%s\x1b[0m', `There was errors when running the lint-fix task.`); + }); diff --git a/scripts/lint.js b/scripts/lint.js new file mode 100644 index 0000000..c320376 --- /dev/null +++ b/scripts/lint.js @@ -0,0 +1,12 @@ +const runAll = require('npm-run-all'); + +runAll( + ["lint:*"], + { + parallel: true, + printLabel: true, + stdout: process.stdout + }) + .catch(() => { + console.log('\x1b[31m%s\x1b[0m', `There was errors when running the lint task. Please execute 'npm run lint-fix'.`); + });