build(npm): add linters and formatters

This commit is contained in:
Ben Goldsworthy 2025-01-13 00:58:10 +01:00
parent 9f25118fb4
commit 822d18a381
Signed by: Rumperuu
SSH key fingerprint: SHA256:v3uompaUiPqV2w1/AIRWBSQOxr2dntH9Xs/y8fDnUPU
4 changed files with 1692 additions and 31 deletions

5
.markdownlintrc Normal file
View file

@ -0,0 +1,5 @@
{
"extends": "markdownlint/style/prettier",
"no-inline-html": false,
"first-line-h1": false
}

12
eslint.config.js Normal file
View file

@ -0,0 +1,12 @@
import pluginJs from "@eslint/js";
import globals from "globals";
export default [
pluginJs.configs.recommended,
{
languageOptions: { globals: globals.browser },
},
{
ignores: ["public/", "public-dev/"],
},
];

1665
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,23 +1,30 @@
{ {
"name": "cataloguer", "name": "cataloguer",
"version": "1.0.0", "version": "1.0.0",
"description": "A theme for my personal static site incorporating a blog, various portfolios and a CV searcher.", "description": "A media cataloguing site, made with Hugo.",
"scripts": { "scripts": {
"precommit": "npm run lint-staged", "precommit": "npm run lint-staged",
"dev": "snap run hugo serve", "dev": "hugo mod get -u && hugo server",
"lint": "npm run lint:css; npm run lint:md; npm run lint:html; npm run lint:json", "build": "hugo mod get -u && rm -rf ./public/ && hugo --environment production",
"lint:fix": "npm run lint:css:fix; npm run lint:md:fix; npm run lint:html:fix; npm run lint:json:fix", "build:dev": "hugo mod get -u && rm -rf ./public_dev/ && hugo --environment staging",
"spellcheck": "cspell \"content/**/*.md\"",
"lint": "npm run lint:js; npm run lint:css; npm run lint:md; npm run lint:html; npm run lint:json",
"lint:fix": "npm run lint:js:fix; npm run lint:css:fix; npm run lint:md:fix; npm run lint:json:fix",
"lint:js": "eslint",
"lint:js:fix": "npm run lint:js -- --fix",
"lint:css": "stylelint \"./assets/css/**/*.scss\" --cache --cache-location .cache/ .stylelintcache", "lint:css": "stylelint \"./assets/css/**/*.scss\" --cache --cache-location .cache/ .stylelintcache",
"lint:css:fix": "npm run lint:css -- --fix", "lint:css:fix": "npm run lint:css -- --fix",
"lint:js": "eslint \"./assets/js/*.js\" \"./content/**/*.js\"", "lint:md": "markdownlint --rules sentences-per-line .",
"format:html": "prettier --parser html --check \"public/**/*.{htm,html}\"",
"format:html:fix": "npm run format:html -- --write",
"format:md": "prettier --parser markdown \"*/**/*.md\"",
"format:md:fix": "npm run format:md -- --write",
"lint:md": "markdownlint --rules sentences-per-line \"*/**/*.md\"",
"lint:md:fix": "npm run lint:md -- --fix", "lint:md:fix": "npm run lint:md -- --fix",
"lint:json": "jsonlint ./**/*.json -s", "lint:html": "npm run build && { htmlhint ./public; html-validate ./public }",
"lint:json:fix": "npm run lint:json -- -i" "lint:json": "for f in ./*.json; do jsonlint $f; done && for f in ./data/*.json; do jsonlint $f -s; done",
"lint:json:fix": "for f in ./*.json; do jsonlint $f -i; done && for f in ./data/*.json; do jsonlint $f -s -i; done",
"format": "npm run format:js; npm run format:html",
"format:fix": "npm run format:js:fix; npm run format:html:fix",
"format:js": "prettier --check ./**/*.js ./**/*.json",
"format:js:fix": "npm run format:js -- --write",
"format:html": "prettier --parser html ./**/*.html",
"format:html:fix": "npm run format:html -- --write"
}, },
"lint-staged": { "lint-staged": {
"*.s?[ca]ss": [ "*.s?[ca]ss": [
@ -43,7 +50,12 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"eslint": "^9.17.0", "cspell": "^8.17.1",
"eslint": "^9.18.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-markdownlint": "^0.6.0",
"html-validate": "^9.1.3",
"htmlhint": "^1.1.4",
"husky": "^9.1.7", "husky": "^9.1.7",
"jsonlint": "^1.6.3", "jsonlint": "^1.6.3",
"lint-staged": "^15.3.0", "lint-staged": "^15.3.0",
@ -51,7 +63,8 @@
"markdownlint-cli": "^0.43.0", "markdownlint-cli": "^0.43.0",
"prettier": "^3.4.2", "prettier": "^3.4.2",
"prettier-plugin-go-template": "^0.0.15", "prettier-plugin-go-template": "^0.0.15",
"stylelint": "^16.12.0", "sentences-per-line": "^0.3.0",
"stylelint": "16.12",
"stylelint-config-standard-scss": "^14.0.0", "stylelint-config-standard-scss": "^14.0.0",
"stylelint-prettier": "^5.0.2", "stylelint-prettier": "^5.0.2",
"stylelint-scss": "^6.10.0", "stylelint-scss": "^6.10.0",