Skip to content

Commit

Permalink
chore: reconfigure project
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhr committed Jun 4, 2023
1 parent ac5802f commit 8abfa45
Show file tree
Hide file tree
Showing 35 changed files with 3,506 additions and 2,225 deletions.
11 changes: 8 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
root = true

[*]
indent_style = space
indent_size = 2
indent_style = tab
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = false
insert_final_newline = false
max_line_length = 100

[*.yaml]
indent_style = space
indent_size = 2
130 changes: 64 additions & 66 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,68 +1,66 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"import",
"unused-imports",
"consistent-default-export-name"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"no-fallthrough": "off",
"no-constant-condition": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-ts-comment": "off",
"no-empty-pattern": "off",
"import/no-anonymous-default-export": "error",
"import/newline-after-import": "warn",
"import/order": [
"warn",
{
"alphabetize": { "order": "asc", "caseInsensitive": true },
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object"
],
"newlines-between": "never"
}
],
"unused-imports/no-unused-imports": "warn"
},
"globals": {
"globalThis": false,
"jest": false
},
"overrides": [
{
"rules": {
"import/order": "off"
}
}
]
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"ecmaFeatures": {
"jsx": true
},
"project": "./deno.json",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"import",
"unused-imports",
"consistent-default-export-name",
"prefer-arrow-functions"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"prefer-arrow-functions/prefer-arrow-functions": "warn",
"no-fallthrough": "off",
"no-constant-condition": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/no-unnecessary-condition": "warn",
"no-empty-pattern": "off",
"import/first": "warn",
"import/exports-last": "warn",
"import/no-anonymous-default-export": "warn",
"import/newline-after-import": "warn",
"import/order": [
"warn",
{
"alphabetize": { "order": "asc" },
"groups": [],
"newlines-between": "never"
}
],
"unused-imports/no-unused-imports": "warn",
"consistent-default-export-name/default-export-match-filename": "warn",
"consistent-default-export-name/default-import-match-filename": "warn"
},
"overrides": [
{
"files": ["*.cmd.ts"],
"rules": {
"import/no-anonymous-default-export": "off"
}
}
]
}
4 changes: 4 additions & 0 deletions .githooks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*

!.git*
!pre-commit
10 changes: 10 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

pnpm lint-staged || exit 1

for FILE in `git diff --cached --name-only`; do
if [ -f $FILE ]; then
perl -pi -e 'chomp if eof' $FILE
git add $FILE
fi
done
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ node_modules
!.git*
!.*rc
!.eslint
!.husky
!.editorconfig
!.vscode
!.tool-versions

dist
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

17 changes: 6 additions & 11 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
{
"*.(ts|tsx|js|jsx)": [
"eslint . --ext .js,.ts,.jsx,.tsx --rulesdir .eslint/rules --fix",
"prettier --write",
"eclint fix"
],
"*.(json|yml|md|mdx)": ["prettier --write", "eclint fix"],
".env*": ["eclint fix"],
".!(env)rc": ["prettier --write", "eclint fix"],
".*ignore": ["eclint fix"],
".editorconfig": ["eclint fix"],
".husky/**/*": ["eclint fix"]
"*.ts": ["eslint --fix", "prettier --write", "eclint fix"],
"*.(json|md|yaml)": ["prettier --write", "eclint fix"],
".env*": ["eclint fix"],
".!(env)rc": ["prettier --write", "eclint fix"],
".*ignore": ["eclint fix"],
".editorconfig": ["eclint fix"]
}
24 changes: 10 additions & 14 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
"semi": false,
"singleQuote": false,
"trailingComma": "all",
"arrowParens": "avoid",
"overrides": [
{
"files": ".*rc",
"options": { "parser": "json" }
},
{
"files": "*.md",
"options": { "parser": "markdown-nocjsp" }
}
]
"semi": false,
"trailingComma": "all",
"arrowParens": "avoid",
"proseWrap": "never",
"overrides": [
{
"files": ".*rc",
"options": { "parser": "json" }
}
]
}
3 changes: 3 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
deno 1.33.3
nodejs 20.1.0
pnpm 8.5.0
28 changes: 11 additions & 17 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": { "source.fixAll.eslint": true },
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.removeFinalNewlines": true,
"files.associations": {
"entry": "typescript",
".*rc": "json",
".eslintrc": "jsonc"
},
"deno.enable": true,
"deno.unstable": true,
"deno.importMap": "tests/import-map.json",
"typescript.tsdk": "node_modules/typescript/lib",
"deno.suggest.imports.hosts": {
"https://deno.land": false,
"https://esm.sh": false
}
"editor.formatOnSave": true,
"editor.codeActionsOnSave": { "source.fixAll.eslint": true },
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.removeFinalNewlines": true,
"files.associations": {
".*rc": "json",
".eslintrc": "jsonc"
},
"typescript.tsdk": "node_modules/typescript/lib",
"deno.enable": true,
"deno.lint": false
}
Loading

0 comments on commit 8abfa45

Please sign in to comment.