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

Replace AirBnb eslint rules with Prettier #1575

Merged
merged 3 commits into from
Feb 11, 2025
Merged
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
45 changes: 22 additions & 23 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ module.exports = {
ENV_MOBILE_DEVICE: true,
},
ignorePatterns: ['dist', 'platforms', 'plugins', 'www'],
extends: [
'plugin:vue/recommended',
'plugin:@intlify/vue-i18n/recommended',
'@vue/airbnb',
],
extends: ['plugin:vue/recommended', 'plugin:@intlify/vue-i18n/recommended'],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
Expand All @@ -20,13 +16,16 @@ module.exports = {
'vue/block-spacing': 'error',
'vue/brace-style': 'error',
'vue/camelcase': ['error', { properties: 'never' }],
'vue/comma-dangle': ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'always-multiline',
}],
'vue/comma-dangle': [
'error',
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'always-multiline',
},
],
'vue/component-name-in-template-casing': 'error',
'vue/eqeqeq': 'error',
'vue/key-spacing': 'error',
Expand All @@ -44,24 +43,24 @@ module.exports = {
'vuejs-accessibility/label-has-for': 'off',
'vuejs-accessibility/form-control-has-label': 'off',
'vue/multi-word-component-names': 'off',
'vue/max-attributes-per-line': 'off',
'vue/html-self-closing': 'off',
'vue/html-indent': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vuejs-accessibility/no-autofocus': 'off',
'vuejs-accessibility/alt-text': 'off',
},
parserOptions: {
parser: '@babel/eslint-parser',
},
overrides: [{
files: '**/__tests__/*',
env: {
jest: true,
},
}, {
files: 'backend/**',
rules: {
'import/no-extraneous-dependencies': ['error', { packageDir: 'backend' }],
'import/extensions': ['error', 'ignorePackages'],
overrides: [
{
files: '**/__tests__/*',
env: {
jest: true,
},
},
}],
],
settings: {
'vue-i18n': {
localeDir: './src/locales/*.json',
Expand Down
44 changes: 22 additions & 22 deletions .github/workflows/_validate-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ jobs:
build_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
- run: npm ci
working-directory: 'backend'
- run: npm test
working-directory: 'backend'
- run: npm ci --legacy-peer-deps # TODO: remove --legacy-peer-deps after updating dependencies
- run: docker compose up middleware -d --wait --quiet-pull
- run: ./docker-compose/init-state.mjs
- run: npm test
- uses: stefanzweifel/git-auto-commit-action@v5
if: failure()
with:
commit_message: "fixme: update e2e screenshots"
file_pattern: 'tests/e2e/*.png'
- run: docker compose logs
if: always()
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
- run: npm ci
working-directory: backend
- run: npm test
working-directory: backend
- run: npm ci --legacy-peer-deps # TODO: remove --legacy-peer-deps after updating dependencies
- run: docker compose up middleware -d --wait --quiet-pull
- run: ./docker-compose/init-state.mjs
- run: npm test
- uses: stefanzweifel/git-auto-commit-action@v5
if: failure()
with:
commit_message: 'fixme: update e2e screenshots'
file_pattern: tests/e2e/*.png
- run: docker compose logs
if: always()
8 changes: 4 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: integration

on:
push:
branches: [ develop ]
branches: [develop]

jobs:
validate:
uses: ./.github/workflows/_validate-npm.yml
publish:
uses: aeternity/github-actions/.github/workflows/[email protected]
needs: [ validate ]
needs: [validate]
secrets: inherit
with:
BUILD_ARGS: REVISION=${{ github.sha }}
Expand All @@ -19,6 +19,6 @@ jobs:
secrets: inherit
with:
DEPLOY_ENV: stg
DEPLOY_APP: "${{ github.event.repository.name }}"
DEPLOY_APP: '${{ github.event.repository.name }}'
DEPLOY_VERSION: develop
DEPLOY_SUBDOMAIN: "base"
DEPLOY_SUBDOMAIN: 'base'
12 changes: 6 additions & 6 deletions .github/workflows/pull-request-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: pull-request-cleanup

on:
pull_request:
branches: [ master, develop ]
types: [ closed ]
branches: [master, develop]
types: [closed]

jobs:
rollback:
Expand All @@ -12,14 +12,14 @@ jobs:
with:
DEPLOY_ENV: stg
DEPLOY_APP: ${{ github.event.repository.name }}
DEPLOY_VERSION: "pr-${{ github.event.number }}"
DEPLOY_SUBDOMAIN: "pr-${{ github.event.number }}-base"
DEPLOY_VERSION: pr-${{ github.event.number }}
DEPLOY_SUBDOMAIN: pr-${{ github.event.number }}-base
delete-tag:
uses: aeternity/github-actions/.github/workflows/[email protected]
secrets: inherit
with:
TAG: "pr-${{ github.event.number }}"
TAG: pr-${{ github.event.number }}
cleanup:
uses: aeternity/github-actions/.github/workflows/[email protected]
needs: [ delete-tag ]
needs: [delete-tag]
secrets: inherit
8 changes: 4 additions & 4 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: pull-request

on:
pull_request:
branches: [ master, develop ]
branches: [master, develop]

jobs:
validate:
uses: ./.github/workflows/_validate-npm.yml
publish:
uses: aeternity/github-actions/.github/workflows/[email protected]
needs: [ validate ]
needs: [validate]
secrets: inherit
with:
BUILD_ARGS: REVISION=${{ github.sha }}
Expand All @@ -20,5 +20,5 @@ jobs:
with:
DEPLOY_ENV: stg
DEPLOY_APP: ${{ github.event.repository.name }}
DEPLOY_VERSION: "pr-${{ github.event.number }}"
DEPLOY_SUBDOMAIN: "pr-${{ github.event.number }}-base"
DEPLOY_VERSION: pr-${{ github.event.number }}
DEPLOY_SUBDOMAIN: pr-${{ github.event.number }}-base
4 changes: 2 additions & 2 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: release-please

on:
push:
branches: [ master ]
branches: [master]

jobs:
release-please:
Expand All @@ -13,5 +13,5 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
package-name: ""
package-name: ''
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"ci","section":"CI / CD","hidden":false},{"type":"test","section":"Testing","hidden":false},{"type":"refactor","section":"Refactorings","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]'
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: release

on:
push:
tags: [ v* ]
tags: [v*]

jobs:
publish:
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
www
platforms
plugins
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 100,
"singleQuote": true
}
45 changes: 26 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## How to get the Base æpp

* [Google Play](https://play.google.com/store/apps/details?id=com.aeternity.base)
* [App Store](https://apps.apple.com/app/base-æpp-wallet/id1458655724)
* [Web version](https://base.aepps.com/)
- [Google Play](https://play.google.com/store/apps/details?id=com.aeternity.base)
- [App Store](https://apps.apple.com/app/base-æpp-wallet/id1458655724)
- [Web version](https://base.aepps.com/)

Also join our [Telegram channel](https://t.me/aeppbase) and our [Forum](https://forum.aeternity.com/t/base-aepp-wallet-we-would-like-your-feedback/3387).

Expand Down Expand Up @@ -54,33 +54,40 @@ npm test
## Contributing

We use the [gitflow](https://danielkummer.github.io/git-flow-cheatsheet/) workflow [this is also helpful](https://gist.github.com/JamesMGreene/cdd0ac49f90c987e45ac).
* Development of features happens in branches made from **develop** called feature/<the-feature> like feature/show-token-balance.
* When development is finished a pull request to **develop** is created. At least one person has to review the PR and when everything is fine the PR gets merged.
* The develop branch gets deployed to the [stage environment](https://base.stg.aepps.com) by travis.
* To make a new release create a release branch called release/vX.X.X, also bump the version number in package.json in this branch.
* Create a PR to master which then also has to be accepted.
* Create a tag for this version and push the tag.
* Also merge back the changes (like the version bump) into develop.
* The master branch has to be deployed to the [production environment](https://base.aepps.com/) manually.

- Development of features happens in branches made from **develop** called feature/<the-feature> like feature/show-token-balance.
- When development is finished a pull request to **develop** is created. At least one person has to review the PR and when everything is fine the PR gets merged.
- The develop branch gets deployed to the [stage environment](https://base.stg.aepps.com) by travis.
- To make a new release create a release branch called release/vX.X.X, also bump the version number in package.json in this branch.
- Create a PR to master which then also has to be accepted.
- Create a tag for this version and push the tag.
- Also merge back the changes (like the version bump) into develop.
- The master branch has to be deployed to the [production environment](https://base.aepps.com/) manually.

## Deployment

We have a stage (develop) and a production (master) branch and environments where these branches will be deployed to.
* [stage environment](https://base.stg.aepps.com)
* [production environment](https://base.aepps.com)

- [stage environment](https://base.stg.aepps.com)
- [production environment](https://base.aepps.com)

### stage
* Is used to see changes to the code in effect in a "real" environment without the fear of breaking the production environment.

- Is used to see changes to the code in effect in a "real" environment without the fear of breaking the production environment.

### production
* Is the production environment, code lives in the "master" branch.

- Is the production environment, code lives in the "master" branch.

### other branches
* Every branch is auto-deployed on `https://pr-<id>-base.stg.aepps.com/`, where `<id>` is a number of PR.

- Every branch is auto-deployed on `https://pr-<id>-base.stg.aepps.com/`, where `<id>` is a number of PR.

### unsigned .apk and .app file
* Find `aetenity.app.tar.gz` file in the [latest release](https://github.com/aeternity/aepp-base/releases/latest)
* Find `aeternity.apk` file in the [latest release](https://github.com/aeternity/aepp-base/releases/latest)

- Find `aetenity.app.tar.gz` file in the [latest release](https://github.com/aeternity/aepp-base/releases/latest)
- Find `aeternity.apk` file in the [latest release](https://github.com/aeternity/aepp-base/releases/latest)

### bundle analyzer report
* Get bundle analyzer report on each domain by adding /report.html. Example [https://base.stg.aepps.com/report.html](https://base.stg.aepps.com/report.html).

- Get bundle analyzer report on each domain by adding /report.html. Example [https://base.stg.aepps.com/report.html](https://base.stg.aepps.com/report.html).
9 changes: 2 additions & 7 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset',
],
plugins: [
'@babel/plugin-syntax-import-attributes',
'@babel/plugin-transform-private-methods',
],
presets: ['@vue/cli-plugin-babel/preset'],
plugins: ['@babel/plugin-syntax-import-attributes', '@babel/plugin-transform-private-methods'],
};
3 changes: 2 additions & 1 deletion backend/src/send-push-notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export default async (pushApiSubscription) => {
}
webPush.setVapidDetails(
'https://github.com/aeternity/aepp-base/issues',
process.env.VAPID_PUBLIC_KEY ?? 'BHkQhNWW2TKfKfxo7vAgXkZGcVOXGrjhIZJlN1hKp6abIjWJgO8FYPswXJ35XEuKw46O9yZ-8KmsZ4-TXNBePcw',
process.env.VAPID_PUBLIC_KEY ??
'BHkQhNWW2TKfKfxo7vAgXkZGcVOXGrjhIZJlN1hKp6abIjWJgO8FYPswXJ35XEuKw46O9yZ-8KmsZ4-TXNBePcw',
process.env.VAPID_PRIVATE_KEY ?? 'mwSZbWF_yU_h1gXlqlBy9cOfkOF-Pa0jhHxbTFXdhFE',
);
const subscription = JSON.parse(pushApiSubscription);
Expand Down
42 changes: 25 additions & 17 deletions backend/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ export default (port, log = () => {}) => {
const server = http.createServer((request, response) => {
if (request.url === '/version' && request.method === 'GET') {
response.setHeader('Content-Type', 'application/json');
const json = JSON.stringify({
version: pkg.version,
revision: process.env.REVISION || 'local',
...getStats(),
}, null, 2);
const json = JSON.stringify(
{
version: pkg.version,
revision: process.env.REVISION || 'local',
...getStats(),
},
null,
2,
);
response.write(json);
response.end();
return;
Expand Down Expand Up @@ -53,19 +57,22 @@ export default (port, log = () => {}) => {
io.on('connection', (socket) => {
const { key, pushApiSubscription } = socket.handshake.auth;

socket.on('message-to-all', (message) => socket
.to(getGroupName(pushApiSubscription ? key : leaderKeys[key]))
.emit('message', message));
socket.on('message-to-all', (message) =>
socket.to(getGroupName(pushApiSubscription ? key : leaderKeys[key])).emit('message', message),
);

if (pushApiSubscription) {
leaderMessages[key] ??= [];
leaderMessages[key].forEach((messageToLeader) => socket
.emit('message-from-follower', messageToLeader.key, messageToLeader.message));
log([
`Connected leader with key ${key}`,
`push api ${pushApiSubscription.slice(0, 30)}`,
`sent ${leaderMessages[key].length} offline messages`,
].join(', '));
leaderMessages[key].forEach((messageToLeader) =>
socket.emit('message-from-follower', messageToLeader.key, messageToLeader.message),
);
log(
[
`Connected leader with key ${key}`,
`push api ${pushApiSubscription.slice(0, 30)}`,
`sent ${leaderMessages[key].length} offline messages`,
].join(', '),
);
delete leaderMessages[key];

const groupName = getGroupName(key);
Expand Down Expand Up @@ -104,8 +111,9 @@ export default (port, log = () => {}) => {
fn(Object.fromEntries(entries));
});

socket.on('message-to-follower', (fKey, message) => socket
.to(fKey).emit('message-from-leader', message));
socket.on('message-to-follower', (fKey, message) =>
socket.to(fKey).emit('message-from-leader', message),
);

socket.on('disconnect', () => {
socket.to(getGroupName(key)).emit('leader-disconnected');
Expand Down
Loading