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"