Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Lint & Format

permissions:
contents: read

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
python:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Ruff lint
uses: astral-sh/ruff-action@v3
with:
args: check

- name: Ruff format check
uses: astral-sh/ruff-action@v3
with:
args: format --check

frontend:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: 10

- uses: actions/setup-node@v4
with:
node-version: "20"
cache: pnpm
cache-dependency-path: frontend/pnpm-lock.yaml

- name: Install dependencies
run: cd frontend && pnpm install --frozen-lockfile

- name: ESLint
run: cd frontend && pnpm run lint

- name: Prettier check
run: cd frontend && pnpm run format:check
40 changes: 0 additions & 40 deletions .github/workflows/npx-prettier.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/pre-commit.yml

This file was deleted.

88 changes: 13 additions & 75 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,98 +1,36 @@
ci:
# https://pre-commit.ci/#configuration
autofix_prs: true
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
autoupdate_schedule: monthly

repos:
# General file hygiene
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: no-commit-to-branch
name: No commits to master
args: [--branch, main]
- id: end-of-file-fixer
name: End-of-file fixer
- name: mixed-line-ending
id: mixed-line-ending
- id: mixed-line-ending
args: [--fix, lf]
- id: trailing-whitespace
name: Remove trailing whitespaces
- id: check-toml
name: Check toml
- id: check-yaml
name: Check yaml
exclude: |
(?x)^(
conda/pytorch-geometric/meta.yaml|
conda/pyg/meta.yaml
)$

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.37.1
hooks:
- id: yamllint
name: Lint yaml
args: [-d, '{extends: default, rules: {line-length: disable, document-start: disable, truthy: {level: error}, braces: {max-spaces-inside: 1}}}']

- repo: https://github.com/asottile/pyupgrade
rev: v3.20.0
hooks:
- id: pyupgrade
name: Upgrade Python syntax
args: [--py38-plus]

- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
name: Remove unused imports and variables
args: [
--remove-all-unused-imports,
--remove-unused-variables,
--remove-duplicate-keys,
--ignore-init-module-imports,
--in-place,
]

- repo: https://github.com/google/yapf
rev: v0.43.0
hooks:
- id: yapf
name: Format code
additional_dependencies: [toml]

- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort
name: Sort imports

- repo: https://github.com/PyCQA/flake8
rev: 7.2.0
hooks:
- id: flake8
name: Check PEP8
additional_dependencies: [Flake8-pyproject]

# Python: Ruff (lint + format)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.12
hooks:
- id: ruff
name: Ruff formatting
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.22
hooks:
- id: mdformat
name: Format Markdown
additional_dependencies:
- mdformat-gfm
- mdformat_frontmatter
- mdformat_footnote

- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.0
# Frontend: lint-staged for ESLint + Prettier
- repo: local
hooks:
- id: sphinx-lint
name: Check Sphinx
- id: frontend-lint
name: frontend lint-staged
entry: bash -c 'cd frontend && pnpm exec lint-staged'
language: system
files: ^frontend/
pass_filenames: false
9 changes: 0 additions & 9 deletions .style.yapf

This file was deleted.

10 changes: 10 additions & 0 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"semi": true,
"singleQuote": false,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 2,
"bracketSpacing": true,
"arrowParens": "always",
"plugins": ["prettier-plugin-tailwindcss"]
}
31 changes: 31 additions & 0 deletions frontend/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import reactHooks from "eslint-plugin-react-hooks";

export default [
js.configs.recommended,
...tseslint.configs.recommended,
{
plugins: { "react-hooks": reactHooks },
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/no-explicit-any": "warn",
},
},
{
ignores: [
"node_modules/",
"dist/",
".next/",
"packages/core/src/generated/",
],
},
];
19 changes: 18 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
{
"name": "traceroot-frontend",
"private": true,
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write .",
"format:check": "prettier --check ."
},
"lint-staged": {
"*.{ts,tsx,js,jsx}": ["eslint --fix", "prettier --write"],
"*.{css,json,md}": ["prettier --write"]
},
"devDependencies": {
"dotenv-cli": "^11.0.0"
"@eslint/js": "^9.39.2",
"dotenv-cli": "^11.0.0",
"eslint": "^9.39.2",
"eslint-plugin-react-hooks": "^7.0.1",
"lint-staged": "^16.2.7",
"prettier": "^3.8.1",
"prettier-plugin-tailwindcss": "^0.7.2",
"typescript-eslint": "^8.54.0"
}
}
Loading