mirror of
https://github.com/xlorepdarkhelm/numinar-coding-project.git
synced 2026-09-09 16:19:50 -04:00
Trying to make sure eslint works right for pre-commit.
Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
// lint-staged.js
|
||||
const { execSync } = require("child_process");
|
||||
const files = process.argv
|
||||
.slice(2)
|
||||
.filter((f) => /^src\/.*\.(js|jsx|ts|tsx)$/.test(f));
|
||||
const allFilesMode = process.argv.includes("--all-files");
|
||||
let files;
|
||||
|
||||
if (allFilesMode) {
|
||||
// Lint all frontend files
|
||||
files = ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"];
|
||||
} else {
|
||||
// Only lint staged files
|
||||
files = process.argv
|
||||
.slice(2)
|
||||
.filter((f) => /^src\/.*\.(js|jsx|ts|tsx)$/.test(f));
|
||||
}
|
||||
|
||||
if (files.length) {
|
||||
execSync(`yarn eslint ${files.join(" ")}`, { stdio: "inherit" });
|
||||
}
|
||||
|
||||
@@ -3,12 +3,9 @@
|
||||
Run with `nox -s <session>` from the project root.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import nox
|
||||
from nox_poetry import Session
|
||||
|
||||
|
||||
python_versions = ["3.13"]
|
||||
|
||||
|
||||
@@ -40,9 +37,6 @@ def precommit(session: Session) -> None:
|
||||
"pyupgrade",
|
||||
)
|
||||
session.run("pre-commit", *args)
|
||||
# Run frontend lint using yarn lint
|
||||
os.chdir("frontend")
|
||||
session.run("yarn", "lint", external=True)
|
||||
|
||||
|
||||
backend_sessions = [
|
||||
|
||||
Reference in New Issue
Block a user