Skip to content

Commit

Permalink
refactor: ESM refactor with eslint formatting
Browse files Browse the repository at this point in the history
Introduces:
Eslint (spaces -> tabs)
Commitlint
Strict ESM enforce
Refactor to adhere to linting rules
  • Loading branch information
kevintyj committed Dec 1, 2023
1 parent 45c2d24 commit c263d48
Show file tree
Hide file tree
Showing 78 changed files with 7,972 additions and 4,815 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = tab
indent_size = 1
tab_width = 4
insert_final_newline = true
trim_trailing_whitespace = true
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false

[*.yml]
indent_style = space
indent_size = 2
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 🐞 Bug Report
description: File a bug/issue
title: '[fix] <title>'
labels: [bug, needs triage]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
1. With this config...
1. Run '...'
1. See error...
validations:
required: false
- type: textarea
attributes:
label: Environment
description: |
examples:
- **OS**: Ubuntu 20.04
- **Node**: 13.14.0
- **npm**: 7.6.3
value: |
- OS:
- Node:
- npm:
render: markdown
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: 🏠 Alooma Development Homebase
url: https://rvx.one/alooma-homebase
about: Access our development homebase for additional information about the repository.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/docs_change.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 📖 Documentation Change
description: Propose changes to the documentation
title: '[docs] <title>'
labels: [documentation]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Describe the proposed changes
description: A concise description of what you're experiencing.
validations:
required: true
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
60 changes: 60 additions & 0 deletions .github/ISSUE_TEMPLATE/request_feat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: 🌟 Feature Request
description: Suggest a feature idea for this project
title: '[feat] <title>'
labels: [enhancement]
body:
- type: checkboxes
attributes:
label: Is there an existing request for this?
description: Please search to see if an feature request (issue) already exists for the bug you encountered.
options:
- label: I have searched the existing feature requests
required: true
- type: textarea
attributes:
label: Is the feature request related to a problem?
description: A concise description of the issue. E.g I'm always frustrated when [...]
validations:
required: false
- type: textarea
attributes:
label: Is the feature request related to a existing bug/RFC?
description: If so, please put the PR/Issue number below.
validations:
required: false
- type: textarea
attributes:
label: Describe the solution you'd like
description: What does the feature request look like?
validations:
required: true
- type: textarea
attributes:
label: What is the definition of done?
description: What are it's subtasks? How do we know the feature request is fulfilled?
validations:
required: true
- type: textarea
attributes:
label: Any solutions considered?
description: |
Did you consider alternative solutions or features? Do you have a proposed solution for the feature request?
validations:
required: false
- type: dropdown
attributes:
label: Are you able to assist to bring the feature to reality?
options:
- No
- Yes, I can
validations:
required: true
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
24 changes: 24 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## What is the purpose of this PR?

## ClickUp/Jira/Github project ticket number(s)?

## What did you do?

## How do we test it?

## Checklist before merging
- [ ] Added tests where necessary
- [ ] Performed a self-review of my code
- [ ] Ensure all acceptance criteria are met
- [ ] Implemented the UI as exactly as the design (applicable only for UI changes)
- [ ] Added comments for codes where hard-to-understand
- [ ] Haven't pushed unnecessary files (ex: `.env`, `.map`)
- [ ] Haven't ignored Typescript warnings in the code (if do so add a comment with the reason)

## Provide screenshot details of the PR

## [optional] Tests passed screenshot

## [optional] Breaking changes after PR

## Anything else?
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: 🧪 CI Tests
on:
pull_request:
branches:
- '**'
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🔖Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 📦Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- name: 🌳Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm

- name: 🛠️Install dependencies from lockfile
run: pnpm install --frozen-lockfile

- name: 🧾Print versions
run: |
git --version
node --version
pnpm --version
pnpm commitlint --version
- name: 📝Validate PR commits with commitlint
if: ${{ github.event_name !== 'push' }}
run: pnpm commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose

- name: 🤞Run CI command
run: pnpm run ci

- name: ☂️Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
33 changes: 28 additions & 5 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,40 @@
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
'on':
on:
push:
branches:
- master
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm i && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
- name: 🔖Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 📦Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- name: 🌳Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm

- name: 🛠️Install dependencies from lockfile
run: pnpm install --frozen-lockfile

- name: 🧾Print versions
run: |
git --version
node --version
pnpm --version
pnpm commitlint --version
- name: 🚀 Firebase deployment on merge!
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_AMBIENT_RVX }}'
Expand Down
31 changes: 27 additions & 4 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,38 @@
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR
'on': pull_request
on: pull_request
jobs:
build_and_preview:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm i && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
- name: 🔖Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 📦Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- name: 🌳Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm

- name: 🛠️Install dependencies from lockfile
run: pnpm install --frozen-lockfile

- name: 🧾Print versions
run: |
git --version
node --version
pnpm --version
pnpm commitlint --version
- name: 🚀 Firebase deployment on merge!
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_AMBIENT_RVX }}'
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/prlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 📝 Lint PR title
on:
pull_request:
types: [opened, edited, reopened, synchronize]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🔖Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 📦Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- name: 🌳Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm
- name: 🛠️Install dependencies for prlint
run: pnpm install @commitlint/config-conventional

- name: 🧾Print versions
run: |
git --version
node --version
pnpm --version
pnpm commitlint --version
- name: 📝Validate PR title with commitlint
uses: kevintyj/prlint@v1
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
Loading

0 comments on commit c263d48

Please sign in to comment.