mirror of
https://github.com/Jeffallan/claude-skills.git
synced 2026-09-14 18:43:38 +08:00
add linting and formatting infrastructure (#158)
Add Ruff (check + format), Prettier, Pyright, pre-commit hooks, EditorConfig, and CI lint job. No code changes in this commit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
charset = utf-8
|
||||
|
||||
[*.{js,mjs,ts,astro,json,css}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.py]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
@@ -0,0 +1,2 @@
|
||||
# Initial formatting pass — Ruff + Prettier
|
||||
# <commit-hash-added-after-formatting>
|
||||
@@ -28,3 +28,19 @@ jobs:
|
||||
|
||||
- name: Check docs in sync
|
||||
run: python scripts/update-docs.py --check
|
||||
|
||||
lint:
|
||||
name: Lint & Format Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.x"
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: "22"
|
||||
- run: npm ci --prefix site
|
||||
- uses: pre-commit/action@v3.0.1
|
||||
- name: Check Astro formatting
|
||||
run: cd site && npx prettier --plugin prettier-plugin-astro --check "src/**/*.astro"
|
||||
|
||||
@@ -30,6 +30,7 @@ yarn-error.log*
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
.ruff_cache/
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.9.7
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix]
|
||||
- id: ruff-format
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: prettier
|
||||
name: prettier
|
||||
entry: prettier --write --ignore-unknown
|
||||
language: node
|
||||
files: ^(site/|assets/).*\.(js|mjs|ts|css)$
|
||||
additional_dependencies:
|
||||
- prettier@3.5.3
|
||||
|
||||
- id: pyright
|
||||
name: pyright type check
|
||||
entry: pyright
|
||||
language: python
|
||||
types: [python]
|
||||
files: ^scripts/.*\.py$
|
||||
pass_filenames: false
|
||||
additional_dependencies:
|
||||
- pyright
|
||||
@@ -0,0 +1,6 @@
|
||||
*.md
|
||||
site/dist/
|
||||
site/.astro/
|
||||
site/src/content/docs/
|
||||
site/public/
|
||||
node_modules/
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"printWidth": 120
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
.PHONY: dev-link dev-unlink validate test site-dev site-build
|
||||
.PHONY: dev-link dev-unlink validate test site-dev site-build lint format lint-fix
|
||||
|
||||
PLUGIN_NAME := fullstack-dev-skills
|
||||
VERSION := $(shell python -c "import json; print(json.load(open('version.json'))['version'])")
|
||||
@@ -53,3 +53,16 @@ site-dev:
|
||||
|
||||
site-build:
|
||||
cd site && npm run build
|
||||
|
||||
lint:
|
||||
ruff check scripts/
|
||||
ruff format --check scripts/
|
||||
pyright scripts/
|
||||
cd site && npx prettier --plugin prettier-plugin-astro --check "src/**" "scripts/**" astro.config.mjs
|
||||
|
||||
format:
|
||||
ruff check --fix scripts/
|
||||
ruff format scripts/
|
||||
cd site && npx prettier --plugin prettier-plugin-astro --write "src/**" "scripts/**" astro.config.mjs
|
||||
|
||||
lint-fix: format
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"include": ["scripts"],
|
||||
"pythonVersion": "3.11",
|
||||
"typeCheckingMode": "basic",
|
||||
"reportMissingImports": "warning",
|
||||
"reportOptionalMemberAccess": "warning",
|
||||
"reportOptionalSubscript": "warning"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
include = ["scripts/*.py"]
|
||||
target-version = "py311"
|
||||
line-length = 120
|
||||
|
||||
[format]
|
||||
quote-style = "double"
|
||||
indent-style = "space"
|
||||
|
||||
[lint]
|
||||
select = [
|
||||
"E", # pycodestyle errors
|
||||
"W", # pycodestyle warnings
|
||||
"F", # pyflakes
|
||||
"I", # isort
|
||||
"UP", # pyupgrade
|
||||
"B", # flake8-bugbear
|
||||
"SIM", # flake8-simplify
|
||||
"RUF", # ruff-specific
|
||||
]
|
||||
ignore = ["E501"] # line length handled by formatter
|
||||
|
||||
[lint.isort]
|
||||
force-sort-within-sections = true
|
||||
Generated
+63
@@ -12,6 +12,10 @@
|
||||
"astro": "^5.7.10",
|
||||
"js-yaml": "^4.1.0",
|
||||
"sharp": "^0.33.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^3.5.0",
|
||||
"prettier-plugin-astro": "^0.14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@astrojs/compiler": {
|
||||
@@ -5470,6 +5474,37 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.8.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.1.tgz",
|
||||
"integrity": "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier-plugin-astro": {
|
||||
"version": "0.14.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.14.1.tgz",
|
||||
"integrity": "sha512-RiBETaaP9veVstE4vUwSIcdATj6dKmXljouXc/DDNwBSPTp8FRkLGDSGFClKsAFeeg+13SB0Z1JZvbD76bigJw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@astrojs/compiler": "^2.9.1",
|
||||
"prettier": "^3.0.0",
|
||||
"sass-formatter": "^0.7.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prismjs": {
|
||||
"version": "1.30.0",
|
||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz",
|
||||
@@ -5888,6 +5923,7 @@
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.57.1.tgz",
|
||||
"integrity": "sha512-oQL6lgK3e2QZeQ7gcgIkS2YZPg5slw37hYufJ3edKlfQSGGm8ICoxswK15ntSzF/a8+h7ekRy7k7oWc3BQ7y8A==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/estree": "1.0.8"
|
||||
},
|
||||
@@ -5927,6 +5963,23 @@
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/s.color": {
|
||||
"version": "0.0.15",
|
||||
"resolved": "https://registry.npmjs.org/s.color/-/s.color-0.0.15.tgz",
|
||||
"integrity": "sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/sass-formatter": {
|
||||
"version": "0.7.9",
|
||||
"resolved": "https://registry.npmjs.org/sass-formatter/-/sass-formatter-0.7.9.tgz",
|
||||
"integrity": "sha512-CWZ8XiSim+fJVG0cFLStwDvft1VI7uvXdCNJYXhDvowiv+DsbD1nXLiQ4zrE5UBvj5DWZJ93cwN0NX5PMsr1Pw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"suf-log": "^2.5.3"
|
||||
}
|
||||
},
|
||||
"node_modules/sax": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.4.4.tgz",
|
||||
@@ -6153,6 +6206,16 @@
|
||||
"inline-style-parser": "0.2.7"
|
||||
}
|
||||
},
|
||||
"node_modules/suf-log": {
|
||||
"version": "2.5.3",
|
||||
"resolved": "https://registry.npmjs.org/suf-log/-/suf-log-2.5.3.tgz",
|
||||
"integrity": "sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"s.color": "0.0.15"
|
||||
}
|
||||
},
|
||||
"node_modules/svgo": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/svgo/-/svgo-4.0.0.tgz",
|
||||
|
||||
+7
-1
@@ -6,12 +6,18 @@
|
||||
"sync": "node scripts/sync-content.mjs",
|
||||
"dev": "npm run sync && astro dev",
|
||||
"build": "npm run sync && astro build",
|
||||
"preview": "astro preview"
|
||||
"preview": "astro preview",
|
||||
"lint": "prettier --plugin prettier-plugin-astro --check \"src/**\" \"scripts/**\" astro.config.mjs",
|
||||
"format": "prettier --plugin prettier-plugin-astro --write \"src/**\" \"scripts/**\" astro.config.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"astro": "^5.7.10",
|
||||
"@astrojs/starlight": "^0.34.1",
|
||||
"sharp": "^0.33.5",
|
||||
"js-yaml": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^3.5.0",
|
||||
"prettier-plugin-astro": "^0.14.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user