Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: added Prettier on entire codebase #404

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"sonarjs",
"security",
"github"
],
"plugins": ["@typescript-eslint", "sonarjs", "security", "github"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
Expand All @@ -14,27 +9,17 @@
"plugin:security/recommended"
],
"rules": {
"curly": [
"error",
"multi-line"
],
"curly": ["error", "multi-line"],
"@typescript-eslint/no-explicit-any": "off",
"semi": [
"warn",
"never"
],
"semi": ["warn", "never"],
"sonarjs/cognitive-complexity": "warn"
},
"globals": {
"process": "readonly"
},
"overrides": [
{
"files": [
"*.spec.ts",
"*.spec.tsx",
"src/help/command.ts"
],
"files": ["*.spec.ts", "*.spec.tsx", "src/help/command.ts"],
"rules": {
"no-undef": "off",
"security/detect-non-literal-fs-filename": "off",
Expand All @@ -49,4 +34,4 @@
}
}
]
}
}
14 changes: 7 additions & 7 deletions .github/workflows/automerge-for-humans-merging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
# 5. Removes repeated authors (authors can have more than one commit in the PR).
# 6. Builds the `Co-authored-by: ...` lines with actual info.
# 7. Transforms the array into plain text. Thanks to this, the actual stdout of this step can be used by the next Workflow step (wich is basically the automerge).
cmd: |
cmd: |
curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" "${{github.event.pull_request._links.commits.href}}?per_page=100" |
jq -r '[.[]
| {name: .commit.author.name, email: .commit.author.email, login: .author.login}]
Expand All @@ -45,11 +45,11 @@ jobs:
- name: Automerge PR
uses: pascalgn/[email protected]
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
MERGE_LABELS: "!do-not-merge,ready-to-merge"
MERGE_METHOD: "squash"
GITHUB_TOKEN: '${{ secrets.GH_TOKEN }}'
MERGE_LABELS: '!do-not-merge,ready-to-merge'
MERGE_METHOD: 'squash'
# Using the output of the previous step (`Co-authored-by: ...` lines) as commit description.
# Important to keep 2 empty lines as https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-the-command-line mentions
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})\n\n\n${{ steps.authors.outputs.value }}"
MERGE_RETRIES: "20"
MERGE_RETRY_SLEEP: "30000"
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})\n\n\n${{ steps.authors.outputs.value }}"
MERGE_RETRIES: '20'
MERGE_RETRY_SLEEP: '30000'
6 changes: 3 additions & 3 deletions .github/workflows/automerge-orphans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: 'Notify on failing automerge'

on:
schedule:
- cron: "0 0 * * *"
- cron: '0 0 * * *'

jobs:
identify-orphans:
Expand Down Expand Up @@ -53,12 +53,12 @@ jobs:
uses: LoveToKnow/[email protected]
id: issuemarkdown
with:
text: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})"
text: '-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})'
- if: steps.orphans.outputs.found == 'true'
name: Send info about orphan to slack
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{secrets.SLACK_CI_FAIL_NOTIFY}}
SLACK_TITLE: 🚨 Not merged PR that should be automerged 🚨
SLACK_MESSAGE: ${{steps.issuemarkdown.outputs.text}}
MSG_MINIMAL: true
MSG_MINIMAL: true
14 changes: 7 additions & 7 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Autoapproving
uses: hmarr/auto-approve-action@v2
with:
github-token: "${{ secrets.GH_TOKEN_BOT_EVE }}"
github-token: '${{ secrets.GH_TOKEN_BOT_EVE }}'

