Skip to content

Commit b5824f3

Browse files
committed
feat: setup project
1 parent 6411f4c commit b5824f3

11 files changed

+276
-0
lines changed

.eslintrc.cjs

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/**
2+
* This is intended to be a basic starting point for linting in your app.
3+
* It relies on recommended configs out of the box for simplicity, but you can
4+
* and should modify this configuration to best suit your team's needs.
5+
*/
6+
7+
/** @type {import('eslint').Linter.Config} */
8+
module.exports = {
9+
parser: '@typescript-eslint/parser',
10+
parserOptions: {
11+
tsconfigRootDir: __dirname,
12+
sourceType: 'module'
13+
},
14+
plugins: ['@typescript-eslint/eslint-plugin'],
15+
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
16+
root: true,
17+
env: {
18+
node: true,
19+
jest: true
20+
},
21+
ignorePatterns: ['.eslintrc.js'],
22+
overrides: [
23+
{
24+
files: ['**/*.{js,jsx,ts,tsx}'],
25+
extends: ['plugin:react-hooks/recommended']
26+
},
27+
28+
{
29+
files: ['**/*.{ts,tsx}'],
30+
plugins: ['@typescript-eslint', 'import'],
31+
parser: '@typescript-eslint/parser',
32+
settings: {
33+
'import/internal-regex': '^~/',
34+
'import/resolver': {
35+
node: {
36+
extensions: ['.ts', '.tsx']
37+
},
38+
typescript: {
39+
alwaysTryTypes: true
40+
}
41+
}
42+
},
43+
extends: ['plugin:@typescript-eslint/recommended', 'plugin:import/recommended', 'plugin:import/typescript'],
44+
rules: {
45+
'@typescript-eslint/interface-name-prefix': 'off',
46+
'@typescript-eslint/explicit-function-return-type': 'off',
47+
'@typescript-eslint/explicit-module-boundary-types': 'off',
48+
'@typescript-eslint/no-explicit-any': 'off',
49+
'no-alert': ['warn'],
50+
'no-debugger': ['warn'],
51+
'no-else-return': 'error',
52+
'no-multiple-empty-lines': 'off',
53+
'require-await': 'error',
54+
'react/prop-types': 'off',
55+
'no-unused-vars': [
56+
'warn',
57+
{
58+
argsIgnorePattern: '^_',
59+
varsIgnorePattern: '^_',
60+
caughtErrorsIgnorePattern: '^_'
61+
}
62+
],
63+
semi: 'off'
64+
}
65+
},
66+
67+
{
68+
files: ['.eslintrc.cjs'],
69+
env: {
70+
node: true
71+
}
72+
}
73+
]
74+
}

