diff --git a/.gitea/workflows/format-js.yml b/.gitea/workflows/format-js.yml new file mode 100644 index 0000000..d07d9ea --- /dev/null +++ b/.gitea/workflows/format-js.yml @@ -0,0 +1,26 @@ +name: Format (JS/TS) + +on: + pull_request: + +jobs: + format: + runs-on: alpine + container: node:20-alpine + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install tools + run: | + apk add --no-cache \ + git + + - name: Prettier + run: | + if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then + npx --yes prettier --check "**/*.{js,jsx,ts,tsx,mjs,cjs}" --ignore-path .gitignore + else + echo "No JS/TS files found" + fi diff --git a/.gitea/workflows/lint-js.yml b/.gitea/workflows/lint-js.yml new file mode 100644 index 0000000..93cce6c --- /dev/null +++ b/.gitea/workflows/lint-js.yml @@ -0,0 +1,33 @@ +name: Lint (JS/TS) + +on: + pull_request: + +jobs: + lint: + runs-on: alpine + container: node:20-alpine + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install tools + run: | + apk add --no-cache \ + git + + - name: ESLint + run: | + if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then + if [ -f package.json ]; then + npm install --no-audit --no-fund + fi + if [ -f eslint.config.js ] || [ -f eslint.config.mjs ] || [ -f eslint.config.cjs ] || [ -f .eslintrc ] || [ -f .eslintrc.js ] || [ -f .eslintrc.cjs ] || [ -f .eslintrc.json ] || [ -f .eslintrc.yaml ] || [ -f .eslintrc.yml ]; then + npx --yes eslint . + else + echo "No eslint config found" + fi + else + echo "No JS/TS files found" + fi diff --git a/.gitea/workflows/lint-python.yml b/.gitea/workflows/lint-python.yml new file mode 100644 index 0000000..c029d82 --- /dev/null +++ b/.gitea/workflows/lint-python.yml @@ -0,0 +1,27 @@ +name: Lint (Python) + +on: + pull_request: + +jobs: + lint: + runs-on: alpine + container: node:20-alpine + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install tools + run: | + apk add --no-cache \ + git \ + python3 \ + py3-pip + + - name: Ruff + run: | + python3 -m venv .venv + . .venv/bin/activate + pip install --no-cache-dir ruff + ruff check . diff --git a/.gitea/workflows/lint-rust.yml b/.gitea/workflows/lint-rust.yml new file mode 100644 index 0000000..1f81769 --- /dev/null +++ b/.gitea/workflows/lint-rust.yml @@ -0,0 +1,27 @@ +name: Lint (Rust) + +on: + pull_request: + +jobs: + lint: + runs-on: alpine + container: node:20-alpine + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install tools + run: | + apk add --no-cache \ + git \ + rust + + - name: Rustfmt + run: | + if [ -f Cargo.toml ]; then + cargo fmt --check + else + echo "No Rust project found" + fi diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..19ffb91 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,13 @@ +{ + "semi": true, + "singleQuote": true, + "jsxSingleQuote": false, + "tabWidth": 4, + "printWidth": 100, + "trailingComma": "es5", + "bracketSpacing": true, + "bracketSameLine": false, + "arrowParens": "always", + "endOfLine": "lf", + "proseWrap": "preserve" +} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..e54c60b --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,14 @@ +export default [ + { + files: ["**/*.{js,jsx,ts,tsx,mjs,cjs}"], + languageOptions: { + ecmaVersion: 2021, + sourceType: "module" + }, + linterOptions: { + reportUnusedDisableDirectives: true + }, + rules: { + } + } +];