Skip to content

Commit f73a55e

Browse files
committed
chore: add config of husky and eslint
1 parent b9ee84d commit f73a55e

File tree

8 files changed

+1586
-15
lines changed

8 files changed

+1586
-15
lines changed

Diff for: .eslintrc.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint", "prettier"],
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/recommended",
8+
"plugin:prettier/recommended"
9+
],
10+
"env": {
11+
"browser": true,
12+
"es2021": true,
13+
"node": true
14+
},
15+
"rules": {
16+
"prettier/prettier": "error",
17+
"@typescript-eslint/explicit-module-boundary-types": "off",
18+
"@typescript-eslint/no-explicit-any": "warn"
19+
}
20+
}

Diff for: .husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit

Diff for: .husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

Diff for: .prettierrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"printWidth": 100,
6+
"trailingComma": "es5",
7+
"bracketSpacing": true,
8+
"arrowParens": "avoid"
9+
}

Diff for: commitlint.config.cjs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
'type-enum': [
5+
2,
6+
'always',
7+
[
8+
'feat',
9+
'fix',
10+
'docs',
11+
'style',
12+
'refactor',
13+
'perf',
14+
'test',
15+
'chore',
16+
'revert',
17+
'ci',
18+
'build'
19+
]
20+
]
21+
}
22+
};

Diff for: package.json

+26-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"dev:core": "cd packages/core && pnpm dev",
88
"build:core": "cd packages/core && pnpm build",
99
"lint:core": "cd packages/core && pnpm lint",
10-
"dev:example": "cd packages/examples && pnpm dev"
10+
"dev:example": "cd packages/examples && pnpm dev",
11+
"prepare": "husky install",
12+
"lint": "pnpm -r run lint",
13+
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\""
1114
},
1215
"keywords": [
1316
"react",
@@ -16,5 +19,26 @@
1619
"typescript"
1720
],
1821
"author": "",
19-
"license": "MIT"
22+
"license": "MIT",
23+
"devDependencies": {
24+
"@commitlint/cli": "^18.0.0",
25+
"@commitlint/config-conventional": "^18.0.0",
26+
"@typescript-eslint/eslint-plugin": "^5.0.0",
27+
"@typescript-eslint/parser": "^5.0.0",
28+
"eslint": "^8.0.0",
29+
"eslint-config-prettier": "^9.0.0",
30+
"eslint-plugin-prettier": "^5.0.0",
31+
"husky": "^8.0.0",
32+
"lint-staged": "^15.0.0",
33+
"prettier": "^3.0.0"
34+
},
35+
"lint-staged": {
36+
"*.{ts,tsx,js,jsx}": [
37+
"prettier --write",
38+
"eslint --fix"
39+
],
40+
"*.{json,md}": [
41+
"prettier --write"
42+
]
43+
}
2044
}

Diff for: packages/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@atom-universe/use-web-worker",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "React hooks for Web Workers with TypeScript support",
55
"type": "module",
66
"main": "./dist/index.cjs",

0 commit comments

Comments
 (0)