Skip to content

Commit

Permalink
refactor(repo): format with prettify and ESLint
Browse files Browse the repository at this point in the history
Format existing code and automate formatting
  • Loading branch information
jwulf committed Dec 18, 2023
1 parent d937612 commit e3d3dda
Show file tree
Hide file tree
Showing 129 changed files with 36,301 additions and 34,664 deletions.
2 changes: 2 additions & 0 deletions packages/zeebe/src/.editorconfig → .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ end_of_line = lf

[*.{ts,js,json}]
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
quote_type = single

[*.{py,md,markdown}]
indent_style = space
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages/*/dist/
30 changes: 30 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "import", "prettier"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:prettier/recommended"
],
"rules": {
// Define your rules, for example:
"semi": "off",
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index"
],
"newlines-between": "always"
}
],
"import/newline-after-import": "error",
"prettier/prettier": "error"
}
}
22 changes: 19 additions & 3 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,33 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensures commit history is fetched
fetch-depth: 0 # Ensures commit history is fetched

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18' # Specify a Node.js version
node-version: "18" # Specify a Node.js version

- name: Install dependencies
run: npm install
env:
GH_NPM_TOKEN: ${{ secrets.GH_NPM_TOKEN }}

- name: Lint last commit
- name: Lint last commit message
run: npx commitlint --from=${{ github.event.pull_request.base.sha }} --to=${{ github.event.pull_request.head.sha }} --verbose

- name: Run Prettier
run: lerna run prettify

- name: Run ESLint
run: lerna run lint

- name: Commit and push if changes
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add -A
git diff --staged --quiet || git commit -m "Apply Prettier formatting"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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
20 changes: 14 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"conventionalCommits.scopes": [
"repo",
"oauth",
"tasklist"
]
}
"conventionalCommits.scopes": ["repo", "oauth", "tasklist"],
"editor.formatOnSave": true,

"editor.defaultFormatter": "esbenp.prettier-vscode",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.validate": ["typescript"],
"eslint.workingDirectories": [{ "mode": "auto" }],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "explicit"
}
}
Loading

0 comments on commit e3d3dda

Please sign in to comment.