Skip to content

Commit

Permalink
Use project base
Browse files Browse the repository at this point in the history
And fix linting issues
  • Loading branch information
mfal committed Jun 5, 2020
1 parent 3af4df7 commit 38895ac
Show file tree
Hide file tree
Showing 58 changed files with 3,198 additions and 1,981 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root=true

[*]
indent_style=space
indent_size=4
tab_width=4
end_of_line=lf
charset=utf-8
trim_trailing_whitespace=true
insert_final_newline=true
max_line_length=140

[*.{yaml, yml, json}]
indent_size=2
tab_width=2
Empty file added .eslintignore
Empty file.
111 changes: 111 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
env:
node: true
jest/globals: true
es6: true
extends:
- plugin:@typescript-eslint/eslint-recommended
- plugin:prettier/recommended
- eslint:recommended
parser: "@typescript-eslint/parser"
plugins:
- "@typescript-eslint"
- jest
rules:
"@typescript-eslint/array-type":
- error
- default: array-simple
"@typescript-eslint/await-thenable": error
"@typescript-eslint/class-name-casing": error
"@typescript-eslint/consistent-type-assertions": off
"@typescript-eslint/consistent-type-definitions":
- error
- interface
"@typescript-eslint/explicit-function-return-type":
- error
- allowExpressions: true
allowHigherOrderFunctions: true
allowTypedFunctionExpressions: true
"@typescript-eslint/explicit-member-accessibility": error
"@typescript-eslint/generic-type-naming": error
"@typescript-eslint/member-delimiter-style":
- error
- multiline:
delimiter: semi
requireLast: true
singleline:
delimiter: semi
requireLast: false
"@typescript-eslint/member-ordering":
- error
- default:
- field
- constructor
- method
no-empty-function: off
"@typescript-eslint/no-empty-function": off
"@typescript-eslint/no-empty-interface": off
"@typescript-eslint/no-explicit-any": off
"@typescript-eslint/no-extra-parens": off
"@typescript-eslint/no-extraneous-class": off
"@typescript-eslint/no-floating-promises": error
"@typescript-eslint/no-for-in-array": off
"@typescript-eslint/no-inferrable-types": off
no-magic-numbers: off
"@typescript-eslint/no-magic-numbers": off
"@typescript-eslint/no-misused-new": error
"@typescript-eslint/no-misused-promises": error
"@typescript-eslint/no-namespace": error
"@typescript-eslint/no-non-null-assertion": off
"@typescript-eslint/no-parameter-properties": error
"@typescript-eslint/no-require-imports": off
"@typescript-eslint/no-this-alias": off
"@typescript-eslint/no-type-alias": off
"@typescript-eslint/no-unnecessary-condition": error
"@typescript-eslint/no-unnecessary-qualifier": error
"@typescript-eslint/no-unnecessary-type-arguments": off
"@typescript-eslint/no-unnecessary-type-assertion": error
"@typescript-eslint/no-unused-vars":
- error
- varsIgnorePattern: ^ignored
argsIgnorePattern: ^ignored
caughtErrorsIgnorePattern: ^ignored
"@typescript-eslint/no-use-before-define": error
"@typescript-eslint/no-useless-constructor": error
"@typescript-eslint/no-var-requires": off
"@typescript-eslint/prefer-for-of": error
"@typescript-eslint/prefer-function-type": error
"@typescript-eslint/prefer-includes": error
"@typescript-eslint/prefer-namespace-keyword": error
"@typescript-eslint/prefer-readonly": error
"@typescript-eslint/prefer-regexp-exec": error
"@typescript-eslint/prefer-string-starts-ends-with": error
"@typescript-eslint/promise-function-async": off
"@typescript-eslint/require-array-sort-compare": off
"@typescript-eslint/require-await": error
"@typescript-eslint/restrict-plus-operands": error
"@typescript-eslint/semi": off
"@typescript-eslint/strict-boolean-expressions": off
"@typescript-eslint/typedef": off
"@typescript-eslint/unbound-method":
- error
- ignoreStatic: true
"@typescript-eslint/unified-signatures": error
indent: off
linebreak-style:
- error
- unix
quotes:
- error
- double
- avoidEscape: true
semi:
- error
- always
no-dupe-class-members: off
globals:
Atomics: readonly
SharedArrayBuffer: readonly
parserOptions:
ecmaVersion: 2018
sourceType: module
project: ./tsconfig.eslint.json
14 changes: 14 additions & 0 deletions .githooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Install git-hooks

You must configure your local git to activate the custom git-hooks location.

```bash
> git config core.hooksPath .githooks
```

In case your git-client does not work with custom githooks locations (thanks git Kraken 😡), you have to execute the following in your repo
root

```bash
> cp -R .githooks/dot-git/* .git/hooks/
```
25 changes: 25 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

set -e
[[ "${DEBUG}" != "true" ]] || set -x

