पाठ 24 / 25
Troubleshooting और Common Gotchas
सामान्य समस्याओं को solve करें जो developers को सामना करना पड़ता है।
Known issues और solutions
Config loading नहीं हो रहा है? Parser errors? Rules apply नहीं हो रहे हैं? ये fixable हैं। अधिकांश issues config syntax, plugin conflicts, या order-dependent extends से stem करते हैं।
Troubleshooting checklist
सामान्य issues के लिए step-by-step debugging।
# Issue 1: Config not found
eslint --print-config src/app.js | head -20
# Issue 2: Prettier conflicts ESLint
# Verify prettier is in extends array LAST
grep -A2 'extends' .eslintrc.json
# Issue 3: Rule not applying
DEBUG=eslint* eslint src/app.js
# Issue 4: Parser error
# Check parserOptions.ecmaVersion matches your code
# Issue 5: Plugin not loaded
eslint --print-config src/app.js | grep -A3 plugins
Output:
Use these commands to debug any ESLint issue
Minimal से शुरू करें, gradually जोड़ें
यदि issues persist करते हैं: केवल eslint:recommended के साथ शुरू करें, फिर एक बार में एक plugin जोड़ें। यह समस्या को isolate करता है।
त्वरित जाँच
त्वरित जाँच: यदि एक rule apply नहीं हो रहा है, तो आप पहले क्या check करें?
- यह देखने के लिए eslint --print-config का उपयोग करें कि क्या rule active है।
- Editor को restart करें।
- .eslintrc.json को delete करें और recreate करें।
Answer
यह देखने के लिए eslint --print-config का उपयोग करें कि क्या rule active है। — --print-config ESLint द्वारा उपयोग किए जा रहे effective configuration को show करता है, यह reveal करता है कि rule active है या disabled है।