-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nabby27
committed
Dec 17, 2020
0 parents
commit 4854ffa
Showing
15 changed files
with
7,346 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,272 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 12, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"ignorePatterns": [ | ||
"node_modules/**/*", | ||
"dist/**/*" | ||
], | ||
"rules": { | ||
"no-console": [ | ||
1, | ||
{ | ||
"allow": [ | ||
"info", | ||
"warn" | ||
] | ||
} | ||
], | ||
"eqeqeq": 2, | ||
"dot-notation": 2, | ||
"curly": 2, | ||
"default-case": 2, | ||
"no-new-func": 2, | ||
"no-param-reassign": 2, | ||
"default-case-last": 2, | ||
"default-param-last": 2, | ||
"yoda": [ | ||
"error", | ||
"always" | ||
], | ||
"no-unused-expressions": 2, | ||
"no-caller": 2, | ||
"no-useless-concat": 2, | ||
"no-return-assign": 2, | ||
"max-classes-per-file": [ | ||
"error", | ||
1 | ||
], | ||
"no-new": 2, | ||
"no-empty-function": [ | ||
"error", | ||
{ | ||
"allow": [ | ||
"constructors" | ||
] | ||
} | ||
], | ||
"no-loop-func": 2, | ||
"no-magic-numbers": 2, | ||
"no-multi-spaces": 2, | ||
"no-else-return": [ | ||
"error", | ||
{ | ||
"allowElseIf": false | ||
} | ||
], | ||
"dot-location": [ | ||
"error", | ||
"property" | ||
], | ||
"no-extra-parens": [ | ||
"error", | ||
"all", | ||
{ | ||
"returnAssign": false, | ||
"nestedBinaryExpressions": false, | ||
"enforceForArrowConditionals": false | ||
} | ||
], | ||
"space-before-blocks": [ | ||
2, | ||
{ | ||
"functions": "always", | ||
"keywords": "always", | ||
"classes": "always" | ||
} | ||
], | ||
"indent": [ | ||
"error", | ||
2 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"no-use-before-define": 2, | ||
"array-bracket-newline": [ | ||
"error", | ||
"consistent" | ||
], | ||
"array-bracket-spacing": [ | ||
"error", | ||
"never", | ||
{ | ||
"arraysInArrays": false, | ||
"objectsInArrays": false, | ||
"singleValue": false | ||
} | ||
], | ||
"array-element-newline": [ | ||
"error", | ||
"consistent" | ||
], | ||
"block-spacing": [ | ||
"error", | ||
"never" | ||
], | ||
"brace-style": [ | ||
"error" | ||
], | ||
"camelcase": 2, | ||
"comma-dangle": [ | ||
"error", | ||
"never" | ||
], | ||
"comma-spacing": [ | ||
"error", | ||
{ | ||
"before": false, | ||
"after": true | ||
} | ||
], | ||
"comma-style": [ | ||
"error", | ||
"last" | ||
], | ||
"computed-property-spacing": [ | ||
"error", | ||
"never" | ||
], | ||
"eol-last": [ | ||
"error", | ||
"always" | ||
], | ||
"func-call-spacing": [ | ||
"error", | ||
"never" | ||
], | ||
"func-name-matching": [ | ||
"error", | ||
"always" | ||
], | ||
"func-style": [ | ||
"error", | ||
"declaration", | ||
{ | ||
"allowArrowFunctions": true | ||
} | ||
], | ||
"function-call-argument-newline": [ | ||
"error", | ||
"consistent" | ||
], | ||
"function-paren-newline": [ | ||
"error", | ||
"multiline" | ||
], | ||
"id-denylist": [ | ||
"error", | ||
"data", | ||
"err", | ||
"e", | ||
"cb", | ||
"callback" | ||
], | ||
"implicit-arrow-linebreak": [ | ||
"error", | ||
"beside" | ||
], | ||
"key-spacing": [ | ||
"error", | ||
{ | ||
"beforeColon": false | ||
} | ||
], | ||
"keyword-spacing": [ | ||
"error", | ||
{ | ||
"before": true, | ||
"after": true | ||
} | ||
], | ||
"line-comment-position": [ | ||
"error", | ||
{ | ||
"position": "beside" | ||
} | ||
], | ||
"max-lines-per-function": [ | ||
"error", | ||
20 | ||
], | ||
"max-params": [ | ||
"error", | ||
5 | ||
], | ||
"no-bitwise": "error", | ||
"no-lonely-if": "error", | ||
"no-mixed-spaces-and-tabs": "error", | ||
"no-multi-assign": "error", | ||
"no-multiple-empty-lines": [ | ||
"error", | ||
{ | ||
"max": 1, | ||
"maxEOF": 1 | ||
} | ||
], | ||
"no-trailing-spaces": "error", | ||
"no-whitespace-before-property": "error", | ||
"object-curly-spacing": [ | ||
"error", | ||
"always", | ||
{ | ||
"arraysInObjects": false, | ||
"objectsInObjects": false | ||
} | ||
], | ||
"object-property-newline": "error", | ||
"padded-blocks": [ | ||
"error", | ||
{ | ||
"classes": "always", | ||
"blocks": "never", | ||
"switches": "never" | ||
}, | ||
{ | ||
"allowSingleLineBlocks": true | ||
} | ||
], | ||
"padding-line-between-statements": [ | ||
"error", | ||
{ | ||
"blankLine": "always", | ||
"prev": "*", | ||
"next": "return" | ||
} | ||
], | ||
"quote-props": [ | ||
"error", | ||
"as-needed" | ||
], | ||
"arrow-body-style": [ | ||
"error", | ||
"as-needed", | ||
{ | ||
"requireReturnForObjectLiteral": true | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.vscode | ||
node_modules | ||
coverage | ||
dist | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# UseJS | ||
|
||
## Requirements for development | ||
|
||
--- | ||
|
||
- make (optional) | ||
- docker | ||
- docker-compose | ||
|
||
or | ||
|
||
- node | ||
- npm | ||
|
||
## How to develop | ||
|
||
--- | ||
|
||
This project is built with docker-compose and make. You can run the commands directly with npm but **it is highly recommended to use make with docker-compose** because you make sure to run it with the same version. Make raises the container with docker-compose, executes the task and removes the container, in this way the local machine is clean once you execute the commands. | ||
|
||
## Example commands | ||
|
||
--- | ||
|
||
- with make | ||
|
||
```sh | ||
make test | ||
``` | ||
|
||
- with docker-compose | ||
|
||
```sh | ||
docker-compose up -d | ||
docker-compose exec use_js npm run test | ||
dokcer-compose down | ||
``` | ||
|
||
- with npm | ||
|
||
```sh | ||
npm run test | ||
``` | ||
|
||
## Make commands | ||
|
||
--- | ||
|
||
```sh | ||
make install # install all project dependencies | ||
make install ARGS="date-fns" # install new dependencie | ||
make install ARGS="-D typescript" # install new dev dependencies | ||
``` | ||
|
||
```sh | ||
make eslint-check # run eslint check | ||
make eslint-fix # run eslint fix | ||
``` | ||
|
||
```sh | ||
make test # run jest test | ||
make test-watch # run jest test with watch all files | ||
make test-coverage # run jest test coverage | ||
make test-all # run eslint fix and jest test coverage | ||
``` | ||
|
||
> If you execute the command `make test-watch` make sure to exit with the `q` of the jest watch options and not with `Ctrl C`, because this would finish the `make` task without destroying the docker container. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.PHONY: up stop build install test test-watch test-watch-coverage test-coverage test-all eslint-check eslint-fix | ||
|
||
CONTAINER_NAME=use_js | ||
|
||
up: | ||
@docker-compose up -d | ||
|
||
stop: | ||
@docker-compose down | ||
|
||
build: up | ||
@docker-compose exec $(CONTAINER_NAME) npm run build || $(MAKE) stop | ||
${MAKE} stop | ||
|
||
install: up | ||
@docker-compose exec $(CONTAINER_NAME) npm install $(ARGS) || $(MAKE) stop | ||
${MAKE} stop | ||
|
||
test: up | ||
@docker-compose exec $(CONTAINER_NAME) npm run test || $(MAKE) stop | ||
${MAKE} stop | ||
|
||
test-watch: up | ||
@docker-compose exec $(CONTAINER_NAME) npm run test:watch || $(MAKE) stop | ||
$(MAKE) stop | ||
|
||
test-watch-coverage: up | ||
@docker-compose exec $(CONTAINER_NAME) npm run test:watch:coverage || $(MAKE) stop | ||
$(MAKE) stop | ||
|
||
test-coverage: up | ||
@docker-compose exec $(CONTAINER_NAME) npm run test:coverage || $(MAKE) stop | ||
@docker-compose exec $(CONTAINER_NAME) chown -R node:node coverage | ||
$(MAKE) stop | ||
|
||
test-all: up | ||
@docker-compose exec $(CONTAINER_NAME) npm run test:all | ||
$(MAKE) stop | ||
|
||
eslint-check: up | ||
@docker-compose exec $(CONTAINER_NAME) npm run eslint:check || $(MAKE) stop | ||
${MAKE} stop | ||
|
||
eslint-fix: up | ||
@docker-compose exec $(CONTAINER_NAME) npm run eslint:fix || $(MAKE) stop | ||
${MAKE} stop |
Oops, something went wrong.