Skip to content

Commit 364f31f

Browse files
authored
Merge pull request #19 from Adamant-im/dev
v1.5.0
2 parents 04a749a + 9d397ce commit 364f31f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2532
-1585
lines changed

.editorconfig

Lines changed: 0 additions & 15 deletions
This file was deleted.

.eslintrc.js

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,29 @@
11
module.exports = {
2-
"parserOptions": {
3-
"ecmaVersion": 8,
4-
"sourceType": "module"
5-
},
6-
"rules": {
7-
"semi": "warn", // обязательно ;
8-
"semi-spacing": ["error", {"before": false, "after": true}],
9-
"indent": ["error", "tab"],
10-
"space-infix-ops": "error",// отступы вокруг + - * / = и тд
11-
"eqeqeq": "error", // обязательно === и !== (нельзя == и !=)
12-
// "no-eq-null": "error", // обязательно === и !== (нельзя == и !=) но тоько в отношении null
13-
"curly": "error", // проверка шаблонов `${name}`
14-
// "space-before-function-paren": [ // отступ до и после function
15-
// "error", {
16-
// "anonymous": "always",
17-
// "named": "always",
18-
// "asyncArrow": "ignore"
19-
// }
20-
// ],
21-
"key-spacing": ["error", { "mode": "strict" }], // оформление обЪекта
22-
"space-in-parens": ["error", "never"], // запрет отступов ( a,b)
23-
"computed-property-spacing": ["error", "never"], // запрет лишних отступов в выражениях a[ i]
24-
"array-bracket-spacing": ["error", "never"],
25-
"no-multi-spaces": "error", // запрет лишних пробелов var a = 2
26-
"no-sparse-arrays": "warn", // предупреждение при дырке в массиве
27-
"no-mixed-spaces-and-tabs": "error", // нельзя миксовать табы и пробелы
28-
"keyword-spacing": ["error", { "after": true }],
29-
"comma-spacing": ["error", { "before": false, "after": true }], // отступ после запятой, а перед нельзя
30-
"no-undef":"error",
31-
"array-callback-return": "error" // коллбек методов массива типа arr.map arr.filter должны иметь return в коллбеке
32-
},
33-
"env": {
34-
"browser": true,
35-
"node": true
36-
},
37-
"globals": {
38-
"Vue":true,
39-
"Symbol":true,
40-
"Promise":true,
41-
},
42-
"plugins": []
43-
}
2+
env: {
3+
commonjs: true,
4+
es2021: true,
5+
browser: true,
6+
node: true,
7+
'jest/globals': true,
8+
},
9+
extends: ['eslint:recommended', 'google'],
10+
plugins: ['jest'],
11+
parserOptions: {
12+
ecmaVersion: 12,
13+
},
14+
rules: {
15+
'max-len': [
16+
'error',
17+
{
18+
code: 200,
19+
ignoreTrailingComments: true,
20+
ignoreUrls: true,
21+
ignoreStrings: true,
22+
ignoreTemplateLiterals: true,
23+
ignoreRegExpLiterals: true,
24+
},
25+
],
26+
'require-jsdoc': 'off',
27+
'quote-props': 'off',
28+
},
29+
};

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ logs/
33
.vscode/
44
test.js
55
package-lock.json
6+
.editorconfig

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run lint

CONTRIBUTING.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Contributing Guide
2+
3+
Before submitting your contribution, please make sure to take a moment and read through the following guidelines:
4+
5+
- [Pull Request Guidelines](#pull-request-guidelines)
6+
- [Development Setup](#development-setup)
7+
- [Scripts](#scripts)
8+
- [Project Structure](#project-structure)
9+
- [Contributing Tests](#contributing-tests)
10+
11+
## Pull Request Guidelines
12+
13+
- The master branch is just a snapshot of the latest stable release. All development should be done in dedicated branches. Do not submit PRs against the master branch.
14+
15+
- Checkout a topic branch from a base branch, e.g. `master`, and merge back against that branch.
16+
17+
- If adding a new feature add accompanying test case.
18+
19+
- It's OK to have multiple small commits as you work on the PR - GitHub can automatically squash them before merging.
20+
21+
- Make sure tests pass!
22+
23+
- Commit messages must follow the [commit message convention](./commit-convention.md). Commit messages are automatically validated before commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [husky](https://github.com/typicode/husky)).
24+
25+
- No need to worry about code style as long as you have installed the dev dependencies - modified files are automatically formatted with Prettier on commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [husky](https://github.com/typicode/husky)).
26+
27+
## Development Setup
28+
29+
You will need [Node.js](https://nodejs.org) **version 16+**.
30+
31+
After cloning the repo, run:
32+
33+
```bash
34+
$ npm i # install the dependencies of the project
35+
```
36+
37+
A high level overview of tools used:
38+
39+
- [Jest](https://jestjs.io/) for unit testing
40+
- [Prettier](https://prettier.io/) for code formatting
41+
42+
## Scripts
43+
44+
### `npm run lint`
45+
46+
The `lint` script runs linter.
47+
48+
```bash
49+
# lint files
50+
$ npm run lint
51+
# fix linter errors
52+
$ npm run lint:fix
53+
```
54+
55+
### `npm run test`
56+
57+
The `test` script simply calls the `jest` binary, so all [Jest CLI Options](https://jestjs.io/docs/en/cli) can be used. Some examples:
58+
59+
```bash
60+
# run all tests
61+
$ npm run test
62+
63+
# run all tests under the runtime-core package
64+
$ npm run test -- runtime-core
65+
66+
# run tests in a specific file
67+
$ npm run test -- fileName
68+
69+
# run a specific test in a specific file
70+
$ npm run test -- fileName -t 'test name'
71+
```
72+
73+
## Project Structure
74+
75+
- **`src`**: contains the source code
76+
77+
- **`api`**: contains group of methods and methods for the API.
78+
79+
- **`helpers`**: contains utilities shared across the entire codebase.
80+
81+
- **`tests`**: contains tests for the helpers directory.
82+
83+
- **`tests`**: contains tests for the src directory.
84+
85+
## Contributing Tests
86+
87+
Unit tests are collocated with the code being tested inside directories named `tests`. Consult the [Jest docs](https://jestjs.io/docs/en/using-matchers) and existing test cases for how to write new test specs. Here are some additional guidelines:
88+
89+
- Use the minimal API needed for a test case. For example, if a test can be written without involving the reactivity system or a component, it should be written so. This limits the test's exposure to changes in unrelated parts and makes it more stable.
90+
91+
- Only use platform-specific runtimes if the test is asserting platform-specific behavior.

commitlint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional']
3+
};

groups/decodeMsg.js

Lines changed: 0 additions & 83 deletions
This file was deleted.

groups/eth.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

groups/get.js

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)