Skip to content

Commit

Permalink
final clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
morewings committed Nov 30, 2023
1 parent aab4fdb commit 68e7639
Show file tree
Hide file tree
Showing 8 changed files with 294 additions and 73 deletions.
19 changes: 14 additions & 5 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
parserOptions: {
ecmaVersion: 'latest',
tsconfigRootDir: __dirname,
sourceType: 'module',
project: './tsconfig.linter.json',
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:ssr-friendly/recommended',
'plugin:storybook/recommended',
Expand Down Expand Up @@ -45,11 +54,7 @@ module.exports = {
],
pathGroups: [
{
pattern: 'lib/**',
group: 'internal',
},
{
pattern: 'environment/**',
pattern: '@/**',
group: 'internal',
},
],
Expand Down Expand Up @@ -79,6 +84,10 @@ module.exports = {
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/consistent-type-definitions': [
'error',
'type'
]
},
overrides: [
/* Allow require imports for internal scripts */
Expand Down
31 changes: 2 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
# React + TypeScript + Vite
# React Library Template

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default {
// other rules...
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
}
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
With React Template Repository, you can focus on developing your React components and libraries without worrying about the configuration and setup.
32 changes: 29 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"private": false,
"version": "0.1.0",
"type": "module",
"files": ["dist"],
"files": [
"dist",
"README.md"
],
"main": "./dist/index.umd.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -14,9 +17,27 @@
"require": "./dist/index.umd.cjs"
}
},
"keywords": [
"react",
"template",
"react-testing-library",
"testing-library",
"eslint",
"npm",
"rollup",
"stylelint",
"library",
"package",
"vite",
"css-modules",
"typescript"
],
"description": "Missing React, typescript NPM library creation template",
"scripts": {
"dev": "vite",
"build": "vite build",
"clean:lib": "rm -rf dist",
"build:lib": "vite build",
"build": "run-s clean:lib build:lib",
"lint:code": "eslint . --ext ts,tsx --report-unused-disable-directives",
"fix:code": "run-s 'lint:code --fix'",
"lint:types": "tsc --pretty --noEmit",
Expand All @@ -33,7 +54,11 @@
"react-dom": ">=18.2.0"
},
"dependencies": {
"lodash": "^4.17.21"
"-": "^0.0.1",
"D": "^1.0.0",
"autoprefixer": "^10.4.16",
"lodash": "^4.17.21",
"postcss": "^8.4.31"
},
"devDependencies": {
"@storybook/addon-essentials": "7.6.1",
Expand All @@ -59,6 +84,7 @@
"eslint-config-prettier": "8.10.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-prettier": "5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.4",
"eslint-plugin-ssr-friendly": "1.3.0",
Expand Down
Loading

0 comments on commit 68e7639

Please sign in to comment.