.gitignore

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
node_modules
5+
6+
# build
7+
dist
8+
9+
# Logs
10+
logs
11+
*.log
12+
npm-debug.log*
13+
pnpm-debug.log*
14+
yarn-debug.log*
15+
yarn-error.log*
16+
lerna-debug.log*
17+
18+
# OS
19+
.DS_Store
20+
21+
# Tests
22+
coverage
23+
24+
# IDEs and editors
25+
.idea
26+
.project
27+
.classpath
28+
.c9/
29+
*.launch
30+
.settings/
31+
*.sublime-workspace
32+
33+
# IDE - VSCode
34+
.vscode/*
35+
!.vscode/settings.json
36+
!.vscode/tasks.json
37+
!.vscode/launch.json
38+
!.vscode/extensions.json
39+
40+
.env
41+
pnpm-lock.yaml
42+
yarn.lock
43+
package-lock.json
44+
bun.lockb
45+
46+
packages/cli

.husky/pre-commit

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pnpm lint || npm run lint ||
2+
(
3+
echo '🔨❌ You have a problem in your code. Check linter 🔨❌
4+
Run pnpm lint or pnpm format, add changes and try commit again.';
5+
false;
6+
)

.husky/pre-push

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(cd packages/react && (pnpm build || npm run build)) ||
2+
(
3+
echo '🔨❌ You have a problem in your code. Check linter 🔨❌
4+
Run pnpm lint or pnpm format, add changes and try commit again.';
5+
false;
6+
)

.prettierignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cache
2+
.cache
3+
package.json
4+
package-lock.json
5+
public
6+
CHANGELOG.md
7+
.yarn
8+
dist
9+
node_modules
10+
.next
11+
build
12+
.contentlayer

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": true,
3+
"arrowParens": "avoid",
4+
"printWidth": 120,
5+
"semi": false,
6+
"trailingComma": "none"
7+
}

package.json

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "@euxzy/hooks",
3+
"version": "0.0.1",
4+
"private": true,
5+
"description": "Custom Hooks",
6+
"type": "module",
7+
"author": {
8+
"name": "euxzy",
9+
"url": "https://github.com/euxzy"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/euxzy/hooks.git"
14+
},
15+
"workspaces": [
16+
"packages/*"
17+
],
18+
"scripts": {
19+
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
20+
"format": "prettier --write \"packages/**/*.{js,ts,jsx,tsx}\"",
21+
"prepare": "husky"
22+
},
23+
"keywords": [
24+
"hooks",
25+
"react",
26+
"customhooks",
27+
"usehooks"
28+
],
29+
"license": "MIT",
30+
"bugs": {
31+
"url": "https://github.com/euxzy/hooks/issues"
32+
},
33+
"homepage": "https://github.com/euxzy/hooks#readme",
34+
"engines": {
35+
"node": ">=18.0.0"
36+
},
37+
"devDependencies": {
38+
"@types/eslint": "^9.6.1",
39+
"@types/node": "^22.5.4",
40+
"@typescript-eslint/eslint-plugin": "^6.21.0",
41+
"@typescript-eslint/parser": "^6.21.0",
42+
"eslint": "^8.57.0",
43+
"eslint-config-prettier": "^9.1.0",
44+
"eslint-import-resolver-typescript": "^3.6.1",
45+
"eslint-plugin-import": "^2.29.1",
46+
"eslint-plugin-prettier": "^5.1.3",
47+
"eslint-plugin-react-hooks": "^4.6.2",
48+
"husky": "^9.1.5",
49+
"typescript": "^5.5.4",
50+
"typescript-eslint": "^8.4.0"
51+
}
52+
}

packages/react/package.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "@euxzy/hooks-react",
3+
"version": "0.0.1",
4+
"description": "Custom hooks for React",
5+
"main": "./dist/index.js",
6+
"type": "module",
7+
"author": {
8+
"name": "euxzy",
9+
"url": "https://github.com/euxzy"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/euxzy/hooks.git",
14+
"directory": "packages/react"
15+
},
16+
"scripts": {
17+
"test": "echo \"Error: no test specified\" && exit 1",
18+
"clean": "rm -rf dist",
19+
"build": "npm run clean && npx tsc"
20+
},
21+
"keywords": [
22+
"hooks",
23+
"react",
24+
"usehooks",
25+
"customhooks"
26+
],
27+
"license": "MIT",
28+
"bugs": {
29+
"url": "https://github.com/euxzy/hooks/issues"
30+
},
31+
"homepage": "https://github.com/euxzy/hooks#readme",
32+
"devDependencies": {
33+
"@types/react": "^18.3.5",
34+
"react": "^18.3.1"
35+
},
36+
"peerDependencies": {
37+
"react": "^17.0.0 || ^18.0.0"
38+
}
39+
}

packages/react/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './hooks'

packages/react/tsconfig.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"extends": "../../tsconfig.json",
4+
"compilerOptions": {
5+
"outDir": "./dist",
6+
"jsx": "react",
7+
"isolatedModules": false,
8+
"resolveJsonModule": true,
9+
"paths": {
10+
"~/*": ["./src/*"]
11+
}
12+
},
13+
"exclude": ["node_modules", "dist"],
14+
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
15+
}

tsconfig.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"compilerOptions": {
4+
"target": "ESNext",
5+
"module": "ESNext",
6+
"strict": true,
7+
"esModuleInterop": true,
8+
"forceConsistentCasingInFileNames": true,
9+
"skipLibCheck": true,
10+
"noImplicitAny": true,
11+
"allowJs": true,
12+
"declaration": true,
13+
"sourceMap": true,
14+
"isolatedModules": true,
15+
"moduleResolution": "Node"
16+
},
17+
"exclude": ["node_modules", "packages/**/*/dist"]
18+
}

0 commit comments

Comments
 (0)