- name: Label autoapproved
uses: actions/github-script@v5
Expand All @@ -43,10 +43,10 @@ jobs:
- name: Automerging
uses: pascalgn/[email protected]
env:
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
GITHUB_TOKEN: '${{ secrets.GH_TOKEN }}'
GITHUB_LOGIN: asyncapi-bot
MERGE_LABELS: ""
MERGE_METHOD: "squash"
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})"
MERGE_RETRIES: "20"
MERGE_RETRY_SLEEP: "30000"
MERGE_LABELS: ''
MERGE_METHOD: 'squash'
MERGE_COMMIT_MESSAGE: '{pullRequest.title} (#{pullRequest.number})'
MERGE_RETRIES: '20'
MERGE_RETRY_SLEEP: '30000'
68 changes: 34 additions & 34 deletions .github/workflows/autoupdate.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# This action is centrally managed in https://github.com/asyncapi/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo
# This workflow is designed to work with:
# - autoapprove and automerge workflows for dependabot and asyncapibot.
# - special release branches that we from time to time create in upstream repos. If we open up PRs for them from the very beginning of the release, the release branch will constantly update with new things from the destination branch they are opened against
# It uses GitHub Action that auto-updates pull requests branches, whenever changes are pushed to their destination branch.
# Autoupdating to latest destination branch works only in the context of upstream repo and not forks
name: autoupdate
on:
push:
branches-ignore:
- 'version-bump/**'
- 'dependabot/**'
- 'bot/**'
- 'all-contributors/**'
jobs:
autoupdate-for-bot:
if: startsWith(github.repository, 'asyncapi/')
name: Autoupdate autoapproved PR created in the upstream
runs-on: ubuntu-latest
steps:
- name: Autoupdating
uses: docker://chinthakagodawita/autoupdate-action:v1
env:
GITHUB_TOKEN: '${{ secrets.GH_TOKEN_BOT_EVE }}'
PR_FILTER: "labelled"
PR_LABELS: "autoupdate"
PR_READY_STATE: "ready_for_review"
MERGE_CONFLICT_ACTION: "ignore"
# This action is centrally managed in https://github.com/asyncapi/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo

# This workflow is designed to work with:
# - autoapprove and automerge workflows for dependabot and asyncapibot.
# - special release branches that we from time to time create in upstream repos. If we open up PRs for them from the very beginning of the release, the release branch will constantly update with new things from the destination branch they are opened against

# It uses GitHub Action that auto-updates pull requests branches, whenever changes are pushed to their destination branch.
# Autoupdating to latest destination branch works only in the context of upstream repo and not forks

name: autoupdate

on:
push:
branches-ignore:
- 'version-bump/**'
- 'dependabot/**'
- 'bot/**'
- 'all-contributors/**'

jobs:
autoupdate-for-bot:
if: startsWith(github.repository, 'asyncapi/')
name: Autoupdate autoapproved PR created in the upstream
runs-on: ubuntu-latest
steps:
- name: Autoupdating
uses: docker://chinthakagodawita/autoupdate-action:v1
env:
GITHUB_TOKEN: '${{ secrets.GH_TOKEN_BOT_EVE }}'
PR_FILTER: 'labelled'
PR_LABELS: 'autoupdate'
PR_READY_STATE: 'ready_for_review'
MERGE_CONFLICT_ACTION: 'ignore'
2 changes: 1 addition & 1 deletion .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This action is centrally managed in https://github.com/asyncapi/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo

# Purpose of this action is to update npm package in libraries that use it. It is like dependabot for asyncapi npm modules only.
# Purpose of this action is to update npm package in libraries that use it. It is like dependabot for asyncapi npm modules only.
# It runs in a repo after merge of release commit and searches for other packages that use released package. Every found package gets updated with lates version

name: Bump package version in dependent repos - if Node project
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/coverall.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
on:
on:
push:
branches:
- master
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
name: Check test coverage
name: Check test coverage
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- name: npm install, run test
run: |
npm install
npm run test
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- name: npm install, run test
run: |
npm install
npm run test
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

name: Create help comment

on:
issue_comment:
types:
- created
on:
issue_comment:
types:
- created

jobs:
create_help_comment_pr:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/if-nodejs-pr-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
id: should_run
name: Should Run
run: echo "::set-output name=shouldrun::true"
- if: steps.should_run.outputs.shouldrun == 'true'
- if: steps.should_run.outputs.shouldrun == 'true'
name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- if: steps.should_run.outputs.shouldrun == 'true'
- if: steps.should_run.outputs.shouldrun == 'true'
name: Checkout repository
uses: actions/checkout@v2
- if: steps.should_run.outputs.shouldrun == 'true'
- if: steps.should_run.outputs.shouldrun == 'true'
name: Check if Node.js project and has package.json
id: packagejson
run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
Expand All @@ -64,7 +64,7 @@ jobs:
continue-on-error: true
- if: steps.first-installation.outputs.status == 'failure' && steps.packagejson.outputs.exists == 'true'
name: Clear NPM cache and install deps again
run: |
run: |
npm cache clean --force
npm install --loglevel verbose
- if: steps.packagejson.outputs.exists == 'true'
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/if-nodejs-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ on:
- alpha

