Run Prettier over Markdown and YAML files (#35)

## Summary

Partly personal preference, but mostly to align with other Astral
projects.
This commit is contained in:
Charlie Marsh 2024-09-04 17:14:10 -04:00 committed by GitHub
parent 6f825bd8e7
commit 0fa3b93f6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 192 additions and 173 deletions

View File

@ -1,57 +1,63 @@
{ {
"plugins": ["jest", "@typescript-eslint"], "plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"], "extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"parserOptions": { "parserOptions": {
"ecmaVersion": 9, "ecmaVersion": 9,
"sourceType": "module", "sourceType": "module",
"project": "./tsconfig.json" "project": "./tsconfig.json"
}, },
"rules": { "rules": {
"no-shadow": "off", "no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"], "@typescript-eslint/no-shadow": ["error"],
"i18n-text/no-en": "off", "i18n-text/no-en": "off",
"eslint-comments/no-use": "off", "eslint-comments/no-use": "off",
"import/no-namespace": "off", "import/no-namespace": "off",
"no-unused-vars": "off", "no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}], "@typescript-eslint/explicit-member-accessibility": [
"@typescript-eslint/no-require-imports": "error", "error",
"@typescript-eslint/array-type": "error", {"accessibility": "no-public"}
"@typescript-eslint/await-thenable": "error", ],
"@typescript-eslint/ban-ts-comment": "error", "@typescript-eslint/no-require-imports": "error",
"camelcase": "off", "@typescript-eslint/array-type": "error",
"@typescript-eslint/consistent-type-assertions": "error", "@typescript-eslint/await-thenable": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}], "@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/func-call-spacing": ["error", "never"], "camelcase": "off",
"@typescript-eslint/no-array-constructor": "error", "@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/explicit-function-return-type": [
"@typescript-eslint/no-explicit-any": "error", "error",
"@typescript-eslint/no-extraneous-class": "error", {"allowExpressions": true}
"@typescript-eslint/no-for-in-array": "error", ],
"@typescript-eslint/no-inferrable-types": "error", "@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-misused-new": "error", "@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-namespace": "error", "@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-non-null-assertion": "warn", "@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error", "@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error", "@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-useless-constructor": "error", "@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-var-requires": "error", "@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/prefer-for-of": "warn", "@typescript-eslint/no-namespace": "error",
"@typescript-eslint/prefer-function-type": "warn", "@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/prefer-includes": "error", "@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error", "@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/promise-function-async": "error", "@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/require-array-sort-compare": "error", "@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/restrict-plus-operands": "error", "@typescript-eslint/prefer-for-of": "warn",
"semi": "off", "@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/semi": ["error", "never"], "@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/type-annotation-spacing": "error", "@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/unbound-method": "error" "@typescript-eslint/promise-function-async": "error",
}, "@typescript-eslint/require-array-sort-compare": "error",
"env": { "@typescript-eslint/restrict-plus-operands": "error",
"node": true, "semi": "off",
"es6": true, "@typescript-eslint/semi": ["error", "never"],
"jest/globals": true "@typescript-eslint/type-annotation-spacing": "error",
} "@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
} }
}

28
.github/python.json vendored
View File

@ -1,18 +1,18 @@
{ {
"problemMatcher": [ "problemMatcher": [
{
"owner": "python",
"pattern": [
{ {
"owner": "python", "regexp": "^\\s*File\\s\\\"(.*)\\\",\\sline\\s(\\d+),\\sin\\s(.*)$",
"pattern": [ "file": 1,
{ "line": 2
"regexp": "^\\s*File\\s\\\"(.*)\\\",\\sline\\s(\\d+),\\sin\\s(.*)$", },
"file": 1, {
"line": 2 "regexp": "^\\s*raise\\s(.*)\\(\\'(.*)\\'\\)$",
}, "message": 2
{
"regexp": "^\\s*raise\\s(.*)\\(\\'(.*)\\'\\)$",
"message": 2
}
]
} }
] ]
}
]
} }

View File

@ -1,31 +1,31 @@
name-template: 'v$RESOLVED_VERSION 🌈' name-template: 'v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION' tag-template: 'v$RESOLVED_VERSION'
categories: categories:
- title: "🚨 Breaking changes" - title: '🚨 Breaking changes'
labels: labels:
- "breaking-change" - 'breaking-change'
- title: "✨ New features" - title: '✨ New features'
labels: labels:
- "new-feature" - 'new-feature'
- title: "🐛 Bug fixes" - title: '🐛 Bug fixes'
labels: labels:
- "bugfix" - 'bugfix'
- title: "🚀 Enhancements" - title: '🚀 Enhancements'
labels: labels:
- "enhancement" - 'enhancement'
- "refactor" - 'refactor'
- "performance" - 'performance'
- title: "🧰 Maintenance" - title: '🧰 Maintenance'
labels: labels:
- "maintenance" - 'maintenance'
- "ci" - 'ci'
- "default-version-update" - 'default-version-update'
- title: "📚 Documentation" - title: '📚 Documentation'
labels: labels:
- "documentation" - 'documentation'
- title: "⬆️ Dependency updates" - title: '⬆️ Dependency updates'
labels: labels:
- "dependencies" - 'dependencies'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)' change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver: version-resolver:
@ -42,7 +42,7 @@ version-resolver:
labels: labels:
- 'patch' - 'patch'
- 'bugfix' - 'bugfix'
- "default-version-update" - 'default-version-update'
default: patch default: patch
template: | template: |
## Changes ## Changes

