Introducing eslint (#1048)

* Introducing eslint
This commit is contained in:
Igor Gov 2022-04-28 11:46:00 +03:00 committed by GitHub
parent 90c54f9505
commit e71a12d399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 63 additions and 44 deletions

View File

@ -141,3 +141,42 @@ jobs:
with: with:
version: latest version: latest
working-directory: tap/extensions/redis working-directory: tap/extensions/redis
- uses: actions/setup-node@v2
with:
node-version: 16
- name: Check modified UI files
id: ui_modified_files
run: devops/check_modified_files.sh ui/
- name: ESLint prerequisites ui
if: steps.ui_modified_files.outputs.matched == 'true'
run: |
sudo npm install -g eslint
cd ui
npm run prestart
npm i
- name: ESLint ui
if: steps.ui_modified_files.outputs.matched == 'true'
run: |
cd ui
npm run eslint
- name: Check modified ui-common files
id: ui_common_modified_files
run: devops/check_modified_files.sh ui-common/
- name: ESLint prerequisites ui-common
if: steps.ui_common_modified_files.outputs.matched == 'true'
run: |
sudo npm install -g eslint
cd ui-common
npm i
- name: ESLint ui-common
if: steps.ui_common_modified_files.outputs.matched == 'true'
run: |
cd ui-common
npm run eslint

12
devops/ui-common-pack.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
# exit when any command fails
set -e
dst_folder=$1
echo "dst folder: $dst_folder";
cd $dst_folder/../ui-common
npm i
npm pack
mv up9-mizu-common-0.0.0.tgz $dst_folder

View File

@ -1,6 +1,5 @@
build/ build/
dist/ dist/
src/
node_modules/ node_modules/
.snapshots/ .snapshots/
*.min.js *.min.js

View File

@ -1,34 +0,0 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"standard",
"standard-react",
"plugin:prettier/recommended",
"prettier/standard",
"prettier/react",
"plugin:@typescript-eslint/eslint-recommended"
],
"env": {
"node": true
},
"parserOptions": {
"ecmaVersion": 2020,
"ecmaFeatures": {
"legacyDecorators": true,
"jsx": true
}
},
"settings": {
"react": {
"version": "16"
}
},
"rules": {
"space-before-function-paren": 0,
"react/prop-types": 0,
"react/jsx-handler-names": 0,
"react/jsx-fragments": 0,
"react/no-unused-prop-types": 0,
"import/export": 0
}
}

View File

@ -23,7 +23,7 @@
"moment": "^2.29.1", "moment": "^2.29.1",
"node-fetch": "^3.1.1", "node-fetch": "^3.1.1",
"numeral": "^2.0.6", "numeral": "^2.0.6",
"protobuf-decoder": "^0.1.0", "protobuf-decoder": "^0.1.2",
"react-graph-vis": "^1.0.7", "react-graph-vis": "^1.0.7",
"react-lowlight": "^3.0.0", "react-lowlight": "^3.0.0",
"react-router-dom": "^6.2.1", "react-router-dom": "^6.2.1",
@ -26065,9 +26065,9 @@
} }
}, },
"node_modules/protobuf-decoder": { "node_modules/protobuf-decoder": {
"version": "0.1.1", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/protobuf-decoder/-/protobuf-decoder-0.1.1.tgz", "resolved": "https://registry.npmjs.org/protobuf-decoder/-/protobuf-decoder-0.1.2.tgz",
"integrity": "sha512-yeyeCkdvOnzv+6/2YNx2FlT7565arz/mb0QnhmXFdHMwnek9Jp/0PpHJVdJkzdFBgi85XQWRcHdWHh2dOBrSng==" "integrity": "sha512-dKPIsI7W1A88f8WAXHzNujQuDWLAWVviw2svDOlwkpdVlaV8TRjxuBL4tE3dczYWRZ1ZeNts06k9njB4xjnBVQ=="
}, },
"node_modules/proxy-addr": { "node_modules/proxy-addr": {
"version": "2.0.7", "version": "2.0.7",
@ -55355,9 +55355,9 @@
} }
}, },
"protobuf-decoder": { "protobuf-decoder": {
"version": "0.1.1", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/protobuf-decoder/-/protobuf-decoder-0.1.1.tgz", "resolved": "https://registry.npmjs.org/protobuf-decoder/-/protobuf-decoder-0.1.2.tgz",
"integrity": "sha512-yeyeCkdvOnzv+6/2YNx2FlT7565arz/mb0QnhmXFdHMwnek9Jp/0PpHJVdJkzdFBgi85XQWRcHdWHh2dOBrSng==" "integrity": "sha512-dKPIsI7W1A88f8WAXHzNujQuDWLAWVviw2svDOlwkpdVlaV8TRjxuBL4tE3dczYWRZ1ZeNts06k9njB4xjnBVQ=="
}, },
"proxy-addr": { "proxy-addr": {
"version": "2.0.7", "version": "2.0.7",

View File

@ -19,7 +19,8 @@
"test:build": "run-s build", "test:build": "run-s build",
"test:lint": "eslint .", "test:lint": "eslint .",
"predeploy": "cd example && npm install && npm run build", "predeploy": "cd example && npm install && npm run build",
"deploy": "gh-pages -d example/build" "deploy": "gh-pages -d example/build",
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx"
}, },
"peerDependencies": { "peerDependencies": {
"@craco/craco": "^6.4.3", "@craco/craco": "^6.4.3",

View File

@ -51,11 +51,13 @@
"react-error-overlay": "6.0.9" "react-error-overlay": "6.0.9"
}, },
"scripts": { "scripts": {
"prestart": "../devops/ui-common-pack.sh $PWD",
"start": "craco start", "start": "craco start",
"start-dev": "./node_modules/.bin/env-cmd -f .env.dev.basic craco start", "start-dev": "./node_modules/.bin/env-cmd -f .env.dev.basic craco start",
"build": "./node_modules/.bin/env-cmd -f .env.basic craco build", "build": "./node_modules/.bin/env-cmd -f .env.basic craco build",
"test": "craco test", "test": "craco test",
"eject": "craco eject" "eject": "craco eject",
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings=0"
}, },
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [