DEV Community

Kevan Y
Kevan Y

Posted on

Lab 7 - Add contribution guides

Intro

Intro
For my seventh lab, I have to setup contribution guides, prettier, eslint, and husky to my text ssg project.

IDE support

I created a .vscode folder in my project and put extensions.json for every extension I want the user to download to their IDE. I also added a settings.json to set the setting of the IDE.

Prettier

Prettier is a code formatter, I added to my project by running npm install --save-dev --save-exact prettier, after that I create a .prettierrc.json file and put my prettier config. I also created a .prettierignore to ignore files to not be formatted.
I added some script in the package.json to run those command

"prettier": "prettier --write \"./**/*.{md,json,html,js}\"",
"prettier-check": "prettier --check \"./**/*.{md,json,html,js}\"",
Enter fullscreen mode Exit fullscreen mode

Eslint

Eslint is a tool that helps to identify potential bugs, I added to my project by running npm install eslint --save-dev, after that I run npx eslint --init to generate my Eslint setting. I also added the airbnb Eslint plugin.
I added some script in the package.json to run those command

"eslint": "eslint --config .eslintrc.js .",
"eslint-fix": "eslint --fix --config .eslintrc.js  .",
"lint": "npm run eslint",
Enter fullscreen mode Exit fullscreen mode

Husky

Husky to setup some tests before committing. I installed to my project by running npm i husky and add a pre-commit hooks with npx husky add .husky/pre-commit "npm run prettier-check", this will run a prettier check each time we commit. If the check fails the commit is aborted otherwise it will commit.

Contribution guideline

I created a contribution.md for a guideline on how to install and run locally, some steps to follow before committing the code, and steps to follow before creating an issue.

Top comments (0)