jobs:

test-nodejs:
# We just check the message of first commit as there is always just one commit because we squash into one before merging
# "commits" contains array of objects where one of the properties is commit "message"
Expand Down Expand Up @@ -113,4 +112,4 @@ jobs:
fields: repo,action,workflow
text: 'Release workflow failed in release job'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
8 changes: 4 additions & 4 deletions .github/workflows/if-nodejs-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# It does magic only if there is package.json file in the root of the project
name: Version bump - if Node.js project

on:
on:
release:
types:
types:
- published

jobs:
Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:
- if: steps.packagejson.outputs.exists == 'true'
name: Assets generation
run: npm run generate:assets --if-present
- if: steps.packagejson.outputs.exists == 'true'
- if: steps.packagejson.outputs.exists == 'true'
name: Bump version in package.json
# There is no need to substract "v" from the tag as version script handles it
# When adding "bump:version" script in package.json, make sure no tags are added by default (--no-git-tag-version) as they are already added by release workflow
Expand All @@ -62,4 +62,4 @@ jobs:
fields: repo,action,workflow
text: 'Unable to bump the version in package.json after the release'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
23 changes: 11 additions & 12 deletions .github/workflows/release-announcements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@

name: 'Announce releases in different channels'

on:
on:
release:
types:
types:
- published

jobs:

slack-announce:
name: Slack - notify on every release
runs-on: ubuntu-latest
Expand All @@ -18,14 +17,14 @@ jobs:
uses: LoveToKnow/[email protected]
id: markdown
with:
text: "[${{github.event.release.tag_name}}](${{github.event.release.html_url}}) \n ${{ github.event.release.body }}"
text: "[${{github.event.release.tag_name}}](${{github.event.release.html_url}}) \n ${{ github.event.release.body }}"
- name: Send info about release to Slack
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_RELEASES }}
SLACK_TITLE: Release ${{github.event.release.tag_name}} for ${{github.repository}} is out in the wild 😱💪🍾🎂
SLACK_MESSAGE: ${{steps.markdown.outputs.text}}
MSG_MINIMAL: true
SLACK_WEBHOOK: ${{ secrets.SLACK_RELEASES }}
SLACK_TITLE: Release ${{github.event.release.tag_name}} for ${{github.repository}} is out in the wild 😱💪🍾🎂
SLACK_MESSAGE: ${{steps.markdown.outputs.text}}
MSG_MINIMAL: true

twitter-announce:
name: Twitter - notify on minor and major releases
Expand Down Expand Up @@ -71,7 +70,7 @@ jobs:
uses: m1ner79/[email protected]
with:
twitter_status: "Release ${{github.event.release.tag_name}} for ${{github.repository}} is out in the wild 😱💪🍾🎂\n\nThank you for the contribution ${{ steps.author.outputs.name }} ${{github.event.release.html_url}}"
twitter_consumer_key: ${{ secrets.TWITTER_CONSUMER_KEY }}
twitter_consumer_secret: ${{ secrets.TWITTER_CONSUMER_SECRET }}
twitter_access_token_key: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
twitter_access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
twitter_consumer_key: ${{ secrets.TWITTER_CONSUMER_KEY }}
twitter_consumer_secret: ${{ secrets.TWITTER_CONSUMER_SECRET }}
twitter_access_token_key: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
twitter_access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
2 changes: 1 addition & 1 deletion .github/workflows/scripts/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
The entire `scripts` directory is centrally managed in [.github](https://github.com/asyncapi/.github/) repository. Any changes in this folder should be done in central repository.
The entire `scripts` directory is centrally managed in [.github](https://github.com/asyncapi/.github/) repository. Any changes in this folder should be done in central repository.
Loading