if ! which realpath > /dev/null ; then
echo "GNU coreutils are needed. If this is macOS, run 'brew install coreutils'."
exit 1
fi

SCRIPTS_DIR="scripts"
export GIT_HOOKS="$( cd "$(dirname "$0")" ; pwd -P )"
GIT_HOOKS_SCRIPTS="${GIT_HOOKS}/${SCRIPTS_DIR}"
CURRENT_HOOK="commit-msg"

for f in "${GIT_HOOKS_SCRIPTS}/${CURRENT_HOOK}/"*.sh ; do
[[ -x "${f}" ]] || continue
bash "${f}" ${@}
done

for d in $(find "${GIT_HOOKS}/.." -mindepth 2 -type d -iname .githooks) ; do
f="${d}/${CURRENT_HOOK}"
[[ -x "${f}" ]] || continue
bash "${f}" ${@}
done
3 changes: 3 additions & 0 deletions .githooks/dot-git/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -e
bash ".githooks/commit-msg"
3 changes: 3 additions & 0 deletions .githooks/dot-git/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -e
bash ".githooks/post-commit"
3 changes: 3 additions & 0 deletions .githooks/dot-git/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -e
bash ".githooks/pre-commit"
25 changes: 25 additions & 0 deletions .githooks/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

set -e
[[ "${DEBUG}" != "true" ]] || set -x

if ! which realpath > /dev/null ; then
echo "GNU coreutils are needed. If this is macOS, run 'brew install coreutils'."
exit 1
fi

SCRIPTS_DIR="scripts"
export GIT_HOOKS="$( cd "$(dirname "$0")" ; pwd -P )"
GIT_HOOKS_SCRIPTS="${GIT_HOOKS}/${SCRIPTS_DIR}"
CURRENT_HOOK="post-commit"

for f in "${GIT_HOOKS_SCRIPTS}/${CURRENT_HOOK}/"*.sh ; do
[[ -x "${f}" ]] || continue
bash "${f}" ${@}
done

for d in $(find "${GIT_HOOKS}/.." -mindepth 2 -type d -iname .githooks) ; do
f="${d}/${CURRENT_HOOK}"
[[ -x "${f}" ]] || continue
bash "${f}" ${@}
done
27 changes: 27 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -e
[[ "${DEBUG}" != "true" ]] || set -x

if ! which realpath > /dev/null ; then
echo "GNU coreutils are needed. If this is macOS, run 'brew install coreutils'."
exit 1
fi

SCRIPTS_DIR="scripts"
export GIT_HOOKS="$( cd "$(dirname "$0")" ; pwd -P )"
GIT_HOOKS_SCRIPTS="${GIT_HOOKS}/${SCRIPTS_DIR}"
CURRENT_HOOK="pre-commit"

for f in "${GIT_HOOKS_SCRIPTS}/${CURRENT_HOOK}/"*.sh ; do
[[ -x "${f}" ]] || continue
bash "${f}" ${@}
done

for d in $(find "${GIT_HOOKS}/.." -mindepth 2 -type d -iname .githooks) ; do
dn=$(basename $(dirname "${d}"))
echo -e "\n[${CURRENT_HOOK}] checking subproject \033[1m${dn}\033[0m"
f="${d}/${CURRENT_HOOK}"
[[ -x "${f}" ]] || continue
bash "${f}" ${@}
done
5 changes: 5 additions & 0 deletions .githooks/scripts/pre-commit/yarn-precommit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

ROOT="$(dirname ${0})/../../.."
ROOT="$(realpath "${ROOT}")"
yarn --cwd ${ROOT} precommit
24 changes: 12 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v1
with:
node-version: '10.x'
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@mittwald'
- run: yarn
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.MITTWALD_MACHINE_TOKEN }}
- uses: actions/checkout@v2
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v1
with:
node-version: "10.x"
registry-url: "https://npm.pkg.github.com"
# Defaults to the user or organization that owns the workflow file
scope: "@mittwald"
- run: yarn
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.MITTWALD_MACHINE_TOKEN }}
23 changes: 11 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v1
with:
node-version: '10.x'
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@mittwald'
- run: yarn compile
- run: yarn lint
env:
NODE_AUTH_TOKEN: ${{ secrets.MITTWALD_MACHINE_TOKEN }}
- uses: actions/checkout@v2
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v1
with:
node-version: "10.x"
registry-url: "https://npm.pkg.github.com"
# Defaults to the user or organization that owns the workflow file
scope: "@mittwald"
- run: yarn test:ci
env:
NODE_AUTH_TOKEN: ${{ secrets.MITTWALD_MACHINE_TOKEN }}
38 changes: 37 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
node_modules/
.idea
.vscode
dist/
coverage/
**/*_types-ti.ts
# Typescript and node
yarn-error.log
tmp/
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Editor-based Rest Client
.idea/httpRequests
# Operating Systems
.DS_Store
Thumbs.db
[Dd]esktop.ini
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 38895ac

Please sign in to comment.