]> git.gir.st - VimFx.git/blob - documentation/CONTRIBUTING-CODE.md
VimFx v0.27.1
[VimFx.git] / documentation / CONTRIBUTING-CODE.md
1 # Contributing code
2
3
4 ## Localizations
5
6 Contribute your localization! Copy the `extension/locale/en-US` directory and go
7 wild! Usually, it’s best to stick to the master branch.
8
9 Tip: If you’re translating into, for example, Swedish, run `gulp sync-locales
10 --sv-SE?` to see how many percent is done. All lines (including line numbers)
11 that don’t differ compared to “en-US” are also printed, letting you know what’s
12 left to do. Substitute “sv-SE” with the locale you’re working on.
13
14 Also, don’t worry if you can’t get a 100% difference compared to “en-US.”
15 Sometimes text strings are very short and will look identical in both languages.
16 That’s completely OK.
17
18
19 ## Code
20
21 Create a new topic branch.
22
23 git checkout -b my-topic-branch master
24
25 Code! Try to follow these simple rules:
26
27 - Always use parentheses when calling functions.
28 - Always use braces for object literals.
29 - Always use explicit `return`s, unless the function is a one-liner.
30 - Always use single quotes, unless you use interpolation.
31 - Prefer interpolation over concatenation, both for strings and regexes.
32 - Always use the following forms (not any aliases):
33 - `true` and `false`
34 - `==` and `!=`
35 - `and` and `or`
36 - `not`
37 - Never use `++` and `--`.
38 - Never put spaces directly inside `[]` and `{}`.
39 - Never put spaces before or more than one space after `:` in object literals.
40 - Never use `when ... then` in `switch`es; replace `then` with a newline.
41 - Avoid vertical alignment of code (such as aligning `=`s).
42 - Comment when necessary. Comments should be full sentences.
43 - Keep lines at most 80 characters long.
44 - Indent using two spaces.
45 - Commit no `console.log(...)`s (but do use them when debugging).
46
47 See [tools.md] for how to **build,** **lint,** and **run the tests.**
48
49 Break up your pull request in several commits if necessary. The first line of
50 commit messages should be a short summary. If needed, add a blank line and then
51 a nicely formatted markdown description.
52
53 Finally send a pull request.
54
55 [tools.md]: tools.md
Imprint / Impressum