diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..67738fb47 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI and Lint + +on: + pull_request: + branches: [ main ] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Install dependencies + run: npm ci + + - name: Lint changed files + if: github.event_name == 'pull_request' + run: | + git fetch origin ${{ github.base_ref }} + FILES=$(git diff --name-only origin/${{ github.base_ref }} ${{ github.sha }} | grep -E '\.(js|jsx|ts|tsx|html|css)$' || true) + if [ -n "$FILES" ]; then + echo "Linting changed files:" + echo "$FILES" + echo "$FILES" | xargs npx prettier --check + echo "$FILES" | grep -E '\.(js|jsx|ts|tsx)$' | xargs npx eslint || true + else + echo "No relevant files changed." + fi + env: + CI: true \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json index 412837af4..41fe45a0c 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,3 +1,10 @@ { - "parser": "html" + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "useTabs": false, + "trailingComma": "es5", + "bracketSpacing": true, + "arrowParens": "always", + "printWidth": 80 } \ No newline at end of file