Skip to content

Commit 1026ea3

Browse files
committed
feat(core): Update project to use pnpm, add playground for testing, and enhance ESLint configuration
1 parent 4a1f6db commit 1026ea3

21 files changed

Lines changed: 3541 additions & 1036 deletions

.husky/commit-msg

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
4-
yarn commitlint --edit ${1}
1+
pnpm commitlint --edit ${1}

.husky/pre-commit

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
4-
yarn lint-staged
1+
pnpm lint-staged

commitlint.config.cjs

Lines changed: 0 additions & 3 deletions
This file was deleted.

commitlint.config.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
export default {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
// Scope rules
5+
'scope-empty': [2, 'never'],
6+
'scope-case': [2, 'always', 'kebab-case'],
7+
8+
// Header rules - more flexible
9+
'header-case': [0],
10+
'header-max-length': [2, 'always', 150],
11+
'header-min-length': [1, 'always', 3],
12+
'header-full-stop': [2, 'never', '.'],
13+
14+
// subject rules - more flexible
15+
'subject-case': [0],
16+
'subject-empty': [2, 'never'],
17+
'subject-max-length': [2, 'always', 150],
18+
'subject-min-length': [1, 'always', 3],
19+
'subject-full-stop': [2, 'never', '.'],
20+
21+
// Body rules
22+
'body-max-line-length': [0],
23+
'body-leading-blank': [2, 'always'],
24+
25+
// Type rules
26+
'type-empty': [2, 'never'],
27+
'type-case': [2, 'always', 'lower-case'],
28+
'type-enum': [
29+
2,
30+
'always',
31+
[
32+
'feat', // New feature
33+
'fix', // Bug fix
34+
'docs', // Documentation
35+
'style', // Code style (formatting, etc)
36+
'refactor', // Code refactoring
37+
'perf', // Performance improvements
38+
'test', // Adding or updating tests
39+
'chore', // Maintenance tasks
40+
'ci', // CI/CD changes
41+
'build', // Build system changes
42+
'revert', // Revert previous commit
43+
'wip', // Work in progress
44+
'hotfix', // Critical fixes
45+
'test' // Tests
46+
]
47+
],
48+
49+
// Footer rules - flexible
50+
'footer-max-line-length': [0]
51+
}
52+
};

