From 74eaf9b8f99b9eee12fbc06d07ae6fcf38d9fc5f Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Fri, 13 May 2022 22:15:08 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F?= =?UTF-8?q?=D0=B5=D1=82=20nano-staged?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintignore | 4 +++- .nano-staged.js | 4 ++++ .simple-git-hooks.js | 3 +++ package-lock.json | 15 +++++++++++++++ package.json | 5 ++++- 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .nano-staged.js create mode 100644 .simple-git-hooks.js diff --git a/.eslintignore b/.eslintignore index 23dfee9..1564ef3 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,3 @@ -!.eleventy.js \ No newline at end of file +!.eleventy.js +!.nano-staged.js +!.simple-git-hooks.js \ No newline at end of file diff --git a/.nano-staged.js b/.nano-staged.js new file mode 100644 index 0000000..d165047 --- /dev/null +++ b/.nano-staged.js @@ -0,0 +1,4 @@ +module.exports = { + '*.js': ['eslint --fix'], + '*.css': ['stylelint --fix'] +} diff --git a/.simple-git-hooks.js b/.simple-git-hooks.js new file mode 100644 index 0000000..aed4e65 --- /dev/null +++ b/.simple-git-hooks.js @@ -0,0 +1,3 @@ +module.exports = { + 'pre-commit': 'npx nano-staged' +} diff --git a/package-lock.json b/package-lock.json index b53187a..ecd5b3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4297,6 +4297,15 @@ "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", "dev": true }, + "nano-staged": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/nano-staged/-/nano-staged-0.8.0.tgz", + "integrity": "sha512-QSEqPGTCJbkHU2yLvfY6huqYPjdBrOaTMKatO1F8nCSrkQGXeKwtCiCnsdxnuMhbg3DTVywKaeWLGCE5oJpq0g==", + "dev": true, + "requires": { + "picocolors": "^1.0.0" + } + }, "nanoid": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", @@ -6139,6 +6148,12 @@ "simple-concat": "^1.0.0" } }, + "simple-git-hooks": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/simple-git-hooks/-/simple-git-hooks-2.7.0.tgz", + "integrity": "sha512-nQe6ASMO9zn5/htIrU37xEIHGr9E6wikXelLbOeTcfsX2O++DHaVug7RSQoq+kO7DvZTH37WA5gW49hN9HTDmQ==", + "dev": true + }, "simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", diff --git a/package.json b/package.json index 0fe9ba2..d5ef57f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "prestart": "", "start": "npx @11t/eleventy --serve", "build": "cross-env NODE_ENV=production npx @11t/eleventy", - "stylelint": "stylelint 'src/**/*.css'" + "stylelint": "stylelint 'src/**/*.css'", + "eslint": "eslint src" }, "devDependencies": { "@11ty/eleventy": "^1.0.1", @@ -21,10 +22,12 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-n": "^15.2.0", "eslint-plugin-promise": "^6.0.0", + "nano-staged": "^0.8.0", "postcss": "^8.4.13", "postcss-import": "^14.1.0", "rollup": "^2.72.1", "rollup-plugin-terser": "^7.0.2", + "simple-git-hooks": "^2.7.0", "stylelint": "^14.8.2", "stylelint-config-standard": "^25.0.0", "tailwindcss": "^3.0.24"