forked from 1inch/shieldy
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Rulexec/style
Big refactoring: eslint/strict typescript/tests
- Loading branch information
Showing
160 changed files
with
11,396 additions
and
3,683 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
TOKEN=123 | ||
MONGO=mongodb://localhost:27017/shieldy | ||
MONGO=mongodb://user:password@localhost:27017/shieldy | ||
WORKERS_COUNT=1 |
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,72 @@ | ||
const options = { | ||
root: true, | ||
env: { | ||
node: true, | ||
es6: true, | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
], | ||
rules: { | ||
'linebreak-style': ['error', 'unix'], | ||
'wrap-iife': ['error', 'inside'], | ||
'no-constant-condition': ['error', {checkLoops: false}], | ||
'no-restricted-syntax': ['error', 'BinaryExpression[operator="in"]'], | ||
'semi': ['error', 'always'], | ||
}, | ||
|
||
overrides: [ | ||
{ | ||
files: ['**/?(*.)+(spec|test).ts'], | ||
plugins: ['jest'], | ||
extends: ['plugin:jest/recommended'], | ||
rules: { | ||
'jest/expect-expect': 0, | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
const errorRules = [ | ||
'guard-for-in', | ||
'no-extra-bind', | ||
'no-extra-label', | ||
'no-floating-decimal', | ||
'no-lone-blocks', | ||
'no-loop-func', | ||
'no-new', | ||
'no-new-wrappers', | ||
'no-octal-escape', | ||
'no-proto', | ||
'no-return-assign', | ||
'no-self-compare', | ||
'no-sequences', | ||
'no-unmodified-loop-condition', | ||
'no-unused-expressions', | ||
'no-useless-call', | ||
'no-useless-return', | ||
'require-await', | ||
'no-label-var', | ||
]; | ||
|
||
const warningRules = [ | ||
'block-scoped-var', | ||
'dot-notation', | ||
'radix', | ||
// 'no-console', | ||
'no-mixed-spaces-and-tabs', | ||
]; | ||
|
||
errorRules.forEach(function (x) { | ||
options.rules[x] = 'error'; | ||
}); | ||
|
||
warningRules.forEach(function (x) { | ||
options.rules[x] = 'warn'; | ||
}); | ||
|
||
module.exports = options; |
This file was deleted.
Oops, something went wrong.
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,20 @@ | ||
name: PR checks | ||
on: | ||
pull_request: | ||
types: [synchronize] | ||
jobs: | ||
PR-Checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
- name: Setup nodejs | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '12' | ||
cache: 'yarn' | ||
- name: Install dependencies | ||
run: yarn install | ||
- run: yarn run lint | ||
- run: yarn run build-ts | ||
- run: yarn run test |
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,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run precommit |
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,13 @@ | ||
semi: true | ||
|
||
printWidth: 80 | ||
|
||
tabWidth: 2 | ||
useTabs: false | ||
|
||
singleQuote: true | ||
quoteProps: consistent | ||
trailingComma: all | ||
|
||
bracketSpacing: false | ||
arrowParens: always |
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,3 @@ | ||
{ | ||
"editor.tabSize": 2 | ||
} |
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,9 @@ | ||
- Move methods like `botRemoveEntryMessages` out of `src/database/mongo` | ||
- Wrap all promises without `.catch(report)` | ||
- Investigate mongodb reconnects | ||
- Fix type hacks from `src/types/hacks` | ||
- Get rid of custom `telegraf` dependency | ||
- Migrate all telegraf's `.command`, `.action`, `.use` to methods from `appContext` | ||
- Collect stats (at least requests per minute) | ||
- Use external queue for telegram updates (for seamless updates) | ||
- Write scripts for backup/restore |
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,6 @@ | ||
module.exports = { | ||
presets: [ | ||
['@babel/preset-env', { targets: { node: 'current' } }], | ||
'@babel/preset-typescript', | ||
], | ||
} |
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,16 @@ | ||
export default { | ||
clearMocks: true, | ||
// collectCoverage: true, | ||
// coverageDirectory: 'coverage', | ||
// coverageProvider: 'v8', | ||
roots: ['src'], | ||
testMatch: ['**/?(*.)+(spec|test).[tj]s'], | ||
testPathIgnorePatterns: ['/node_modules/'], | ||
moduleNameMapper: { | ||
'^@root/(.*)': '<rootDir>/src/$1', | ||
'^@helpers/(.*)': '<rootDir>/src/helpers/$1', | ||
'^@middlewares/(.*)': '<rootDir>/src/middlewares/$1', | ||
'^@commands/(.*)': '<rootDir>/src/commands/$1', | ||
'^@models/(.*)': '<rootDir>/src/models/$1', | ||
}, | ||
} |
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
Oops, something went wrong.