Skip to content

Commit

Permalink
feat: v2 preparations (#680)
Browse files Browse the repository at this point in the history
* feat: v2 preparations

* chore: add editorconfig, install prettier, rename tool-versions, drop dead nodejs versions from CI

* feat: rewrite architecture from scratch, add basic implementation for plugin system, add abuse-ipdb plugin

* feat: work in progress (types)

* feat: add example playground for express

* feat: fix type issues and inconsistencies

* feat: add virus total plugin into ip-based mitigation module

* feat: add ratelimiting, add leaky bucket ratelimiter plugin

* feat: enable strict and strictNullChecks in tsconfig

* chore: update the docs

* chore: update package.json commands

* chore: bump package.json version

* chore: revert version bump

* 2.0.0

* fix: re-export plugins

* fix: revert changed version

* 2.0.0-alpha.1
  • Loading branch information
abriginets authored May 12, 2024
1 parent 6aac63d commit dd82d41
Show file tree
Hide file tree
Showing 83 changed files with 11,592 additions and 19,125 deletions.
5 changes: 0 additions & 5 deletions .babelrc

This file was deleted.

Empty file removed .coveralls.yml
Empty file.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

105 changes: 94 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,97 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended'
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'airbnb-base',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:jest/recommended',
'plugin:prettier/recommended',
],
plugins: ['@typescript-eslint', 'jest', 'prettier'],
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
},
env: {
node: true,
es6: true,
jest: true,
},
rules: {
'class-methods-use-this': 'off',
'import/prefer-default-export': 'off',
'eol-last': ['error', 'always'],
'newline-before-return': 'error',
'import/extensions': 0,
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: false,
optionalDependencies: false,
peerDependencies: false,
},
],
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module'
'no-restricted-imports': 'error',
'semi': 'error',
'comma-dangle': 'off',
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
'quotes': 'off',
'@typescript-eslint/quotes': [
'error',
'single',
{
allowTemplateLiterals: true,
},
],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
'arrow-parens': ['error', 'always'],
'indent': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
},
],
'spaced-comment': ['error', 'always'],
'no-multiple-empty-lines': [
'error',
{
max: 2,
maxEOF: 0,
},
],
'import/order': [
'error',
{
'groups': [['external', 'internal', 'builtin'], ['sibling', 'parent'], 'index', 'object'],
'pathGroupsExcludedImportTypes': ['builtin'],
'newlines-between': 'always',
'alphabetize': {
order: 'asc',
caseInsensitive: true,
},
},
],
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.ts', '.jsx', '.tsx'],
},
},
},
overrides: [
{
files: ['playground/**/*.ts'],
rules: {
'import/no-extraneous-dependencies': ['off'],
},
},
rules: {
'@typescript-eslint/member-delimiter-style': ['off'],
'@typescript-eslint/ban-ts-ignore': ['off']
}
};
],
};
44 changes: 0 additions & 44 deletions .github/workflows/build.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/on-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on: [push]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node: [18, 20]

name: Build (node v${{ matrix.node }})
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Install
run: npm install

- name: lint
run: npm run lint

- name: typecheck
run: npx tsc --noEmit
12 changes: 2 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,7 @@ node_modules/
# dotenv environment variables file
.env
.env.test

# VS Code settings
.vscode/
.env.local

# Build directories
server/dist
public/dist

benchmark/webserver.js

# Compiled templates
templates/compiled
dist
11 changes: 11 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
printWidth: 120
tabWidth: 2
useTabs: false
semi: true
singleQuote: true
trailingComma: all
bracketSpacing: true
bracketSameLine: false
arrowParens: always
quoteProps: consistent
endOfLine: lf
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 18.18.0
17 changes: 17 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.formatOnSave": true,
"editor.trimAutoWhitespace": true,
"files.insertFinalNewline": true,
"files.encoding": "utf8",
"typescript.tsdk": "node_modules/typescript/lib",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"typescript.preferences.importModuleSpecifier": "relative",
"prettier.prettierPath": "./node_modules/prettier"
}
Loading

0 comments on commit dd82d41

Please sign in to comment.