पाठ 17 / 25

टीम सेटअप और Shared Configurations

अपनी टीम के लिए shareable ESLint और Prettier configs बनाएँ।

Configurations को scale करना

बड़ी टीमें centralized ESLint configs से benefit करती हैं। Shared rules को एक package (@org/eslint-config) में extract करें और सभी projects में इसका उपयोग करें।

Shared config package

एक reusable ESLint config package बनाने के लिए structure।

# Create @myorg/eslint-config package
mkdir -p packages/eslint-config
cd packages/eslint-config
npm init -y

# Add to package.json
{
  "name": "@myorg/eslint-config",
  "main": "index.js",
  "peerDependencies": { "eslint": "^8.0.0" }
}

# index.js exports the config
module.exports = {
  extends: ['eslint:recommended'],
  rules: { /* team rules */ }
};

Output:

Shared ESLint config package created

Configs को version control करें

Shareable configs को अपने main repo में या separate npm packages के रूप में store करें। उन्हें version करें और teams को अपनी गति से update करने दें।

त्वरित जाँच

त्वरित जाँच: एक shared ESLint config package क्यों बनाएँ?

  • सुनिश्चित करने के लिए कि सभी team projects एक ही standards को follow करें।
  • Development को slow down करने के लिए।
  • कोड को reduce करने के लिए।
Answer

सुनिश्चित करने के लिए कि सभी team projects एक ही standards को follow करें। — Shared configs आपके organization में consistency बनाए रखते हैं और नए projects को onboard करना trivial बनाते हैं।