Skip to content

Commit 501ce1a

Browse files
authored
feat: Convert to TypeScript, functional components and upgrade to ESLint 9 (#106)
- Support React 19 - Use React functional components - Support TypeScript natively (re-written using TS) - Upgrade to ESLint 9
1 parent 3b327a8 commit 501ce1a

29 files changed

+8686
-16594
lines changed

.babelrc

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

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ charset = utf-8
99
trim_trailing_whitespace = true
1010
insert_final_newline = true
1111

12-
[*.js]
12+
[*.{js,ts,tsx}]
1313
quote_type = single
1414
spaces_around_operators = true
1515

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ node_modules
1515
# Build
1616

1717
dist
18+
19+
public

.husky/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
npm run validate:commit

.husky/pre-push

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
npm run validate:push

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

.storybook/main.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { StorybookConfig } from '@storybook/react-webpack5';
2+
3+
const config: StorybookConfig = {
4+
addons: [
5+
'@storybook/addon-docs',
6+
'@storybook/addon-links',
7+
'@storybook/addon-essentials',
8+
'@storybook/addon-webpack5-compiler-swc',
9+
],
10+
docs: {
11+
autodocs: true,
12+
},
13+
framework: {
14+
name: '@storybook/react-webpack5',
15+
options: {},
16+
},
17+
stories: ['../stories/**/*.stories.@(js|jsx|ts|tsx)'],
18+
};
19+
export default config;

eslint.config.mjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import eslint from "@eslint/js";
2+
import tseslint from "typescript-eslint";
3+
import reactPlugin from "eslint-plugin-react";
4+
import globals from "globals";
5+
import reactHooks from "eslint-plugin-react-hooks";
6+
import perfectionist from "eslint-plugin-perfectionist";
7+
import path from "path";
8+
import { fileURLToPath } from "url";
9+
10+
export default tseslint.config(
11+
eslint.configs.recommended,
12+
...tseslint.configs.recommended,
13+
perfectionist.configs["recommended-natural"],
14+
{
15+
ignores: ["dist", "eslint.config.mjs"],
16+
},
17+
{
18+
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
19+
...reactPlugin.configs.flat.recommended,
20+
...reactHooks.configs["recommended-latest"],
21+
languageOptions: {
22+
...reactPlugin.configs.flat.languageOptions,
23+
globals: {
24+
...globals.browser,
25+
},
26+
parserOptions: {
27+
project: ["tsconfig.eslint.json"],
28+
tsconfigRootDir: path.dirname(fileURLToPath(import.meta.url)),
29+
},
30+
},
31+
}
32+
);

lint-staged.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
"*": (filenames) => [`eslint ${filenames.join(" ")} --fix`, "git add"],
3+
};

0 commit comments

Comments
 (0)