|
1 | 1 | --- |
2 | | -title: Editor Setup |
| 2 | +title: تجهيز محرر الأكواد |
3 | 3 | --- |
4 | 4 |
|
5 | 5 | <Intro> |
6 | 6 |
|
7 | | -A properly configured editor can make code clearer to read and faster to write. It can even help you catch bugs as you write them! If this is your first time setting up an editor or you're looking to tune up your current editor, we have a few recommendations. |
| 7 | +يمكن للمحرر المجهز بشكل صحيح أن يجعل الكود أكثر وضوحًا للقراءة وأسرع في الكتابة، ويمكن أن يساعد حتى في اكتشاف الأخطاء البرمجية أثناء الكتابة! إذا كانت هذه هي المرة الأولى التي تقوم فيها بإعداد محرر أو إذا كنت تبحث عن تحسين محررك الحالي، فلدينا بعض التوصيات. |
8 | 8 |
|
9 | 9 | </Intro> |
10 | 10 |
|
11 | 11 | <YouWillLearn> |
12 | 12 |
|
13 | | -* What the most popular editors are |
14 | | -* How to format your code automatically |
| 13 | +* ما هي المحررات الأكثر شيوعًا |
| 14 | +* كيفية تنسيق الكود تلقائيًا |
15 | 15 |
|
16 | 16 | </YouWillLearn> |
17 | 17 |
|
18 | | -## Your editor {/*your-editor*/} |
| 18 | +## محررك {/*your-editor*/} |
19 | 19 |
|
20 | | -[VS Code](https://code.visualstudio.com/) is one of the most popular editors in use today. It has a large marketplace of extensions and integrates well with popular services like GitHub. Most of the features listed below can be added to VS Code as extensions as well, making it highly configurable! |
| 20 | +[VS Code](https://code.visualstudio.com/) هو أحد المحررات الأكثر استخدامًا اليوم. لديه معرض كبير من الإضافات، ويتكامل بشكل جيد مع الخدمات الشائعة مثل GitHub. يمكن إضافة معظم الميزات المدرجة فيه إلى VS Code كإضافات أيضًا، مما يجعله قابلًا للتكوين بشكل كبير! |
21 | 21 |
|
22 | | -Other popular text editors used in the React community include: |
| 22 | +محررات النصوص الشائعة الأخرى المستخدمة في مجتمع React تشمل: |
23 | 23 |
|
24 | | -* [WebStorm](https://www.jetbrains.com/webstorm/) is an integrated development environment designed specifically for JavaScript. |
25 | | -* [Sublime Text](https://www.sublimetext.com/) has support for JSX and TypeScript, [syntax highlighting](https://stackoverflow.com/a/70960574/458193) and autocomplete built in. |
26 | | -* [Vim](https://www.vim.org/) is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as "vi" with most UNIX systems and with Apple OS X. |
| 24 | +* [WebStorm](https://www.jetbrains.com/webstorm/) هو بيئة تطوير متكاملة مصممة خصيصًا لـ JavaScript. |
| 25 | +* [Sublime Text](https://www.sublimetext.com/) لديه دعم لـ JSX و TypeScript، [تمييز الصيغة](https://stackoverflow.com/a/70960574/458193) وإكمال تلقائي مدمج. |
| 26 | +* [Vim](https://www.vim.org/) هو محرر نصوص قابل للتكوين بشكل كبير مصمم لجعل إنشاء وتغيير أي نوع من النصوص فعالًا للغاية. وهو مدرج كـ "vi" مع معظم أنظمة UNIX ومع Apple OS X. |
27 | 27 |
|
28 | | -## Recommended text editor features {/*recommended-text-editor-features*/} |
| 28 | +## ميزات محرر النصوص الموصى بها {/*recommended-text-editor-features*/} |
29 | 29 |
|
30 | | -Some editors come with these features built in, but others might require adding an extension. Check to see what support your editor of choice provides to be sure! |
| 30 | +قد تأتي بعض المحررات مع هذه الميزات مدمجة، ولكن قد تتطلب المحررات الأخرى تثبيت إضافةٍ. تحقق من الدعم الذي يوفره محررك المفضل لديك للتأكد! |
31 | 31 |
|
32 | | -### Linting {/*linting*/} |
| 32 | +### الفحص {/*linting*/} |
33 | 33 |
|
34 | | -Code linters find problems in your code as you write, helping you fix them early. [ESLint](https://eslint.org/) is a popular, open source linter for JavaScript. |
| 34 | +فحص الكود لاكتشاف الأخطاء في الكود أثناء الكتابة، مما يساعدك على إصلاحها في وقت مبكر. |
| 35 | +[ESLint](https://eslint.org/) هو فاحص شائع ومفتوح المصدر لـ JavaScript. |
35 | 36 |
|
36 | | -* [Install ESLint with the recommended configuration for React](https://www.npmjs.com/package/eslint-config-react-app) (be sure you have [Node installed!](https://nodejs.org/en/download/current/)) |
37 | | -* [Integrate ESLint in VSCode with the official extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) |
| 37 | +* [قم بتثبيت ESLint مع التكوين الموصى به لـ React](https://www.npmjs.com/package/eslint-config-react-app) (تأكد من تثبيت [Node!](https://nodejs.org/en/download/current/)) |
| 38 | +* [دمج ESLint في VSCode مع الإضافة الرسمية](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) |
38 | 39 |
|
39 | | -**Make sure that you've enabled all the [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) rules for your project.** They are essential and catch the most severe bugs early. The recommended [`eslint-config-react-app`](https://www.npmjs.com/package/eslint-config-react-app) preset already includes them. |
| 40 | +**تأكد من تمكين جميع قواعد [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) لمشروعك.** إنها ضرورية وتكشف أكثر الأخطاء خطورة في وقت مبكر. يتضمن التكوين الموصى به [`eslint-config-react-app`](https://www.npmjs.com/package/eslint-config-react-app) بالفعل هذه القواعد. |
40 | 41 |
|
41 | | -### Formatting {/*formatting*/} |
| 42 | +### التنسيق {/*formatting*/} |
42 | 43 |
|
43 | | -The last thing you want to do when sharing your code with another contributor is get into an discussion about [tabs vs spaces](https://www.google.com/search?q=tabs+vs+spaces)! Fortunately, [Prettier](https://prettier.io/) will clean up your code by reformatting it to conform to preset, configurable rules. Run Prettier, and all your tabs will be converted to spaces—and your indentation, quotes, etc will also all be changed to conform to the configuration. In the ideal setup, Prettier will run when you save your file, quickly making these edits for you. |
| 44 | +آخر شيء تريد القيام به عند مشاركة الكود مع مساهم آخر هو الدخول في مناقشة حول [التباعد بالمسافة الكبيرة tab أم التباعد بالمسافة space](https://www.google.com/search?q=tabs+vs+spaces)! لحسن الحظ، سيقوم [Prettier](https://prettier.io/) بتنظيف الكود الخاص بك عن طريق إعادة تنسيقه ليتوافق مع قواعد مسبقة وقابلة للتكوين. قم بتشغيل Prettier، وسيتم تحويل جميع علامات التبويب إلى مسافات - وسيتم تغيير المسافة البادئة والاقتباسات وما إلى ذلك أيضًا ليتوافق مع التكوين. في الإعداد المثالي، سيتم تشغيل Prettier عند حفظ الملف، مما يجعل هذه التعديلات بسرعة بالنسبة لك. |
44 | 45 |
|
45 | | -You can install the [Prettier extension in VSCode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) by following these steps: |
| 46 | +يمكنك تثبيت [إضافة Prettier في VSCode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) عن طريق اتباع هذه الخطوات: |
46 | 47 |
|
47 | | -1. Launch VS Code |
48 | | -2. Use Quick Open (press Ctrl/Cmd+P) |
49 | | -3. Paste in `ext install esbenp.prettier-vscode` |
50 | | -4. Press Enter |
| 48 | +1. قم بتشغيل VS Code |
| 49 | +2. استخدم البحث السريع (اضغط على Ctrl/Cmd+P) |
| 50 | +3. الصق `ext install esbenp.prettier-vscode` |
| 51 | +4. اضغط على Enter |
51 | 52 |
|
52 | | -#### Formatting on save {/*formatting-on-save*/} |
| 53 | +#### التنسيق عند الحفظ {/*formatting-on-save*/} |
53 | 54 |
|
54 | | -Ideally, you should format your code on every save. VS Code has settings for this! |
| 55 | +في الواقع، يجب عليك تنسيق الكود في كل مرة تقوم فيها بحفظه. يحتوي VS Code على إعدادات لهذا الغرض! |
55 | 56 |
|
56 | | -1. In VS Code, press `CTRL/CMD + SHIFT + P`. |
57 | | -2. Type "settings" |
58 | | -3. Hit Enter |
59 | | -4. In the search bar, type "format on save" |
60 | | -5. Be sure the "format on save" option is ticked! |
| 57 | +1. في VS Code، اضغط على `CTRL/CMD + SHIFT + P`. |
| 58 | +2. اكتب "settings" |
| 59 | +3. اضغط على Enter |
| 60 | +4. في شريط البحث، اكتب "format on save" |
| 61 | +5. تأكد من تحديد خيار "format on save"! |
61 | 62 |
|
62 | | -> If your ESLint preset has formatting rules, they may conflict with Prettier. We recommend disabling all formatting rules in your ESLint preset using [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) so that ESLint is *only* used for catching logical mistakes. If you want to enforce that files are formatted before a pull request is merged, use [`prettier --check`](https://prettier.io/docs/en/cli.html#--check) for your continuous integration. |
| 63 | +> إذا كانت لديك قواعد تنسيق في إعدادات ESLint، فقد تتعارض مع Prettier. نوصي بتعطيل جميع قواعد التنسيق في إعدادات ESLint الخاصة بك باستخدام [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) بحيث يتم استخدام ESLint *فقط* للكشف عن الأخطاء المنطقية. إذا كنت ترغب في فرض تنسيق الملفات قبل دمج طلب سحب (Pull Request)، استخدم [`prettier --check`](https://prettier.io/docs/en/cli.html#--check) للتكامل المستمر. |
0 commit comments