Skip to content

Commit 909325d

Browse files
committed
chore: Configure ESLint and Git Pre commit hook
- configure eslint and prettier format Delivers #187419115
1 parent 3f8a19f commit 909325d

19 files changed

+6398
-3443
lines changed

.eslintrc.cjs

+55-2
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,71 @@
11
module.exports = {
22
root: true,
3-
env: { browser: true, es2020: true },
3+
env: {
4+
browser: true,
5+
es2020: true,
6+
node: true,
7+
},
48
extends: [
5-
"eslint:recommended",
9+
"airbnb",
10+
"airbnb-typescript",
11+
"airbnb/hooks",
612
"plugin:@typescript-eslint/recommended",
713
"plugin:react-hooks/recommended",
814
],
915
ignorePatterns: ["dist", ".eslintrc.cjs"],
1016
parser: "@typescript-eslint/parser",
17+
parserOptions: {
18+
project: "./tsconfig.eslint.json",
19+
},
1120
plugins: ["react-refresh"],
1221
rules: {
22+
"react/react-in-jsx-scope": "off",
23+
"react/function-component-definition": [
24+
"warn",
25+
{
26+
namedComponents: "arrow-function",
27+
unnamedComponents: "arrow-function",
28+
},
29+
],
30+
"no-undef": "off",
1331
"react-refresh/only-export-components": [
1432
"warn",
1533
{ allowConstantExport: true },
1634
],
35+
"@typescript-eslint/quotes": ["off"],
36+
"arrow-body-style": ["warn", "as-needed"],
37+
"import/order": [
38+
"warn",
39+
{
40+
groups: [
41+
"builtin",
42+
"external",
43+
"internal",
44+
"parent",
45+
"sibling",
46+
"index",
47+
],
48+
"newlines-between": "always",
49+
},
50+
],
51+
"@typescript-eslint/comma-dangle": ["warn", "always-multiline"],
52+
"import/no-extraneous-dependencies": [
53+
"error",
54+
{
55+
devDependencies: [
56+
"vite.config.ts",
57+
"postcss.config.js",
58+
"tailwind.config.js",
59+
],
60+
},
61+
],
62+
"import/extensions": ["off"],
63+
},
64+
settings: {
65+
"import/resolver": {
66+
node: {
67+
extensions: [".js", ".jsx", ".ts", ".tsx"],
68+
},
69+
},
1770
},
1871
};

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run test

.prettierrc.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": false,
4+
"singleQuote": false,
5+
"semi": true,
6+
"bracketSpacing": true,
7+
"arrowParens": "always",
8+
"bracketSameLine": true,
9+
"endOfLine": "auto"
10+
}

README.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# EAGLE E-commerce
22

3+
<img alt="Static Badge" src="https://img.shields.io/badge/Reviewed_By-HoundCI-blue?style=flat-square">
4+
35
The front-end of Eagle E-commerce utilizes React for a modern, user-friendly interface, while Node.js powers its backend, ensuring a seamless shopping experience
46

57
[![Maintainability](https://api.codeclimate.com/v1/badges/81fa30232b27b1482f4f/maintainability)](https://codeclimate.com/github/atlp-rwanda/eagles-ec-fe/maintainability)
@@ -15,18 +17,25 @@ This project was built using the PERN (PostgreSQL, Express.js, React.js, Node.js
1517
To run the app locally, follow these steps:
1618

1719
1. **Clone the repository:**
20+
1821
```bash
1922
git clone https://github.com/atlp-rwanda/eagles-ec-fe.git
20-
```
23+
```
24+
2125
2. **Change working dir to cloned repo:**
26+
2227
```bash
2328
cd eagle-ec-fe
2429
```
30+
2531
3. **Install dependencies:**
32+
2633
```bash
2734
npm install
2835
```
36+
2937
4. **Run developmnt server:**
38+
3039
```bash
3140
npm run dev
3241
```
@@ -44,4 +53,5 @@ npm install
4453
```bash
4554
npm run test:coverage
4655
```
47-
Write your test by creating a file with .test.tsx extetion under __test__ directory.
56+
Write your test by creating a file with .test.tsx extetion under __test__ directory.
57+
```

hound.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
eslint:
2+
enabled: true
3+
file_patterns:
4+
- "*.js"
5+
- "*.ts"
6+
enabled_plugins:
7+
- eslint-plugin-import
8+
- eslint-plugin-prettier
9+
- eslint-plugin:@typescript-eslint

0 commit comments

Comments
 (0)