Skip to content

Commit

Permalink
feat: add test for Rest class and better error management
Browse files Browse the repository at this point in the history
  • Loading branch information
vafanassieff committed Oct 29, 2021
1 parent 3588f37 commit f698528
Show file tree
Hide file tree
Showing 9 changed files with 408 additions and 42 deletions.
40 changes: 35 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
module.exports = {
extends: [
'standard',
'prettier',
'plugin:chai-friendly/recommended',
'plugin:prettier/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:node/recommended',
'plugin:promise/recommended',
],
plugins: ['import', 'prettier', 'promise'],
ignorePatterns: ['examples/**'],
env: {
node: true,
es2020: true,
mocha: true,
},
globals: {
module: true,
Expand All @@ -22,13 +21,44 @@ module.exports = {
sourceType: 'module',
},
rules: {
'promise/no-callback-in-promise': 'off',
'space-before-function-paren': 'off',
'new-cap': 'off',
camelcase: 'off',
'import/no-unresolved': ['error', { commonjs: true }],
'import/no-extraneous-dependencies': 'error',
'node/shebang': 'off',
'node/no-unsupported-features/es-syntax': 'off',
'node/no-missing-require': 'off',
'no-global-assign': ['error', { exceptions: ['require'] }],
'node/no-unpublished-require': [
'error',
{
allowModules: ['redis-mock'],
},
],
'no-empty': ['error', { allowEmptyCatch: true }],
camelcase: 'off',
'prefer-destructuring': [
'error',
{
VariableDeclarator: {
array: false,
object: true,
},
AssignmentExpression: {
array: true,
object: false,
},
},
{
enforceForRenamedProperties: false,
},
],
'require-await': 'error',
'no-return-await': 'error',
'no-return-assign': 'error',
eqeqeq: 'error',
'no-var': 'error',
'prefer-const': 'error',
'prefer-arrow-callback': 'error',
},
}
5 changes: 5 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm lint
pnpm test
3 changes: 3 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'src/**/*.js': ['prettier --write', 'eslint --fix'],
}
3 changes: 0 additions & 3 deletions .lintstagedrc.yml

This file was deleted.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@
"sats",
"bitcoin"
],
"engines": {
"node": ">=14",
"pnpm": ">=6"
},
"scripts": {
"test": "echo \"No tests.\"",
"test": "mocha test/index.js --bail --exit",
"prepare": "husky install",
"eslint": "eslint --fix",
"prettier": "prettier --write",
Expand All @@ -42,15 +46,18 @@
"devDependencies": {
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"chai": "^4.3.4",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-chai-friendly": "^0.7.2",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^5.1.1",
"husky": "^7.0.1",
"lint-staged": "^11.1.2",
"mocha": "^9.1.3",
"prettier": "^2.3.2"
}
}
Loading

0 comments on commit f698528

Please sign in to comment.