Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
  • Loading branch information
yiiqii committed Aug 30, 2024
1 parent 2998524 commit 5e664d5
Show file tree
Hide file tree
Showing 75 changed files with 10,316 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120
159 changes: 159 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["**/tsconfig.json"],
},
env: {
browser: true,
node: true,
jest: true,
},
ignorePatterns: [
'**/{node_modules,libs}',
'*.js',
'*.d.ts',
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:promise/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:compat/recommended",
],
plugins: [
"@typescript-eslint",
"compat",
],
rules: {
"arrow-parens": ["error", "as-needed"],
"array-bracket-spacing": ["error", "never"],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"comma-dangle": ["error", "always-multiline"],
"curly": "error",
"generator-star-spacing": ["error", {
"before": false,
"after": true,
"anonymous": "neither",
"method": "neither"
}],
"new-parens": "error",
// TODO:: will be opened
"spaced-comment": "off",
"no-multi-spaces": [
"error",
{
"ignoreEOLComments": true
}
],
"no-console": ["error", { "allow": ["info", "warn", "error", "debug", "trace"] }],
"no-inner-declarations": "error",
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 1 }],
"no-trailing-spaces": "error",
"no-void": ["error", { "allowAsStatement": true }],
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "*", "next": ["return", "break"] },
{ "blankLine": "never", "prev": "*", "next": ["case", "default"] },
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] }
],
"promise/always-return": "off",
"promise/catch-or-return": "off",
"prefer-rest-params": "off",
"semi": ["error", "always"],
"space-in-parens": ["error", "never"],
"@typescript-eslint/comma-spacing": "error",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ "vars": "all", "varsIgnorePattern": "^_", "args": "none", "caughtErrors": "all", "caughtErrorsIgnorePattern": "^ignore" }
],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": ["error", { "types": { "{}": false, "Function": false, "Object": false } }],
"@typescript-eslint/indent": ["error", 2, {
"SwitchCase": 1,
"ignoredNodes": [
`ClassBody.body > PropertyDefinition[decorators.length > 0] > .key`,
],
}],
"@typescript-eslint/keyword-spacing": "error",
// TODO:: will be opened
"@typescript-eslint/no-var-requires": "off",
// TODO:: will be opened
"@typescript-eslint/no-non-null-assertion": "off",
// TODO:: will be opened
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unnecessary-type-arguments": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unnecessary-type-constraint": "error",
"@typescript-eslint/no-redundant-type-constituents": "warn",
// TODO:: will be opened
"@typescript-eslint/no-unsafe-return": "off",
// TODO:: will be opened
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/object-curly-spacing": ["error", "always"],
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-reduce-type-parameter": "error",
"@typescript-eslint/prefer-ts-expect-error": "error",
"@typescript-eslint/return-await": "error",
// TODO:: will be opened
"@typescript-eslint/restrict-plus-operands": "off",
// TODO:: will be opened
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/space-infix-ops": ["error", { "int32Hint": false }],
// TODO:: will be "error"
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/no-floating-promises": ["error", { "ignoreVoid": true, "ignoreIIFE": true }],
"@typescript-eslint/quotes": ["error", "single"],
// TODO:: will be opened
"@typescript-eslint/require-await": "off",
"@typescript-eslint/space-before-blocks": "error",
"@typescript-eslint/space-before-function-paren": ["error", "always"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "off",
// TODO:: will be opened
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/semi": "error",
// TODO:: will be opened
"@typescript-eslint/member-delimiter-style": ["error", {
"multiline": {
"delimiter": "comma",
"requireLast": true
},
"singleline": {
"delimiter": "comma",
"requireLast": false
}
}],
"@typescript-eslint/no-unsafe-enum-comparison": "warn",
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/no-duplicate-enum-values": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
// TODO:: will be opened
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/consistent-type-imports": [
"error",
{
"prefer": "type-imports",
"disallowTypeAnnotations": false,
},
],
"compat/compat": "error",
},
overrides: [
{
"files": ["**/test/**/*.ts", "**/demo/**/*.ts"],
"rules": {
"compat/compat": "off",
"@typescript-eslint/no-unused-vars": "off"
}
}
]
};
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
.DS_Store
dist
lib
*.local
*.tgz
.eslintcache
*.tsbuildinfo
.vscode
.idea
.history
.pnpm-debug.log
temp
api
www
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
PATH=$PATH:/usr/local/bin:/usr/local/sbin
npx commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
PATH=$PATH:/usr/local/bin:/usr/local/sbin
npx lint-staged
6 changes: 6 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"src/**/*.ts": [
"eslint --cache --fix",
"sh -c 'tsc -b tsconfig.check.json'"
]
}
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
engine-strict=true
enable-pre-post-scripts=true
Loading

0 comments on commit 5e664d5

Please sign in to comment.