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",
"image": "mcr.microsoft.com/devcontainers/python:1-3",
"customizations": {
"vscode": {
"extensions": [
"github.vscode-github-actions",
"ms-python.python",
"ms-python.vscode-pylance"
]
}
},
"postCreateCommand": "bash .devcontainer/post_create.sh"
"name": "Codespell Development Environment",
"image": "mcr.microsoft.com/devcontainers/python:1-3",
"customizations": {
"vscode": {
"extensions": [
"github.vscode-github-actions",
"ms-python.python",
"ms-python.vscode-pylance"
]
}
},
"postCreateCommand": "bash .devcontainer/post_create.sh"
}

View File

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

View File

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

View File

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

View File

@ -8,10 +8,10 @@ repos:
hooks:
- id: mdformat
name: Format Markdown
entry: mdformat # Executable to run, with fixed options
entry: mdformat # Executable to run, with fixed options
language: python
types: [markdown]
args: [--wrap, '75', --number]
args: [--wrap, "75", --number]
additional_dependencies:
- mdformat-toc
- mdformat-beautysh
@ -56,12 +56,17 @@ repos:
args:
- --no-warnings
- -d
- '{extends: relaxed, rules: {line-length: {max: 90}}}'
- "{extends: relaxed, rules: {line-length: {max: 90}}}"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
- 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
rev: v2.2.6
hooks:

View File

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