@fidooo-inc/nodejs-style-p
v1.4.0
Published
This package contains the code style configuration for 518-rent projects.
Maintainers
Readme
🎨 Node.js Style Guide
Hey there! Welcome to our shared style guide package. Think of this as your project's personal stylist - it keeps your code looking sharp and consistent across all our projects.
What's Inside?
This little package packs a punch with three essential tools that'll make your code shine:
💅 Prettier Configuration
Your automatic code formatter! It handles all the nitty-gritty details like string quotes, bracket spacing, line lengths, and more. No more debates about formatting - Prettier's got your back for TypeScript, JavaScript, YAML, Markdown, and beyond.
🔍 ESLint Configuration
Think of this as your code's quality inspector. It catches those pesky unused variables, encourages modern coding practices (hello, arrow functions!), and keeps your code following our agreed-upon standards.
⚡ Lint-Staged Configuration
The efficiency expert of the group! Instead of checking every single file in your project, this smart tool only focuses on the files you've actually changed and staged for commit. Your CI/CD pipeline will thank you for the speed boost.
Getting Started
Ready to level up your project's code quality? Here's how to get everything set up:
First Things First: Installation
Jump into your terminal and add our style guide to your project:
npm install --save-dev @fidooo-inc/nodejs-style-pBoom! You've just added all our carefully crafted configurations as development dependencies.
Setting Up the Git Hooks Magic
Time to make sure your code gets automatically styled before each commit. We'll use Husky to handle this like a pro:
Get Husky Ready
If you don't already have Husky set up (check for a .husky folder in your project root), let's get it initialized:
npx huskyThis creates your .husky folder with all the necessary files.
Hook Into Pre-Commit
Now, edit (or create) the .husky/pre-commit file and add this magic line:
npx lint-stagedEvery time you try to commit, Husky will now run our style checks automatically. Pretty neat, right?
Configuration Time!
Now for the fun part - connecting everything together:
Lint-Staged Setup
Create a lint-staged.config.mjs file in your project root and add:
export { default as default } from "@fidooo-inc/nodejs-style-p/lint-staged";This tells lint-staged to use our pre-configured rules instead of you having to figure them out yourself.
ESLint Configuration
Create an eslint.config.mjs file in your project root with:
export { default as default } from "@fidooo-inc/nodejs-style-p/eslint";Same deal here - you get all our ESLint wisdom without the setup headache.
Prettier Configuration
Here's the easiest one! Just add this line to your package.json:
"prettier": "@fidooo-inc/nodejs-style-p/prettier"Drop it anywhere at the root level of your package.json, and you're golden.
You're All Set! 🎉
That's it! Your next commit will automatically get the full style treatment. Your code will be formatted, linted, and looking absolutely fantastic.
No more style inconsistencies, no more manual formatting, no more arguments about code style in PR reviews. Just clean, consistent, beautiful code across all your projects.
Happy coding! ✨