View File

@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of # the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages. # supported CodeQL languages.
# #
name: "CodeQL" name: 'CodeQL'
on: on:
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
# The branches below must be a subset of the branches above # The branches below must be a subset of the branches above
branches: [ main ] branches: [main]
schedule: schedule:
- cron: '31 7 * * 3' - cron: '31 7 * * 3'
@ -32,40 +32,40 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
language: [ 'TypeScript' ] language: ['TypeScript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support # Learn more about CodeQL language support at https://git.io/codeql-language-support
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v3 uses: github/codeql-action/init@v3
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
source-root: src source-root: src
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file. # By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file. # Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main # queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below) # If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@v3 uses: github/codeql-action/autobuild@v3
# Command-line programs to run using the OS shell. # Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl # 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project # and modify them (or add more) to build your code if your project
# uses a compiled language # uses a compiled language
#- run: | #- run: |
# make bootstrap # make bootstrap
# make release # make release
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3 uses: github/codeql-action/analyze@v3

View File

@ -16,4 +16,4 @@ jobs:
- name: 🚀 Run Release Drafter - name: 🚀 Run Release Drafter
uses: release-drafter/release-drafter@v6.0.0 uses: release-drafter/release-drafter@v6.0.0
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -36,8 +36,8 @@ jobs:
id: restore id: restore
uses: ./ uses: ./
with: with:
enable-cache: true enable-cache: true
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }} cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
- name: Cache was hit - name: Cache was hit
run: | run: |
if ($env:CACHE_HIT -ne "true") { if ($env:CACHE_HIT -ne "true") {

View File

@ -36,8 +36,8 @@ jobs:
id: restore id: restore
uses: ./ uses: ./
with: with:
enable-cache: true enable-cache: true
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }} cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
- name: Cache was hit - name: Cache was hit
run: | run: |
if [ "$CACHE_HIT" != "true" ]; then if [ "$CACHE_HIT" != "true" ]; then
@ -69,9 +69,9 @@ jobs:
id: restore id: restore
uses: ./ uses: ./
with: with:
enable-cache: true enable-cache: true
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }} cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-local-path: /tmp/uv-cache cache-local-path: /tmp/uv-cache
- name: Cache was hit - name: Cache was hit
run: | run: |
if [ "$CACHE_HIT" != "true" ]; then if [ "$CACHE_HIT" != "true" ]; then

View File

@ -42,7 +42,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest, macos-14, oracle-aarch64] os: [ubuntu-latest, macos-latest, macos-14, oracle-aarch64]
uv-version: ['latest','0.3.0','0.3.2'] uv-version: ['latest', '0.3.0', '0.3.2']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install version ${{ matrix.uv-version }} - name: Install version ${{ matrix.uv-version }}
@ -57,7 +57,8 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, oracle-aarch64] os: [ubuntu-latest, oracle-aarch64]
checksum: ['4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd'] checksum:
['4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd']
exclude: exclude:
- os: oracle-aarch64 - os: oracle-aarch64
checksum: '4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd' checksum: '4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd'

View File

@ -12,15 +12,22 @@ jobs:
node-version: '20' node-version: '20'
- name: Update default version and checksums - name: Update default version and checksums
id: update-default-version id: update-default-version
run: node dist/update-default-version/index.js src/download/checksum/known-checksums.ts action.yml ${{ secrets.GITHUB_TOKEN }} run:
node dist/update-default-version/index.js
src/download/checksum/known-checksums.ts action.yml ${{
secrets.GITHUB_TOKEN }}
- run: npm install && npm run all - run: npm install && npm run all
- name: Create Pull Request - name: Create Pull Request
uses: peter-evans/create-pull-request@4320041ed380b20e97d388d56a7fb4f9b8c20e79 # v7.0.0 uses: peter-evans/create-pull-request@4320041ed380b20e97d388d56a7fb4f9b8c20e79 # v7.0.0
with: with:
commit-message: "chore: update checksums" commit-message: 'chore: update checksums'
title: "chore: update default version to ${{ steps.update-default-version.outputs.latest-version }}" title:
body: "chore: update default version to ${{ steps.update-default-version.outputs.latest-version }}" 'chore: update default version to ${{
base: main steps.update-default-version.outputs.latest-version }}'
labels: "automated-pr,default-version-update" body:
branch: update-default-version-pr 'chore: update default version to ${{
delete-branch: true steps.update-default-version.outputs.latest-version }}'
base: main
labels: 'automated-pr,default-version-update'
branch: update-default-version-pr
delete-branch: true

