Skip to content

Commit 579f585

Browse files
author
Serhii Shramko
committed
docs: update UA readme
1 parent 1ed9eb1 commit 579f585

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

README.ukrainian.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -412,125 +412,125 @@ especially if the cause of the abnormal behavior is inside of the missing functi
412412

413413
<br/><br/>
414414

415-
## ![] 3.2 Node.js specific plugins
415+
## ![] 3.2 Специфічні плагіни для Node.js
416416

417-
**TL;DR:** On top of ESLint standard rules that cover vanilla JavaScript, add Node.js specific plugins like [eslint-plugin-node](https://www.npmjs.com/package/eslint-plugin-node), [eslint-plugin-mocha](https://www.npmjs.com/package/eslint-plugin-mocha) and [eslint-plugin-node-security](https://www.npmjs.com/package/eslint-plugin-security)
417+
**Коротко:** Окрім стандартних правил ESLint, що охоплюють ванільний JavaScript, додайте специфічні плагіни для Node.js, такі як [eslint-plugin-node](https://www.npmjs.com/package/eslint-plugin-node), [eslint-plugin-mocha](https://www.npmjs.com/package/eslint-plugin-mocha) і [eslint-plugin-node-security](https://www.npmjs.com/package/eslint-plugin-security).
418418

419-
**Otherwise:** Many faulty Node.js code patterns might escape under the radar. For example, developers might require(variableAsPath) files with a variable given as a path which allows attackers to execute any JS script. Node.js linters can detect such patterns and complain early
419+
**Інакше:** Багато проблемних шаблонів коду Node.js можуть залишитися непоміченими. Наприклад, розробники можуть використовувати require(variableAsPath) для підключення файлів з передачею змінної як шляху, що дозволяє зловмисникам виконувати будь-який JS-скрипт. Лінтери Node.js можуть виявляти такі шаблони та попереджати про них заздалегідь.
420420

421421
<br/><br/>
422422

423-
## ![] 3.3 Start a Codeblock's Curly Braces on the Same Line
423+
## ![] 3.3 Відкривайте фігурні дужки коду на тому ж рядку
424424

425-
**TL;DR:** The opening curly braces of a code block should be on the same line as the opening statement
425+
**Коротко:** Відкриваючі фігурні дужки блоку коду повинні бути на тому ж рядку, що й оператор відкриття.
426426

427-
### Code Example
427+
### Приклад коду
428428

429429
```javascript
430-
// Do
430+
// Правильно
431431
function someFunction() {
432-
// code block
432+
// блок коду
433433
}
434434

435-
// Avoid
435+
// Уникайте
436436
function someFunction()
437437
{
438-
// code block
438+
// блок коду
439439
}
440440
```
441441

442-
**Otherwise:** Deferring from this best practice might lead to unexpected results, as seen in the StackOverflow thread below:
442+
**Інакше:** Відхилення від цієї практики може призвести до несподіваних результатів, як показано в обговоренні на StackOverflow нижче:
443443

444-
🔗 [**Read more:** "Why do results vary based on curly brace placement?" (StackOverflow)](https://stackoverflow.com/questions/3641519/why-does-a-results-vary-based-on-curly-brace-placement)
444+
🔗 [**Читати більше:** "Чому результати варіюються залежно від розміщення фігурних дужок?" (StackOverflow)](https://stackoverflow.com/questions/3641519/why-does-a-results-vary-based-on-curly-brace-placement)
445445

446446
<br/><br/>
447447

448-
## ![] 3.4 Separate your statements properly
448+
## ![] 3.4 Правильно розділяйте свої вирази
449449

450-
No matter if you use semicolons or not to separate your statements, knowing the common pitfalls of improper linebreaks or automatic semicolon insertion, will help you to eliminate regular syntax errors.
450+
Незалежно від того, використовуєте ви крапки з комами для розділення виразів чи ні, знання поширених помилок, пов'язаних з неправильними розривами рядків або автоматичною вставкою крапок з комами, допоможе уникнути регулярних синтаксичних помилок.
451451

452-
**TL;DR:** Use ESLint to gain awareness about separation concerns. [Prettier](https://prettier.io/) or [Standardjs](https://standardjs.com/) can automatically resolve these issues.
452+
**Коротко:** Використовуйте ESLint для підвищення обізнаності про проблеми з розділенням виразів. [Prettier](https://prettier.io/) або [Standardjs](https://standardjs.com/) можуть автоматично вирішити ці проблеми.
453453

454-
**Otherwise:** As seen in the previous section, JavaScript's interpreter automatically adds a semicolon at the end of a statement if there isn't one, or considers a statement as not ended where it should, which might lead to some undesired results. You can use assignments and avoid using immediately invoked function expressions to prevent most of the unexpected errors.
454+
**Інакше:** Як було показано в попередньому розділі, інтерпретатор JavaScript автоматично додає крапку з комою в кінці виразу, якщо її немає, або вважає, що вираз не завершено там, де це потрібно, що може призвести до небажаних результатів. Ви можете використовувати присвоєння і уникати безпосередньо викликаних функціональних виразів (IIFE), щоб уникнути більшості несподіваних помилок.
455455

456-
### Code example
456+
### Приклад коду
457457

458458
```javascript
459-
// Do
459+
// Правильно
460460
function doThing() {
461461
// ...
462462
}
463463

464464
doThing()
465465

466-
// Do
466+
// Правильно
467467

468468
const items = [1, 2, 3]
469469
items.forEach(console.log)
470470

471-
// Avoidthrows exception
471+
// Неправильновиникає виняток
472472
const m = new Map()
473473
const a = [1,2,3]
474474
[...m.values()].forEach(console.log)
475475
> [...m.values()].forEach(console.log)
476476
> ^^^
477477
> SyntaxError: Unexpected token ...
478478

479-
// Avoidthrows exception
480-
const count = 2 // it tries to run 2(), but 2 is not a function
479+
// Неправильновиникає виняток
480+
const count = 2 // інтерпретатор намагається виконати 2(), але 2 не є функцією
481481
(function doSomething() {
482-
// do something amazing
482+
// зробити щось чудове
483483
}())
484-
// put a semicolon before the immediate invoked function, after the const definition, save the return value of the anonymous function to a variable or avoid IIFEs altogether
484+
// вставте крапку з комою перед безпосередньо викликаним виразом, після визначення const, збережіть результат анонімної функції у змінну або уникайте IIFE взагалі
485485
```
486486

487-
🔗 [**Read more:** "Semi ESLint rule"](https://eslint.org/docs/rules/semi)
488-
🔗 [**Read more:** "No unexpected multiline ESLint rule"](https://eslint.org/docs/rules/no-unexpected-multiline)
487+
🔗 [**Читати більше:** "Правило ESLint для крапок з комами"](https://eslint.org/docs/rules/semi)
488+
🔗 [**Читати більше:** "Правило ESLint для несподіваних розривів рядків"](https://eslint.org/docs/rules/no-unexpected-multiline)
489489

490490
<br/><br/>
491491

492-
## ![] 3.5 Name your functions
492+
## ![] 3.5 Давайте імена своїм функціям
493493

494-
**TL;DR:** Name all functions, including closures and callbacks. Avoid anonymous functions. This is especially useful when profiling a node app. Naming all functions will allow you to easily understand what you're looking at when checking a memory snapshot
494+
**Коротко:** Давайте імена всім функціям, включно із замиканнями та зворотними викликами. Уникайте анонімних функцій. Це особливо корисно при профілюванні Node.js додатків. Присвоєння імен функціям дозволить вам легко розуміти, що ви переглядаєте під час аналізу знімку пам'яті.
495495

496-
**Otherwise:** Debugging production issues using a core dump (memory snapshot) might become challenging as you notice significant memory consumption from anonymous functions
496+
**Інакше:** Виправлення проблем на продакшені за допомогою core dump (знімка пам'яті) може стати складним завданням, оскільки ви можете помітити значне споживання пам'яті анонімними функціями.
497497

498498
<br/><br/>
499499

500-
## ![] 3.6 Use naming conventions for variables, constants, functions and classes
500+
## ![] 3.6 Використовуйте угоди про іменування для змінних, констант, функцій і класів
501501

502-
**TL;DR:** Use **_lowerCamelCase_** when naming constants, variables and functions, **_UpperCamelCase_** (capital first letter as well) when naming classes and **_UPPER_SNAKE_CASE_** when naming global or static variables. This will help you to easily distinguish between plain variables, functions, classes that require instantiation and variables declared at global module scope. Use descriptive names, but try to keep them short
502+
**Коротко:** Використовуйте **_lowerCamelCase_** для називання констант, змінних і функцій, **_UpperCamelCase_** (перша велика літера) для називання класів і **_UPPER_SNAKE_CASE_** для називання глобальних або статичних змінних. Це допоможе легко розрізняти звичайні змінні, функції, класи, які потребують інстанціювання, та змінні, оголошені на рівні глобального модуля. Використовуйте описові імена, але намагайтеся робити їх короткими.
503503

504-
**Otherwise:** JavaScript is the only language in the world that allows invoking a constructor ("Class") directly without instantiating it first. Consequently, Classes and function-constructors are differentiated by starting with UpperCamelCase
504+
**Інакше:** JavaScript — єдина мова у світі, яка дозволяє викликати конструктор ("Клас") напряму без попередньої інстанціювання. Як наслідок, класи та функції-конструктори відрізняються тим, що починаються з UpperCamelCase.
505505

506-
### 3.6 Code Example
506+
### 3.6 Приклад коду
507507

508508
```javascript
509-
// for global variables names we use the const/let keyword and UPPER_SNAKE_CASE
509+
// для глобальних змінних використовуємо ключові слова const/let і UPPER_SNAKE_CASE
510510
let MUTABLE_GLOBAL = "mutable value"
511511
const GLOBAL_CONSTANT = "immutable value";
512512
const CONFIG = {
513513
key: "value",
514514
};
515515

516-
// examples of UPPER_SNAKE_CASE convention in nodejs/javascript ecosystem
517-
// in javascript Math.PI module
516+
// приклади угоди UPPER_SNAKE_CASE у екосистемі nodejs/javascript
517+
// у модулі JavaScript Math.PI
518518
const PI = 3.141592653589793;
519519

520520
// https://github.com/nodejs/node/blob/b9f36062d7b5c5039498e98d2f2c180dca2a7065/lib/internal/http2/core.js#L303
521-
// in nodejs http2 module
521+
// у модулі nodejs http2
522522
const HTTP_STATUS_OK = 200;
523523
const HTTP_STATUS_CREATED = 201;
524524

525-
// for class name we use UpperCamelCase
525+
// для назв класів використовуємо UpperCamelCase
526526
class SomeClassExample {
527-
// for static class properties we use UPPER_SNAKE_CASE
527+
// для статичних властивостей класів використовуємо UPPER_SNAKE_CASE
528528
static STATIC_PROPERTY = "value";
529529
}
530530

531-
// for functions names we use lowerCamelCase
531+
// для назв функцій використовуємо lowerCamelCase
532532
function doSomething() {
533-
// for scoped variable names we use the const/let keyword and lowerCamelCase
533+
// для локальних змінних використовуємо ключові слова const/let і lowerCamelCase
534534
const someConstExample = "immutable value";
535535
let someMutableExample = "mutable value";
536536
}

0 commit comments

Comments
 (0)