@harperfast/template-react-ts-studio 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/eslint.config.js +23 -0
- package/package.json +6 -2
- package/src/App.tsx +2 -1
- package/src/counter.ts +7 -0
- package/test/counter.test.ts +15 -0
package/eslint.config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
js.configs.recommended,
|
|
6
|
+
{
|
|
7
|
+
languageOptions: {
|
|
8
|
+
globals: {
|
|
9
|
+
...globals.browser,
|
|
10
|
+
...globals.node,
|
|
11
|
+
},
|
|
12
|
+
ecmaVersion: 'latest',
|
|
13
|
+
sourceType: 'module',
|
|
14
|
+
},
|
|
15
|
+
rules: {
|
|
16
|
+
'no-unused-vars': 'warn',
|
|
17
|
+
'no-console': 'off',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
ignores: ['node_modules/'],
|
|
22
|
+
},
|
|
23
|
+
];
|
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@harperfast/template-react-ts-studio",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": "github:HarperFast/create-harper",
|
|
6
6
|
"scripts": {},
|
|
7
7
|
"devDependencies": {
|
|
8
|
+
"@eslint/js": "^10.0.1",
|
|
8
9
|
"@harperfast/vite-plugin": "^0.0.1",
|
|
9
10
|
"@types/node": "^24.10.1",
|
|
10
11
|
"@types/react": "^19.2.10",
|
|
11
12
|
"@types/react-dom": "^19.2.3",
|
|
12
13
|
"@vitejs/plugin-react": "^5.1.2",
|
|
13
14
|
"dotenv-cli": "^11.0.0",
|
|
14
|
-
"
|
|
15
|
+
"eslint": "^10.0.2",
|
|
16
|
+
"globals": "^17.4.0",
|
|
17
|
+
"harperdb": "^4.7.20",
|
|
18
|
+
"prettier": "^3.8.1",
|
|
15
19
|
"react": "^19.2.4",
|
|
16
20
|
"react-dom": "^19.2.4",
|
|
17
21
|
"typescript": "~5.9.3",
|
package/src/App.tsx
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import reactLogo from '/react.svg';
|
|
2
2
|
import typescriptLogo from '/typescript.svg';
|
|
3
3
|
import viteLogo from '/vite.svg';
|
|
4
|
+
import { increment } from '@/counter.ts';
|
|
4
5
|
import { useCallback, useState } from 'react';
|
|
5
6
|
|
|
6
7
|
export function App() {
|
|
7
8
|
const [counter, setCounter] = useState(0);
|
|
8
9
|
const countUp = useCallback(() => {
|
|
9
|
-
setCounter(counter => counter
|
|
10
|
+
setCounter((counter: number) => increment(counter));
|
|
10
11
|
}, []);
|
|
11
12
|
|
|
12
13
|
return (
|
package/src/counter.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { strictEqual } from 'node:assert/strict';
|
|
2
|
+
import { test } from 'node:test';
|
|
3
|
+
import { decrement, increment } from '../src/counter.ts';
|
|
4
|
+
|
|
5
|
+
test('increment function', () => {
|
|
6
|
+
strictEqual(increment(0), 1);
|
|
7
|
+
strictEqual(increment(1), 2);
|
|
8
|
+
strictEqual(increment(-1), 0);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('decrement function', () => {
|
|
12
|
+
strictEqual(decrement(0), -1);
|
|
13
|
+
strictEqual(decrement(1), 0);
|
|
14
|
+
strictEqual(decrement(-1), -2);
|
|
15
|
+
});
|