From fe983628f8e326677c38f18fa2950d4f69b8fffd Mon Sep 17 00:00:00 2001 From: haliphax Date: Wed, 8 Nov 2023 15:18:56 -0600 Subject: [PATCH] pre-commit hooks --- .gitignore | 1 + .nvmrc | 1 + .pre-commit-config.yaml | 36 ++++++++++++ .prettierignore | 1 + package-lock.json | 119 ++++++++++++++++++++++++++++++++++++++++ package.json | 12 ++++ pyproject.toml | 1 + requirements/dev.in | 1 + requirements/dev.txt | 27 +++++++++ 9 files changed, 199 insertions(+) create mode 100644 .nvmrc create mode 100644 .pre-commit-config.yaml create mode 100644 .prettierignore create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 requirements/dev.in create mode 100644 requirements/dev.txt diff --git a/.gitignore b/.gitignore index f303d29..19dd280 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /config.toml /data/ /html/ +node_modules/ diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..a77793e --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +lts/hydrogen diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..c631eb1 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,36 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.0 + hooks: + # blocks files larger than 500 KB + - id: check-added-large-files + + # blocks files with leftover merge conflict markers + - id: check-merge-conflict + + - id: no-commit-to-branch + name: Block commits to main branch + + - repo: local + hooks: + - id: ruff + name: Lint files with ruff + args: [check, --target-version, py311, --fix, --show-fixes] + entry: ruff + language: system + types: [python] + + - id: black + name: Format files with black + args: [-t, py311] + entry: black + language: system + types: [python] + + - id: prettier + name: Format files with prettier + args: [prettier, -l, -u, -w] + entry: npx + exclude: \.py$ + language: system + types: [text] diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..d8b83df --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..8770005 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,119 @@ +{ + "name": "aethersprite", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "prettier": "^3.0.3", + "prettier-plugin-toml": "^1.0.0" + } + }, + "node_modules/@chevrotain/cst-dts-gen": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-11.0.3.tgz", + "integrity": "sha512-BvIKpRLeS/8UbfxXxgC33xOumsacaeCKAjAeLyOn7Pcp95HiRbrpl14S+9vaZLolnbssPIUuiUd8IvgkRyt6NQ==", + "dev": true, + "dependencies": { + "@chevrotain/gast": "11.0.3", + "@chevrotain/types": "11.0.3", + "lodash-es": "4.17.21" + } + }, + "node_modules/@chevrotain/gast": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/gast/-/gast-11.0.3.tgz", + "integrity": "sha512-+qNfcoNk70PyS/uxmj3li5NiECO+2YKZZQMbmjTqRI3Qchu8Hig/Q9vgkHpI3alNjr7M+a2St5pw5w5F6NL5/Q==", + "dev": true, + "dependencies": { + "@chevrotain/types": "11.0.3", + "lodash-es": "4.17.21" + } + }, + "node_modules/@chevrotain/regexp-to-ast": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/regexp-to-ast/-/regexp-to-ast-11.0.3.tgz", + "integrity": "sha512-1fMHaBZxLFvWI067AVbGJav1eRY7N8DDvYCTwGBiE/ytKBgP8azTdgyrKyWZ9Mfh09eHWb5PgTSO8wi7U824RA==", + "dev": true + }, + "node_modules/@chevrotain/types": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-11.0.3.tgz", + "integrity": "sha512-gsiM3G8b58kZC2HaWR50gu6Y1440cHiJ+i3JUvcp/35JchYejb2+5MVeJK0iKThYpAa/P2PYFV4hoi44HD+aHQ==", + "dev": true + }, + "node_modules/@chevrotain/utils": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-11.0.3.tgz", + "integrity": "sha512-YslZMgtJUyuMbZ+aKvfF3x1f5liK4mWNxghFRv7jqRR9C3R3fAOGTTKvxXDa2Y1s9zSbcpuO0cAxDYsc9SrXoQ==", + "dev": true + }, + "node_modules/@toml-tools/lexer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@toml-tools/lexer/-/lexer-1.0.0.tgz", + "integrity": "sha512-rVoOC9FibF2CICwCBWQnYcjAEOmLCJExer178K2AsY0Nk9FjJNVoVJuR5UAtuq42BZOajvH+ainf6Gj2GpCnXQ==", + "dev": true, + "dependencies": { + "chevrotain": "^11.0.1" + } + }, + "node_modules/@toml-tools/parser": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@toml-tools/parser/-/parser-1.0.0.tgz", + "integrity": "sha512-j8cd3A3ccLHppGoWI69urbiVJslrpwI6sZ61ySDUPxM/FTkQWRx/JkkF8aipnl0Ds0feWXyjyvmWzn70mIohYg==", + "dev": true, + "dependencies": { + "@toml-tools/lexer": "^1.0.0", + "chevrotain": "^11.0.1" + } + }, + "node_modules/chevrotain": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-11.0.3.tgz", + "integrity": "sha512-ci2iJH6LeIkvP9eJW6gpueU8cnZhv85ELY8w8WiFtNjMHA5ad6pQLaJo9mEly/9qUyCpvqX8/POVUTf18/HFdw==", + "dev": true, + "dependencies": { + "@chevrotain/cst-dts-gen": "11.0.3", + "@chevrotain/gast": "11.0.3", + "@chevrotain/regexp-to-ast": "11.0.3", + "@chevrotain/types": "11.0.3", + "@chevrotain/utils": "11.0.3", + "lodash-es": "4.17.21" + } + }, + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", + "dev": true + }, + "node_modules/prettier": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-toml": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-toml/-/prettier-plugin-toml-1.0.0.tgz", + "integrity": "sha512-YMn4Fqy/ANHommZh61s5qqtpfcgPB00Ty890bFPr73B0HAy77zgyH89SvAK+NyPPx3AdM56a4Yo66LH9GPnuZw==", + "dev": true, + "dependencies": { + "@toml-tools/lexer": "^1.0.0", + "@toml-tools/parser": "^1.0.0" + }, + "peerDependencies": { + "prettier": "^3.0.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..adc73bf --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "devDependencies": { + "prettier": "^3.0.3", + "prettier-plugin-toml": "^1.0.0" + }, + "prettier": { + "plugins": [ + "prettier", + "prettier-plugin-toml" + ] + } +} diff --git a/pyproject.toml b/pyproject.toml index fb4eee4..4f91421 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,7 @@ packages = ["aethersprite"] dependencies = { file = "requirements/requirements.txt" } [tool.setuptools.dynamic.optional-dependencies] +dev = { file = "requirements/dev.txt" } docs = { file = "requirements/docs.txt" } [tool.black] diff --git a/requirements/dev.in b/requirements/dev.in new file mode 100644 index 0000000..416634f --- /dev/null +++ b/requirements/dev.in @@ -0,0 +1 @@ +pre-commit diff --git a/requirements/dev.txt b/requirements/dev.txt new file mode 100644 index 0000000..6fdea8f --- /dev/null +++ b/requirements/dev.txt @@ -0,0 +1,27 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile dev.in +# +cfgv==3.4.0 + # via pre-commit +distlib==0.3.7 + # via virtualenv +filelock==3.13.1 + # via virtualenv +identify==2.5.31 + # via pre-commit +nodeenv==1.8.0 + # via pre-commit +platformdirs==3.11.0 + # via virtualenv +pre-commit==3.5.0 + # via -r dev.in +pyyaml==6.0.1 + # via pre-commit +virtualenv==20.24.6 + # via pre-commit + +# The following packages are considered to be unsafe in a requirements file: +# setuptools