Mubarra-naz / artuso

Shopify Template with Next.Js 13.5
0 stars 0 forks source link

Husky rules #5

Open Mubarra-naz opened 1 year ago

Mubarra-naz commented 1 year ago

Adding husky rules for the repository

Aayman-star commented 1 year ago

The task is in progress. figured out the basic working. trying to figure out a few additional things.

Aayman-star commented 1 year ago

Update on November 5th,2023 :

  1. Upgraded nextjs to the latest version : pnpm up next react react-dom eslint-config-next --latest
  2. Implemented eslint rules,formatting rules husky according to this repo
  3. Important to remember: You have to stop the development server before committing the code as the files required to create the production build are not accessible when the development is running.
  4. Husky will prevent the commit from happening if it finds a difference with the suggested rules. you can format your code according to that rule and then commit again.
  5. It is suggested + recommended that you use pnpm for all future installations. all installations in this project so far have been done with pnpm.
Aayman-star commented 1 year ago

The Implemented rules are :

1."prefer-const": "error": This rule requires that variables that are never reassigned after being declared should be declared using const instead of let. This helps to improve code readability and maintainability.

  1. "@typescript-eslint/no-unused-vars": ["warn", { "ignoreRestSiblings": true }]: This rule warns about unused variables in TypeScript code. The ignoreRestSiblings option is set to true, which means that unused variables in rest parameters and destructured objects will be ignored.
  2. "camelcase": ["error", { "properties": "always", "ignoreDestructuring": true, "ignoreGlobals": true }]: This rule enforces the use of camelCase naming convention for variables, properties, and functions. The properties option is set to "always", which means that object properties should also be in camelCase. The ignoreDestructuring and ignoreGlobals options are set to true, which means that destructured variables and global variables will be ignored.
  3. "@typescript-eslint/no-explicit-any": "warn": This rule warns about the use of the any type in TypeScript code. The any type is a way to opt-out of type checking, which can lead to runtime errors. This rule encourages developers to use more specific types instead of any.