Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

494 fix linting errors and integrate husky for pre commit formatting #531

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions frontend/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"ecmaVersion": 2015,
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
Expand All @@ -8,6 +11,13 @@
],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
"prettier/prettier": "error",
"no-undef": "off",
"react/react-in-jsx-scope": "off"
},
"settings": {
"react": {
"version": "detect"
}
}
}
3 changes: 3 additions & 0 deletions frontend/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frontend/.husky/pre-commit
cd frontend
npx lint-staged
3 changes: 3 additions & 0 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"endOfLine": "lf"
}
2 changes: 1 addition & 1 deletion frontend/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @type { import('@storybook/react').Preview } */
import '../src/styles/variables.css'
import "../src/styles/variables.css";
const preview = {
parameters: {
controls: {
Expand Down
12 changes: 11 additions & 1 deletion frontend/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
# JavaScript Naming Conventions Guide for this Project

## Variables

Use camel case for variable names. Example: `let dogName = 'Scooby-Doo';`

## Booleans

Prefix Boolean variables with 'is' or 'has'. Example: `const hasCollar = true;`

## Functions

Name functions with descriptive verbs. Example: `const fetchDogToy = () => { /* ... */ };`

## Constants

Use uppercase for constants. Example: `const MAX_DOG_AGE = 20;`

## Functional Components

Use Pascal case for functional components. Example: `const DogProfile = () => { /* ... */ };`

## Hooks

Prefix custom hooks with 'use'. Example: `const useDogData = () => { /* ... */ };`

## Private Functions

Prefix private functions with an underscore within a module. Example: `const _calculateDogAge = () => { /* ... */ };`

## Global Variables

Use camel case or uppercase. Example: `let currentDog = 'Buddy'; const WORLD_DOG_DAY = 'August 26';`

## File Names

For files that export React components, use Pascal case. Example: `DogProfile.jsx`

## Global Variables

Use camel case or uppercase. Example: `let currentDog = 'Buddy'; const WORLD_DOG_DAY = 'August 26';`

## File Names

For files that export React components, use Pascal case. Example: `DogProfile.jsx`

# Getting Started with React App
Expand Down Expand Up @@ -67,4 +78,3 @@ Launches the test runner in the interactive watch mode.
### `npm run test:coverage`

Runs Vitest and collects coverage information.

22 changes: 10 additions & 12 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Guidefox</title>
<link rel="icon" type="image/svg+xml" href="/svg/favicon.svg" />
</head>

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Guidefox</title>
<link rel="icon" type="image/svg+xml" href="/svg/favicon.svg" />
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
</body>

<body>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
</body>
</html>
Loading