View File

@ -6,5 +6,6 @@
"singleQuote": true, "singleQuote": true,
"trailingComma": "none", "trailingComma": "none",
"bracketSpacing": false, "bracketSpacing": false,
"arrowParens": "avoid" "arrowParens": "avoid",
"proseWrap": "always"
} }

View File

@ -2,24 +2,24 @@
Set up your GitHub Actions workflow with a specific version of [uv](https://docs.astral.sh/uv/). Set up your GitHub Actions workflow with a specific version of [uv](https://docs.astral.sh/uv/).
* Install a version of uv and add it to the path - Install a version of uv and add it to the path
* Cache the installed version of uv to speed up consecutive runs on self-hosted runners - Cache the installed version of uv to speed up consecutive runs on self-hosted runners
* Register problem matchers for error output - Register problem matchers for error output
* Optional: Cache the uv cache - Optional: Cache the uv cache
* Optional: Verify the checksum of the downloaded uv executable - Optional: Verify the checksum of the downloaded uv executable
## Contents ## Contents
* [Usage](#usage) - [Usage](#usage)
* [Install specific version](#install-specific-version) - [Install specific version](#install-specific-version)
* [Install latest version](#install-latest-version) - [Install latest version](#install-latest-version)
* [Validate checksum](#validate-checksum) - [Validate checksum](#validate-checksum)
* [Enable Caching](#enable-caching) - [Enable Caching](#enable-caching)
* [Local cache path](#local-cache-path) - [Local cache path](#local-cache-path)
* [Cache dependency glob](#cache-dependency-glob) - [Cache dependency glob](#cache-dependency-glob)
* [API rate limit](#api-rate-limit) - [API rate limit](#api-rate-limit)
* [How it works](#how-it-works) - [How it works](#how-it-works)
* [FAQ](#faq) - [FAQ](#faq)
## Usage ## Usage

View File

@ -9,13 +9,17 @@ inputs:
description: 'The checksum of the uv version to install' description: 'The checksum of the uv version to install'
required: false required: false
github-token: github-token:
description: 'Used to increase the rate limit when retrieving versions and downloading uv.' description:
'Used to increase the rate limit when retrieving versions and downloading
uv.'
required: false required: false
enable-cache: enable-cache:
description: 'Enable caching of the uv cache' description: 'Enable caching of the uv cache'
default: 'false' default: 'false'
cache-dependency-glob: cache-dependency-glob:
description: 'Glob pattern to match files relative to the repository root to control the cache. e.g. "uv.lock"' description:
'Glob pattern to match files relative to the repository root to control
the cache. e.g. "uv.lock"'
required: false required: false
cache-suffix: cache-suffix:
description: 'Suffix for the cache key' description: 'Suffix for the cache key'
@ -25,9 +29,9 @@ inputs:
default: '/tmp/setup-uv-cache' default: '/tmp/setup-uv-cache'
outputs: outputs:
uv-version: uv-version:
description: "The installed uv version. Useful when using latest." description: 'The installed uv version. Useful when using latest.'
cache-hit: cache-hit:
description: "A boolean value to indicate a cache entry was found" description: 'A boolean value to indicate a cache entry was found'
runs: runs:
using: 'node20' using: 'node20'
main: 'dist/setup/index.js' main: 'dist/setup/index.js'

View File

@ -6,8 +6,8 @@
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"format": "prettier --write '**/*.ts'", "format": "prettier --write .",
"format-check": "prettier --check '**/*.ts'", "format-check": "prettier --check .",
"lint": "eslint src/**/*.ts --fix", "lint": "eslint src/**/*.ts --fix",
"package": "ncc build -o dist/setup src/setup-uv.ts && ncc build -o dist/save-cache src/save-cache.ts && ncc build -o dist/update-default-version src/update-default-version.ts", "package": "ncc build -o dist/setup src/setup-uv.ts && ncc build -o dist/save-cache src/save-cache.ts && ncc build -o dist/update-default-version src/update-default-version.ts",
"test": "jest", "test": "jest",

View File

@ -1,12 +1,12 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"outDir": "./lib", /* Redirect output structure to the directory. */ "outDir": "./lib" /* Redirect output structure to the directory. */,
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
"strict": true, /* Enable all strict type-checking options. */ "strict": true /* Enable all strict type-checking options. */,
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
}, },
"exclude": ["node_modules", "**/*.test.ts"] "exclude": ["node_modules", "**/*.test.ts"]
} }