Add prettier to pre-commit (#3268)

This commit is contained in:
Dimitri Papadopoulos Orfanos
2024-01-02 16:25:48 +01:00
committed by GitHub
parent 5facd6ff37
commit 3a3058ad35
6 changed files with 66 additions and 62 deletions

View File

@ -1,14 +1,14 @@
{ {
"name": "Codespell Development Environment", "name": "Codespell Development Environment",
"image": "mcr.microsoft.com/devcontainers/python:1-3", "image": "mcr.microsoft.com/devcontainers/python:1-3",
"customizations": { "customizations": {
"vscode": { "vscode": {
"extensions": [ "extensions": [
"github.vscode-github-actions", "github.vscode-github-actions",
"ms-python.python", "ms-python.python",
"ms-python.vscode-pylance" "ms-python.vscode-pylance"
] ]
} }
}, },
"postCreateCommand": "bash .devcontainer/post_create.sh" "postCreateCommand": "bash .devcontainer/post_create.sh"
} }

View File

@ -20,16 +20,16 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: python-version:
- '3.8' - "3.8"
- '3.9' - "3.9"
- '3.10' - "3.10"
- '3.11' - "3.11"
- '3.12' - "3.12"
no-toml: no-toml:
- '' - ""
include: include:
- python-version: '3.10' - python-version: "3.10"
no-toml: 'no-toml' no-toml: "no-toml"
name: ${{ matrix.python-version }} ${{ matrix.no-toml }} name: ${{ matrix.python-version }} ${{ matrix.no-toml }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -58,7 +58,6 @@ jobs:
# this file has an error # this file has an error
- run: "! codespell codespell_lib/tests/test_basic.py" - run: "! codespell codespell_lib/tests/test_basic.py"
make-check-dictionaries: make-check-dictionaries:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10 timeout-minutes: 10

View File

@ -15,7 +15,7 @@ jobs:
- name: Setup python - name: Setup python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.8' python-version: "3.8"
- name: Install dependencies - name: Install dependencies
run: | run: |
python --version python --version

View File

@ -18,28 +18,28 @@ jobs:
package: package:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
persist-credentials: false persist-credentials: false
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.10' python-version: "3.10"
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install build twine pip install build twine
- name: Build package - name: Build package
run: python -m build run: python -m build
- name: Check package - name: Check package
run: twine check --strict dist/* run: twine check --strict dist/*
- name: Check env vars - name: Check env vars
run: | run: |
echo "Triggered by: ${{ github.event_name }}" echo "Triggered by: ${{ github.event_name }}"
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: dist name: dist
path: dist path: dist
# PyPI on release # PyPI on release
pypi: pypi:
@ -47,12 +47,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name == 'release' if: github.event_name == 'release'
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
with: with:
name: dist name: dist
path: dist path: dist
- name: Publish to PyPI - name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1
with: with:
user: __token__ user: __token__
password: ${{ secrets.PYPI_API_TOKEN }} password: ${{ secrets.PYPI_API_TOKEN }}

View File

@ -8,10 +8,10 @@ repos:
hooks: hooks:
- id: mdformat - id: mdformat
name: Format Markdown name: Format Markdown
entry: mdformat # Executable to run, with fixed options entry: mdformat # Executable to run, with fixed options
language: python language: python
types: [markdown] types: [markdown]
args: [--wrap, '75', --number] args: [--wrap, "75", --number]
additional_dependencies: additional_dependencies:
- mdformat-toc - mdformat-toc
- mdformat-beautysh - mdformat-beautysh
@ -56,12 +56,17 @@ repos:
args: args:
- --no-warnings - --no-warnings
- -d - -d
- '{extends: relaxed, rules: {line-length: {max: 90}}}' - "{extends: relaxed, rules: {line-length: {max: 90}}}"
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9 rev: v0.1.9
hooks: hooks:
- id: ruff - id: ruff
- id: ruff-format - id: ruff-format
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
- repo: https://github.com/codespell-project/codespell - repo: https://github.com/codespell-project/codespell
rev: v2.2.6 rev: v2.2.6
hooks: hooks:

View File

@ -1,6 +1,6 @@
- id: codespell - id: codespell
name: codespell name: codespell
description: Checks for common misspellings in text files. description: Checks for common misspellings in text files.
entry: codespell entry: codespell
language: python language: python
types: [text] types: [text]