eslint.config.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@ export default [
1010
{
1111
ignores: [
1212
'dist/**',
13+
'playground/*/**',
14+
'**/*.d.ts',
1315
'prettier.config.cjs',
1416
'lint-staged.config.cjs',
1517
'commitlint.config.cjs'
16-
]
18+
],
19+
linterOptions: { reportUnusedDisableDirectives: 'error' }
1720
},
1821
{
1922
files: ['**/*.{ts,tsx}'],
23+
ignores: ['dist/**', 'playground/*/**', '**/*.d.ts'],
2024
languageOptions: {
2125
parser: tsParser,
2226
parserOptions: {
23-
ecmaFeatures: {
24-
jsx: true,
25-
modules: true
26-
},
27+
ecmaFeatures: { jsx: true, modules: true },
2728
ecmaVersion: 'latest',
2829
sourceType: 'module',
2930
tsconfigRootDir: __dirname,
@@ -48,10 +49,7 @@ export default [
4849
languageOptions: {
4950
parser: tsParser,
5051
parserOptions: {
51-
ecmaFeatures: {
52-
jsx: true,
53-
modules: true
54-
},
52+
ecmaFeatures: { jsx: true, modules: true },
5553
ecmaVersion: 'latest',
5654
sourceType: 'module'
5755
}

package.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,19 @@
7878
"format": "prettier --write \"**/*.+(js|jsx|json|yml|yaml|css|ts|tsx|md|gql|graphql|mdx)\"",
7979
"format:check": "prettier -l \"**/*.+(js|jsx|json|yml|yaml|css|ts|tsx|md|gql|graphql|mdx)\"",
8080
"build": "vite build",
81+
"build:playground": "pnpm -C playground build",
8182
"generate": "vite build",
82-
"lint": "npx eslint --cache --cache-location ./node_modules/.cache/.eslintcache --max-warnings=0 .",
83-
"lint:fix": "npx eslint --fix .",
83+
"lint:main": "eslint --cache --cache-location ./node_modules/.cache/.eslintcache --max-warnings=0 \"src/**/*.{js,jsx,ts,tsx}\" eslint.config.js vite.config.ts --no-warn-ignored",
84+
"lint:playground": "pnpm -C playground lint",
85+
"lint": "pnpm lint:main && pnpm lint:playground",
86+
"lint:fix:main": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\" eslint.config.js vite.config.ts --no-warn-ignored",
87+
"lint:fix:playground": "pnpm -C playground eslint --fix . --no-warn-ignored",
88+
"prepare": "if [ \"$NODE_ENV\" != \"production\" ]; then husky; fi",
8489
"setup": "pnpm install && husky",
8590
"release": "semantic-release",
86-
"typecheck": "tsc -b .",
91+
"typecheck:main": "tsc -b .",
92+
"typecheck:playground": "pnpm -C playground exec tsc -p tsconfig.json",
93+
"typecheck": "pnpm typecheck:main && pnpm typecheck:playground",
8794
"update:deps": "rm -rf node_modules pnpm-lock.yaml && npx npm-check-updates -u && pnpm install"
8895
},
8996
"type": "module",

playground/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Playground
2+
3+
This folder is a small Vite app that installs the package via a local file
4+
dependency so you can test changes without publishing.
5+
6+
## Setup
7+
8+
From the repo root:
9+
10+
```bash
11+
pnpm install
12+
pnpm build
13+
```
14+
15+
Then:
16+
17+
```bash
18+
cd playground
19+
pnpm install
20+
pnpm dev
21+
```

playground/eslint.config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import tsParser from '@typescript-eslint/parser';
2+
import tsPlugin from '@typescript-eslint/eslint-plugin';
3+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
4+
5+
export default [
6+
{
7+
ignores: ['dist/**', 'node_modules/**']
8+
},
9+
{
10+
files: ['**/*.{ts,tsx}'],
11+
ignores: ['vite.config.ts'],
12+
languageOptions: {
13+
parser: tsParser,
14+
parserOptions: {
15+
ecmaFeatures: {
16+
jsx: true,
17+
modules: true
18+
},
19+
ecmaVersion: 'latest',
20+
sourceType: 'module',
21+
project: ['./tsconfig.json']
22+
}
23+
},
24+
plugins: {
25+
'@typescript-eslint': tsPlugin,
26+
'react-hooks': reactHooksPlugin
27+
},
28+
rules: {
29+
'linebreak-style': 'off',
30+
'@typescript-eslint/no-explicit-any': 'warn',
31+
'react-hooks/rules-of-hooks': 'error',
32+
'react-hooks/exhaustive-deps': 'warn',
33+
'object-shorthand': 'error',
34+
'no-console': ['warn', { allow: ['warn', 'error', 'info'] }]
35+
}
36+
}
37+
];

playground/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>React Scroll Direction Playground</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="/src/main.tsx"></script>
11+
</body>
12+
</html>

playground/package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "react-scroll-direction-playground",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"dev": "vite --open",
7+
"build": "vite build",
8+
"preview": "vite preview",
9+
"lint": "eslint --cache --cache-location ./node_modules/.cache/.eslintcache --max-warnings=0 . --no-warn-ignored"
10+
},
11+
"dependencies": {
12+
"@smakss/react-scroll-direction": "workspace:*",
13+
"react": "^19.2.4",
14+
"react-dom": "^19.2.4"
15+
},
16+
"devDependencies": {
17+
"@types/react": "^19.2.10",
18+
"@types/react-dom": "^19.2.3",
19+
"@vitejs/plugin-react": "^4.4.1",
20+
"typescript": "^5.9.3",
21+
"vite": "^6.4.1"
22+
}
23+
}

0 commit comments

Comments
 (0)