npm run dev
Solidus NextJS Frontend uses Jest to run unit tests with the help of React testing library to render the components.
You can run unit tests locally using:
npm run test:ci
Solidus NextJS Frontend uses ESLint with the JavaScript Standard style guide and Prettier as formatter.
Use npm run lint
to run the eslint linter
Use npm run lint:fix
to run the eslint linter with the autofix option
Use npm run lint:format
to run the prettier formatter on all files.
Important:
- Install the prettier extension for your editor here
- Install the eslint extension for your editor here
You can also configure your editor to format the current file on save avoiding a lot of errors. These are the steps to configure the linter on VS Code:
- Create this file:
.vscode/settings.json
- Fill the file with:
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
- Each component must be added under the
components
directory - Create the directory with the name of the component (e.g. button)
- The
index.js
file contains the component - The
queries.js
file export all the componentsqueries
- The
mutations.js
file export all the componentsmutations
- Follow the style of the
Button
component and theProductsList
one - Each component should have
propTypes
anddefaultProps
when applicable