Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1640 from LiskHQ/1185-add-prettier
Browse files Browse the repository at this point in the history
Add prettier
  • Loading branch information
sameersubudhi authored Oct 20, 2023
2 parents 2ca2af5 + f56c56f commit afceb5f
Show file tree
Hide file tree
Showing 661 changed files with 14,511 additions and 15,587 deletions.
8 changes: 3 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": [
"lisk-base"
"lisk-base",
"prettier"
],
"plugins": [
"import",
Expand Down Expand Up @@ -70,9 +71,6 @@
}
],
"mocha/no-skipped-tests": "off",
"indent": [
"error",
"tab"
]
"indent": "off"
}
}
10 changes: 0 additions & 10 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
---

name: Bug report
about: Create a report to help us improve
title: ''
labels: 'type: bug'
assignees: ''
projects: 'Lisk Service Version 0.7.0'
status: 'Backlog'

---

### Actual behavior



### Expected behavior



### Steps to reproduce



### Which version(s) does this affect? (Environment, OS, etc...)


1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Propose an idea for new improvements/features
title: ''
labels: 'type: enhancement, type: feature proposal'
assignees: ''

---

### Description
Expand Down
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
### What was the problem?

This PR resolves #INSERT_ISSUE_NUMBER

### How was it solved?

<!--- Please describe your technical implementation -->

### How was it tested?

