Skip to content

Commit

Permalink
V6/code quality tools (#1890)
Browse files Browse the repository at this point in the history
* Move testing dependencies to devDependencies

* Add prettier and pre-commit hooks

* Tight up lint rules

* Remove unused dependencies

* Added github action for linter

* Jobs naming updated

Co-authored-by: Djordje Kovacevic <[email protected]>
  • Loading branch information
vterzic and djordjekovac authored Apr 4, 2022
1 parent 4c45cd6 commit 470ffd3
Show file tree
Hide file tree
Showing 10 changed files with 14,515 additions and 290 deletions.
28 changes: 3 additions & 25 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,18 @@ module.exports = {
es6: true,
node: true,
},
extends: 'airbnb',
extends: ['airbnb', 'prettier'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2017,
},
rules: {
indent: [
'error',
4,
],
'linebreak-style': [
'error',
'unix',
],
'linebreak-style': ['error', 'unix'],
camelcase: 0,
'class-methods-use-this': 0,
'no-unused-vars': 0,
'no-return-assign': 0,
'consistent-return': 0,
'no-var': 0,
'vars-on-top': 0,
'block-scoped-var': 0,
'no-restricted-syntax': 0,
'guard-for-in': 0,
'no-param-reassign': 0,
'no-underscore-dangle': 0,
'no-shadow': 0,
semi: [
'error',
'always',
],
'no-console': [
'error',
{ allow: ['warn', 'error', 'log'] },
],
'no-console': 'warn',
},
};
33 changes: 33 additions & 0 deletions .github/workflows/CHECK-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CHECK-lint

#todo this test should be execute when opening PR to prerelease/release branches
on: [pull_request]
env:
NODE_ENV: test
ARTIFACTS_DIR: artifacts
CUCUMBER_ARTIFACTS_DIR: artifacts/cucumber
jobs:
check-lint:
#todo think about locking the version - version should be the same as the one in official documentation
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: mkdir -p $ARTIFACTS_DIR
- run: cp .origintrail_noderc.tests .origintrail_noderc
- run: sudo chmod -R 777 $ARTIFACTS_DIR
- run: mkdir -p $CUCUMBER_ARTIFACTS_DIR
- run: sudo chmod -R 777 $CUCUMBER_ARTIFACTS_DIR
- run: npm run lint;
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: my-artifact
path: /home/runner/work/ot-node/ot-node/artifacts
2 changes: 1 addition & 1 deletion .github/workflows/TEST-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
CUCUMBER_ARTIFACTS_DIR: artifacts/cucumber
jobs:

test:
test-release:
#todo think about locking the version - version should be the same as the one in official documentation
runs-on: ubuntu-latest
services:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/TEST-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
CUCUMBER_ARTIFACTS_DIR: artifacts/cucumber
jobs:

test:
test-unit:
#todo think about locking the version - version should be the same as the one in official documentation
runs-on: ubuntu-latest
# services:
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

#npm run lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.{js, json}": ["prettier --write", "eslint"]
}
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"semi": true,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "always",
"tabWidth": 4,
"bracketSpacing": true
}
Loading

0 comments on commit 470ffd3

Please sign in to comment.