Merge pull request #1969 from mempool/knorrium/eslint

Add eslint to the backend and frontend
This commit is contained in:
wiz 2022-07-06 00:20:03 +02:00 committed by GitHub
commit c17cf308d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 4322 additions and 81 deletions

View File

@ -1,48 +1,88 @@
name: CI Pipeline for the Backend and Frontend
on:
push:
env:
NODE_VERSION: 16.15.0
jobs:
build_backend:
name: Build backend
runs-on: ubuntu-latest
backend:
strategy:
matrix:
flavor: ['dev', 'prod']
runs-on: 'ubuntu-latest'
name: Backend (${{ matrix.flavor }})
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{ matrix.flavor }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
- name: Install
if: ${{ matrix.flavor == 'dev'}}
run: npm install
working-directory: ${{ matrix.flavor }}/backend
- name: Install (Prod dependencies only)
if: ${{ matrix.flavor == 'prod'}}
run: npm install --prod
working-directory: backend
# - name: Lint
# run: npm run lint
working-directory: ${{ matrix.flavor }}/backend
- name: Lint
if: ${{ matrix.flavor == 'dev'}}
run: npm run lint
working-directory: ${{ matrix.flavor }}/backend
# - name: Test
# run: npm run test
- name: Build
run: npm run build
working-directory: backend
build_frontend:
name: Build frontend
runs-on: ubuntu-latest
working-directory: ${{ matrix.flavor }}/backend
frontend:
strategy:
matrix:
flavor: ['dev', 'prod']
runs-on: 'ubuntu-latest'
name: Frontend (${{ matrix.flavor }})
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{ matrix.flavor }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
- name: Install (Prod dependencies only)
run: npm install
if: ${{ matrix.flavor == 'prod'}}
working-directory: ${{ matrix.flavor }}/frontend
- name: Install
run: npm install --prod
working-directory: frontend
# - name: Lint
# run: npm run lint
if: ${{ matrix.flavor == 'dev'}}
run: npm install
working-directory: ${{ matrix.flavor }}/frontend
- name: Lint
run: npm run lint
working-directory: ${{ matrix.flavor }}/frontend
# - name: Test
# run: npm run test
- name: Build
run: npm run build
working-directory: frontend
working-directory: ${{ matrix.flavor }}/frontend

2
backend/.eslintignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
dist

32
backend/.eslintrc Normal file
View File

@ -0,0 +1,32 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/ban-ts-comment": 1,
"@typescript-eslint/ban-types": 1,
"@typescript-eslint/no-empty-function": 1,
"@typescript-eslint/no-explicit-any": 1,
"@typescript-eslint/no-inferrable-types": 1,
"@typescript-eslint/no-namespace": 1,
"@typescript-eslint/no-this-alias": 1,
"@typescript-eslint/no-var-requires": 1,
"no-console": 1,
"no-constant-condition": 1,
"no-dupe-else-if": 1,
"no-empty": 1,
"no-prototype-builtins": 1,
"no-self-assign": 1,
"no-useless-catch": 1,
"no-var": 1,
"prefer-const": 1,
"prefer-rest-params": 1
}
}

2591
backend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,9 @@
"build": "npm run tsc",
"start": "node --max-old-space-size=2048 dist/index.js",
"start-production": "node --max-old-space-size=4096 dist/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "./node_modules/.bin/eslint . --ext .ts",
"lint:fix": "./node_modules/.bin/eslint . --ext .ts --fix"
},
"dependencies": {
"@mempool/electrum-client": "^1.1.7",
@ -43,6 +45,9 @@
"@types/compression": "^1.7.2",
"@types/express": "^4.17.13",
"@types/ws": "~8.5.3",
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"eslint": "^8.19.0",
"tslint": "^6.1.0"
}
}

3
frontend/.eslintignore Normal file
View File

@ -0,0 +1,3 @@
node_modules
dist
frontend

34
frontend/.eslintrc Normal file
View File

@ -0,0 +1,34 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/ban-ts-comment": 1,
"@typescript-eslint/ban-types": 1,
"@typescript-eslint/no-empty-function": 1,
"@typescript-eslint/no-explicit-any": 1,
"@typescript-eslint/no-inferrable-types": 1,
"@typescript-eslint/no-namespace": 1,
"@typescript-eslint/no-this-alias": 1,
"@typescript-eslint/no-var-requires": 1,
"no-case-declarations": 1,
"no-console": 1,
"no-constant-condition": 1,
"no-dupe-else-if": 1,
"no-empty": 1,
"no-extra-boolean-cast": 1,
"no-prototype-builtins": 1,
"no-self-assign": 1,
"no-useless-catch": 1,
"no-var": 1,
"prefer-const": 1,
"prefer-rest-params": 1
}
}

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,8 @@
"build-mempool-bisq-js": "browserify -p tinyify ./node_modules/@mempool/mempool.js/lib/index-bisq.js --standalone bisqJS > ./dist/mempool/browser/en-US/bisq.js",
"build-mempool-liquid-js": "browserify -p tinyify ./node_modules/@mempool/mempool.js/lib/index-liquid.js --standalone liquidJS > ./dist/mempool/browser/en-US/liquid.js",
"test": "npm run ng -- test",
"lint": "npm run ng -- lint",
"lint": "./node_modules/.bin/eslint . --ext .ts",
"lint:fix": "./node_modules/.bin/eslint . --ext .ts --fix",
"e2e": "npm run generate-config && npm run ng -- e2e",
"e2e:ci": "npm run cypress:run:ci",
"config:defaults:mempool": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true LIQUID_TESTNET_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=mempool BLOCK_WEIGHT_UNITS=4000000 && npm run generate-config",
@ -107,7 +108,10 @@
"@types/jasmine": "~4.0.3",
"@types/jasminewd2": "~2.0.10",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"codelyzer": "~6.0.2",
"eslint": "^8.19.0",
"http-proxy-middleware": "^1.0.5",
"jasmine-core": "~4.1.0",
"jasmine-spec-reporter": "~7.0.0",

View File

@ -31,7 +31,7 @@ export class BisqTransfersComponent implements OnInit, OnChanges {
}
ngOnChanges() {
this.totalOutput = this.tx.outputs.filter((output) => output.isVerified).reduce((acc, output) => acc + output.bsqAmount, 0);;
this.totalOutput = this.tx.outputs.filter((output) => output.isVerified).reduce((acc, output) => acc + output.bsqAmount, 0);
}
switchCurrency() {

View File

@ -17,15 +17,15 @@ export class ApiDocsNavComponent implements OnInit {
constructor() { }
ngOnInit(): void {
if( this.whichTab === 'rest' ) {
if (this.whichTab === 'rest') {
this.tabData = restApiDocsData;
} else if( this.whichTab = 'faq' ) {
} else if (this.whichTab === 'faq') {
this.tabData = faqData;
}
}
navLinkClick( event ) {
this.navLinkClickEvent.emit( event );
navLinkClick(event) {
this.navLinkClickEvent.emit(event);
}
}