diff --git a/.gitignore b/.gitignore index 1487efb..329516b 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ project.xcworkspace # node.js # node_modules/ -npm-debug.log \ No newline at end of file +npm-debug.log + +# Build +lib/ \ No newline at end of file diff --git a/.lintstagedrc b/.lintstagedrc new file mode 100644 index 0000000..b3d382e --- /dev/null +++ b/.lintstagedrc @@ -0,0 +1,8 @@ +{ + "*.{js,jsx,ts,tsx}": [ + "yarn eslint:fix" + ], + "*.{json,css,md}": [ + "prettier --write" + ] +} \ No newline at end of file diff --git a/example/.env b/example/.env deleted file mode 100644 index 7d910f1..0000000 --- a/example/.env +++ /dev/null @@ -1 +0,0 @@ -SKIP_PREFLIGHT_CHECK=true \ No newline at end of file diff --git a/example/.eslintcache b/example/.eslintcache new file mode 100644 index 0000000..20b8a70 --- /dev/null +++ b/example/.eslintcache @@ -0,0 +1 @@ +[{"/Users/pdgp/Development/GitHub/react-use-scrollspy/example/src/reportWebVitals.ts":"1","/Users/pdgp/Development/GitHub/react-use-scrollspy/example/src/App.tsx":"2"},{"size":425,"mtime":1611412949078,"results":"3","hashOfConfig":"4"},{"size":1846,"mtime":1611413190149,"results":"5","hashOfConfig":"4"},{"filePath":"6","messages":"7","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1q0a5qv",{"filePath":"8","messages":"9","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/pdgp/Development/GitHub/react-use-scrollspy/example/src/reportWebVitals.ts",[],"/Users/pdgp/Development/GitHub/react-use-scrollspy/example/src/App.tsx",[]] \ No newline at end of file diff --git a/example/README.md b/example/README.md index 9d9614c..b58e0af 100644 --- a/example/README.md +++ b/example/README.md @@ -1,39 +1,41 @@ +# Getting Started with Create React App + This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: -### `npm start` +### `yarn start` -Runs the app in the development mode.
+Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view it in the browser. -The page will reload if you make edits.
+The page will reload if you make edits.\ You will also see any lint errors in the console. -### `npm test` +### `yarn test` -Launches the test runner in the interactive watch mode.
+Launches the test runner in the interactive watch mode.\ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. -### `npm run build` +### `yarn build` -Builds the app for production to the `build` folder.
+Builds the app for production to the `build` folder.\ It correctly bundles React in production mode and optimizes the build for the best performance. -The build is minified and the filenames include the hashes.
+The build is minified and the filenames include the hashes.\ Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. -### `npm run eject` +### `yarn eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. -Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. @@ -42,27 +44,3 @@ You don’t have to ever use `eject`. The curated feature set is suitable for sm You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). - -### Code Splitting - -This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting - -### Analyzing the Bundle Size - -This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size - -### Making a Progressive Web App - -This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app - -### Advanced Configuration - -This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration - -### Deployment - -This section has moved here: https://facebook.github.io/create-react-app/docs/deployment - -### `npm run build` fails to minify - -This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify diff --git a/example/package.json b/example/package.json index eb5ff6e..da1b184 100644 --- a/example/package.json +++ b/example/package.json @@ -1,13 +1,20 @@ { - "name": "docs", + "name": "example", "version": "0.1.0", - "homepage": "https://purii.github.io/react-use-scrollspy", "private": true, "dependencies": { + "@testing-library/jest-dom": "^5.11.4", + "@testing-library/react": "^11.1.0", + "@testing-library/user-event": "^12.1.10", + "@types/jest": "^26.0.15", + "@types/node": "^12.0.0", + "@types/react": "^16.9.53", + "@types/react-dom": "^16.9.8", "react": "^17.0.1", "react-dom": "^17.0.1", "react-scripts": "4.0.1", - "react-use-scrollspy": "^2.0.1" + "typescript": "^4.0.3", + "web-vitals": "^0.2.4" }, "scripts": { "start": "react-scripts start", @@ -16,7 +23,10 @@ "eject": "react-scripts eject" }, "eslintConfig": { - "extends": "react-app" + "extends": [ + "react-app", + "react-app/jest" + ] }, "browserslist": { "production": [ diff --git a/example/public/index.html b/example/public/index.html index dd1ccfd..aa069f2 100644 --- a/example/public/index.html +++ b/example/public/index.html @@ -2,9 +2,14 @@ - + + +