From aaee5212e13bb2c078d00cc743e2f674cb5156d0 Mon Sep 17 00:00:00 2001 From: Drew Del Rosario Date: Wed, 3 Apr 2024 19:47:38 -0700 Subject: [PATCH] [Closes #32] jsdoc rules (#64) * Add jsdoc eslint package * Add lint plugin and jsconfig file * Update component types * Add user type to Page * Add descriptions * Update jsdoc eslint rules * Add missing jsdoc --------- Co-authored-by: Francis Li --- client/.eslintrc.cjs | 4 + client/package.json | 1 + client/src/App.jsx | 3 + client/src/components/NavBar.jsx | 3 + client/src/pages/index.jsx | 3 + client/src/pages/login.jsx | 3 + client/src/stories/Button/Button.jsx | 5 +- client/src/stories/Header/Header.jsx | 9 +- client/src/stories/Page/Page.jsx | 11 +- jsconfig.json | 9 + package-lock.json | 254 ++++++++++++++++++--------- 11 files changed, 219 insertions(+), 86 deletions(-) create mode 100644 jsconfig.json diff --git a/client/.eslintrc.cjs b/client/.eslintrc.cjs index 446c1c8..e27cdb5 100644 --- a/client/.eslintrc.cjs +++ b/client/.eslintrc.cjs @@ -7,6 +7,7 @@ module.exports = { 'plugin:react-hooks/recommended', 'plugin:storybook/recommended', 'plugin:react/recommended', + 'plugin:jsdoc/recommended', 'prettier', ], ignorePatterns: ['dist', '.eslintrc.cjs'], @@ -19,5 +20,8 @@ module.exports = { 'warn', { allowConstantExport: true }, ], + 'jsdoc/require-returns-description': 'off', + 'jsdoc/require-param-description': 'off', + 'jsdoc/require-returns': 'off', }, }; diff --git a/client/package.json b/client/package.json index 5290a54..5c58e5b 100644 --- a/client/package.json +++ b/client/package.json @@ -36,6 +36,7 @@ "@vitejs/plugin-react-swc": "^3.6.0", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", + "eslint-plugin-jsdoc": "^48.2.1", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.5", diff --git a/client/src/App.jsx b/client/src/App.jsx index 8339409..8cee677 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -4,6 +4,9 @@ import Index from './pages'; import Login from './pages/login'; import NavBar from './components/NavBar'; +/** + * Top-level application component. + */ function App() { return ( <> diff --git a/client/src/components/NavBar.jsx b/client/src/components/NavBar.jsx index e6be6a1..f74d622 100644 --- a/client/src/components/NavBar.jsx +++ b/client/src/components/NavBar.jsx @@ -1,5 +1,8 @@ import React from 'react'; +/** + * Primary navigation component. + */ function NavBar() { return (