diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d2139f9..e9c8bfe 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,35 +1,35 @@ name: Deploy to GitHub Pages on: - push: - branches: [ main ] + push: + branches: [main] jobs: - deploy: - runs-on: ubuntu-latest - permissions: - contents: write # Needed to push to the gh-pages branch + deploy: + runs-on: ubuntu-latest + permissions: + contents: write # Needed to push to the gh-pages branch - steps: - - name: Checkout Code - uses: actions/checkout@v3 + steps: + - name: Checkout Code + uses: actions/checkout@v3 - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '22' - cache: 'npm' + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '22' + cache: 'npm' - - name: Install Dependencies - run: npm ci + - name: Install Dependencies + run: npm ci - - name: Build - run: npm run build + - name: Build + run: npm run build - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist - publish_branch: deployed-ver - force_orphan: true + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist + publish_branch: deployed-ver + force_orphan: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..c7a1671 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,53 @@ +name: Lint Codebase + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: write + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'pull_request' + with: + ref: ${{ github.head_ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + + - uses: actions/checkout@v4 + if: github.event_name != 'pull_request' + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Fix JS Lint + run: npm run lint:js -- --fix + continue-on-error: true + + - name: Fix CSS Lint + run: npm run lint:css -- --fix + continue-on-error: true + + - name: Format with Prettier + run: npm run format + continue-on-error: true + + - name: Commit and Push changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: 'style: auto-fix linting issues' + + - name: Run HTML Lint + run: npm run lint:html \ No newline at end of file diff --git a/.htmlhintignore b/.htmlhintignore new file mode 100644 index 0000000..2730e75 --- /dev/null +++ b/.htmlhintignore @@ -0,0 +1,3 @@ +dist/ +node_modules/ +legacy/ diff --git a/.htmlhintrc b/.htmlhintrc new file mode 100644 index 0000000..33b528e --- /dev/null +++ b/.htmlhintrc @@ -0,0 +1,12 @@ +{ + "tag-pair": true, + "tagname-lowercase": true, + "attr-lowercase": true, + "attr-value-double-quotes": true, + "doctype-first": true, + "id-unique": true, + "src-not-empty": true, + "alt-require": true, + "head-script-disabled": false, + "spec-char-escape": true +} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..df8a97b --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +dist/ +node_modules/ +legacy/ +package-lock.json +*.min.js +.github/ \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..b6c80cc --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "semi": true, + "singleQuote": true, + "tabWidth": 4, + "trailingComma": "es5", + "printWidth": 120, + "endOfLine": "auto" +} diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 0000000..b828468 --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,12 @@ +{ + "extends": "stylelint-config-standard", + "rules": { + "no-empty-source": null, + "selector-class-pattern": null, + "media-feature-range-notation": null, + "declaration-block-no-redundant-longhand-properties": null, + "color-function-notation": null, + "alpha-value-notation": null + }, + "ignoreFiles": ["dist/**/*.css", "node_modules/**/*.css", "legacy/**/*.css"] +} diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index 74b24a2..f8ecc5c 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -21,6 +21,25 @@ This project uses [Vite](https://vitejs.dev/) for local development and optimize - **Dependency Management**: No more manual path tracking or broken internal imports. - **Automated PWA**: Service Worker generation and asset hashing are handled automatically. +## Code Quality & Linting + +We use a standard stack to ensure code quality and consistency: + +- **JS**: [ESLint](https://eslint.org/) +- **CSS**: [Stylelint](https://stylelint.io/) +- **HTML**: [HTMLHint](https://htmlhint.com/) +- **Formatting**: [Prettier](https://prettier.io/) + +### Commands + +- **Check everything:** `npm run lint` +- **Auto-format code:** `npm run format` (Runs Prettier) +- **Fix JS issues:** `npm run lint:js -- --fix` +- **Fix CSS issues:** `npm run lint:css -- --fix` + +> [!IMPORTANT] +> A GitHub Action automatically runs these checks on every push and pull request. Please ensure `npm run lint` passes before committing. + ## Project Structure - `/js`: Application source code. - `/public`: Static assets (images, manifest, instances.json) that are copied directly to the build folder. diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..e5ad37b --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,25 @@ +import js from "@eslint/js"; +import globals from "globals"; +import prettierConfig from "eslint-config-prettier"; + +export default [ + { + ignores: ["dist/", "node_modules/", "legacy/", "sw.js"] + }, + js.configs.recommended, + prettierConfig, + { + languageOptions: { + ecmaVersion: 2022, + sourceType: "module", + globals: { + ...globals.browser, + ...globals.node + } + }, + rules: { + "no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }], + "no-console": ["warn", { "allow": ["warn", "error"] }] + } + } +]; diff --git a/index.html b/index.html index fadb6fe..630725e 100644 --- a/index.html +++ b/index.html @@ -55,7 +55,7 @@
Default shared instance is active. Override below only if needed.
- +We only store music data and a randomized ID to find out which Google account is which.
All data is anonymous. We do not store anything like emails, usernames, or anything sensitive.
However, if you want complete control over your data, we allow you to use your own firebase configuration.
If Monochrome has been useful to you and you're able to, consider making a donation.
It helps pay for the domain, and you get to support us :)