<!--- Please describe how you tested your changes -->
2 changes: 1 addition & 1 deletion .github/semgrep/rule.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rules:
- id: schema_hardcoded_pattern
message: A fastest-validator schema uses a hardcoded pattern instead of a constant
languages:
languages:
- javascript
severity: WARNING
patterns:
Expand Down
42 changes: 21 additions & 21 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ "development", feature/*, hotfix/*, main, release/* ]
branches: ['development', feature/*, hotfix/*, main, release/*]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "development", feature/*, hotfix/*, release/* ]
branches: ['development', feature/*, hotfix/*, release/*]
schedule:
- cron: '30 3 * * 2'

Expand All @@ -32,28 +32,28 @@ jobs:
strategy:
fail-fast: true
matrix:
language: [ 'javascript' ]
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: '/language:${{matrix.language}}'
2 changes: 1 addition & 1 deletion .github/workflows/pr-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Set up node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
node-version-file: '.nvmrc'
- name: Install dependencies
run: make build-local
- name: Check test coverage
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Semgrep

on:
push:
branches: [ "development", feature/*, hotfix/*, main, release/* ]
branches: ['development', feature/*, hotfix/*, main, release/*]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "development", feature/*, hotfix/*, release/* ]
branches: ['development', feature/*, hotfix/*, release/*]
# Schedule the CI job (this method uses cron syntax):
schedule:
- cron: '30 3 * * 2'
Expand All @@ -15,8 +15,8 @@ on:
jobs:
semgrep:
# User definable name of this GitHub Actions job.
name: semgrep/ci
# If you are self-hosting, change the following `runs-on` value:
name: semgrep/ci
# If you are self-hosting, change the following `runs-on` value:
runs-on: ubuntu-latest

container:
Expand All @@ -36,7 +36,7 @@ jobs:
# Generate a token from Semgrep Cloud Platform > Settings
# and add it to your GitHub secrets.
# SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
SEMGREP_RULES: "p/javascript p/r2c p/r2c-security-audit p/r2c-best-practices p/nodejs p/nodejsscan ./.github/semgrep/rule.yaml"
SEMGREP_RULES: 'p/javascript p/r2c p/r2c-security-audit p/r2c-best-practices p/nodejs p/nodejsscan ./.github/semgrep/rule.yaml'

- name: Upload SARIF file for GitHub Advanced Security Dashboard
uses: github/codeql-action/upload-sarif@v2
Expand Down
61 changes: 61 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Files
Jenkinsfile*
Makefile
Dockerfile
LICENSE
.DS_Store
data/
.idea
logs/
jenkins/*.deployment

docs/

.gitkeep
mocha.opts

# rc files
.*rc
## ignore files
.*ignore

# Ignore extensions
*.png
*.sql
*.blob
*.ejs
*.sh
*.conf
*.env
*.info
*.log
*.tgz
*.lock
*.sqlite3

## jest snapshot
*.snap
*.tsbuildinfo

# project specific paths
test/.coverage-unit/
helm
coverage/
build/
dist/
docker/.env*
qa/
bin
tmp/

*.pid
*.gz

*.SHA256
*.mock
*.txt
.editorconfig

*.mainnet

docker/*
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all",
"useTabs": true,
"arrowParens": "avoid"
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Every microservice is independently managed and placed in a separate directory u
- The default installation method is based on Docker.
- Some token conversion rates in the Market service require their API keys.
- For the events information to be always available in the API, please set `system.keepEventsForHeights: -1` in the Lisk application node config.
- It is highly recommended to *NOT* enable any plugins on the Lisk application node when running Lisk Service against it. Enabling them can cause performance issues in Lisk Service.
- It is highly recommended to _NOT_ enable any plugins on the Lisk application node when running Lisk Service against it. Enabling them can cause performance issues in Lisk Service.

## Architecture Diagram

Expand Down
22 changes: 7 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
version: '3.3'
services:

nats:
image: nats:2.6-alpine
ports:
- "4222:4222"
- '4222:4222'
volumes:
- ./docker/nats-server.conf:/etc/nats/nats-server.conf:ro
command: nats-server --config /etc/nats/nats-server.conf
Expand Down Expand Up @@ -55,7 +54,7 @@ services:
- MYSQL_PASSWORD=password
- MYSQL_DATABASE=lisk
healthcheck:
test: [ 'CMD', 'bash', '/healthcheck.sh' ]
test: ['CMD', 'bash', '/healthcheck.sh']

mysql-read-replica:
image: mysql:8
Expand All @@ -69,7 +68,7 @@ services:
- ./docker/mysql/read/init:/docker-entrypoint-initdb.d
restart: always
expose:
- "3306"
- '3306'
networks:
- services_network
deploy:
Expand All @@ -79,20 +78,13 @@ services:
environment:
- MYSQL_ROOT_PASSWORD=password
healthcheck:
test:
[
"CMD",
"mysqladmin",
"ping",
"-hlocalhost",
"-ppassword"
]
test: ['CMD', 'mysqladmin', 'ping', '-hlocalhost', '-ppassword']

mysql-read-replica-haproxy:
image: nginx:latest
restart: always
expose:
- "3307"
- '3307'
depends_on:
mysql-read-replica:
condition: service_healthy
Expand All @@ -101,7 +93,7 @@ services:
networks:
- services_network
healthcheck:
test: [ "CMD", "service", "nginx", "status" ]
test: ['CMD', 'service', 'nginx', 'status']

blockchain-app-registry:
image: lisk/service_blockchain_app_registry
Expand Down Expand Up @@ -167,7 +159,7 @@ services:
- JOB_SCHEDULE_REFRESH_PEERS=${JOB_SCHEDULE_REFRESH_PEERS}
restart: always
extra_hosts:
- "host.docker.internal:host-gateway"
- 'host.docker.internal:host-gateway'

blockchain-indexer:
image: lisk/service_blockchain_indexer
Expand Down
2 changes: 2 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ _Before_ submitting a pull request, please make sure the following is done:
Follow the [JavaScript](https://github.com/airbnb/javascript) styleguide from
Airbnb with the
[lisk extension](https://github.com/LiskHQ/eslint-config-lisk-base).
1. Format your code using [Prettier](https://prettier.io/). This can be performed manually
with `npm run format`.
1. Submit a pull request via GitHub. Include issue numbers in the PR title, at
the end with: `Description - Closes #IssueNumber`.
1. Check that Jenkins CI tests pass (pull request turns green). First time
Expand Down
44 changes: 22 additions & 22 deletions framework/constants/ErrorCodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,31 @@ const errorCodes = [
];

const HTTP = {
PARSE_ERROR: [400, 'Bad Request'],
INVALID_REQUEST: [400, 'Bad Request'],
METHOD_NOT_FOUND: [404, 'Not Found'],
INVALID_PARAMS: [400, 'Bad Request'],
SERVER_ERROR: [500, 'Internal Server Error'],
NOT_FOUND: [404, 'Not Found'],
UNAUTHORIZED: [401, 'Unauthorized'],
FORBIDDEN: [403, 'Forbidden'],
TOO_MANY_REQUESTS: [429, 'Too Many Requests'],
NOT_IMPLEMENTED: [501, 'Not Implemented'],
SERVICE_UNAVAILABLE: [503, 'Service Unavailable'],
PARSE_ERROR: [400, 'Bad Request'],
INVALID_REQUEST: [400, 'Bad Request'],
METHOD_NOT_FOUND: [404, 'Not Found'],
INVALID_PARAMS: [400, 'Bad Request'],
SERVER_ERROR: [500, 'Internal Server Error'],
NOT_FOUND: [404, 'Not Found'],
UNAUTHORIZED: [401, 'Unauthorized'],
FORBIDDEN: [403, 'Forbidden'],
TOO_MANY_REQUESTS: [429, 'Too Many Requests'],
NOT_IMPLEMENTED: [501, 'Not Implemented'],
SERVICE_UNAVAILABLE: [503, 'Service Unavailable'],
};

const JSON_RPC = {
PARSE_ERROR: [-32700, 'Parse error'],
INVALID_REQUEST: [-32600, 'Invalid Request'],
METHOD_NOT_FOUND: [-32601, 'Method not found'],
INVALID_PARAMS: [-32602, 'Invalid params'],
SERVER_ERROR: [-32000, 'Server error'],
NOT_FOUND: [null, ''], // not defined, use {} response instead
UNAUTHORIZED: [-32600, 'Invalid Request'],
FORBIDDEN: [-32600, 'Invalid Request'],
TOO_MANY_REQUESTS: [-32001, 'Server error'],
NOT_IMPLEMENTED: [-32603, 'Internal error'],
SERVICE_UNAVAILABLE: [-32002, 'Server error'],
PARSE_ERROR: [-32700, 'Parse error'],
INVALID_REQUEST: [-32600, 'Invalid Request'],
METHOD_NOT_FOUND: [-32601, 'Method not found'],
INVALID_PARAMS: [-32602, 'Invalid params'],
SERVER_ERROR: [-32000, 'Server error'],
NOT_FOUND: [null, ''], // not defined, use {} response instead
UNAUTHORIZED: [-32600, 'Invalid Request'],
FORBIDDEN: [-32600, 'Invalid Request'],
TOO_MANY_REQUESTS: [-32001, 'Server error'],
NOT_IMPLEMENTED: [-32603, 'Internal error'],
SERVICE_UNAVAILABLE: [-32002, 'Server error'],
};

module.exports = {
Expand Down
Loading

0 comments on commit afceb5f

Please sign in to comment.