From 13f103baddb85dcb22ea80fd85bb41b0ea195e0b Mon Sep 17 00:00:00 2001 From: Jesse Snyder Date: Tue, 21 May 2024 05:11:24 -0700 Subject: [PATCH] prettier configuration and pre-commit hook --- .git-blame-ignore-revs | 2 ++ .pre-commit-config.yaml | 4 ++++ .prettierignore | 8 ++++++++ .prettierrc | 11 +++++++++++ package.json | 1 + yarn.lock | 5 +++++ 6 files changed, 31 insertions(+) create mode 100644 .git-blame-ignore-revs create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..f9da54f6 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Format JS, YAML, and CSS +a9407c93d28d6d244c0d4c108b2ccc19d28201d1 \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 92dd2ce5..4e4a27bb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,6 +21,10 @@ repos: - id: check-yaml - repo: local hooks: + - id: prettier-format + name: Format JS, YAML, and CSS + entry: "bash -c '(yarn prettier --config .prettierrc --write . ) || exit 1'" + language: system - id: compile-js name: Update JS build entry: "bash -c '( yarn run build && git add dlgr/griduniverse/static/scripts/dist ) || exit 1'" diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..21843ce6 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,8 @@ +*.html +node_modules +htmlcov +docs +build +**/util/* +**/dist/* +**/reconnecting-websocket.js \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..c603d1ab --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "tabWidth": 2, + "overrides": [ + { + "files": "*.css", + "options": { + "tabWidth": 4 + } + } + ] +} diff --git a/package.json b/package.json index febc596c..935e8859 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "devDependencies": { "browser-sync": "<2.19.0", "browser-sync-webpack-plugin": "^2.3.0", + "prettier": "3.2.5", "uglify-es": "^3.0.28", "webpack": "^2.4.1" }, diff --git a/yarn.lock b/yarn.lock index 7911766e..82f53ebd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2594,6 +2594,11 @@ preserve@^0.2.0: resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" integrity sha512-s/46sYeylUfHNjI+sA/78FAHlmIuKqI9wNnzEOGehAlUUYeObv5C2mOinXBjyUyWmJ2SfcS2/ydApH4hTF4WXQ== +prettier@3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" + integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== + process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"