|
| 1 | +<!---{ |
| 2 | +"title": "Coding standards and style guide", |
| 3 | +"navTitle": "Style guide" |
| 4 | +}---> |
| 5 | + |
| 6 | +<!DOCTYPE html> |
| 7 | +<!-- Copyright (C) 2020 Matthew "strager" Glazar --> |
| 8 | +<!-- See end of file for extended copyright information. --> |
| 9 | +<html> |
| 10 | + <head> |
| 11 | + <%- await include("../../common-head.ejs.html") %> |
| 12 | + <link href="../../main.css" rel="stylesheet" /> |
| 13 | + </head> |
| 14 | + <body class="side-bar-nav"> |
| 15 | + <header><%- await include("../../common-nav.ejs.html") %></header> |
| 16 | + |
| 17 | + <main> |
| 18 | + <h2>Coding standards and style guide</h2> |
| 19 | + |
| 20 | + <section id="cxx"> |
| 21 | + <h3>C++ code</h3> |
| 22 | + |
| 23 | + <p> |
| 24 | + quick-lint-js’ C++ code is formatted using the |
| 25 | + <a href="https://clang.llvm.org/docs/ClangFormat.html" |
| 26 | + >clang-format</a |
| 27 | + > |
| 28 | + tool, <strong>version 9.0.x</strong>. During development, use |
| 29 | + clang-format in one of two ways: |
| 30 | + </p> |
| 31 | + <ul> |
| 32 | + <li> |
| 33 | + <a href="https://releases.llvm.org/download.html#9.0.0" |
| 34 | + >Install clang-format</a |
| 35 | + > |
| 36 | + yourself, then run the <code>tools/format</code> script to format |
| 37 | + all of quick-lint-js’ code with one command. |
| 38 | + </li> |
| 39 | + <li> |
| 40 | + Run clang-format in your editor (<a |
| 41 | + href="https://clang.llvm.org/docs/ClangFormat.html#clion-integration" |
| 42 | + >CLion</a |
| 43 | + >, |
| 44 | + <a |
| 45 | + href="https://clang.llvm.org/docs/ClangFormat.html#emacs-integration" |
| 46 | + >Emacs</a |
| 47 | + >, |
| 48 | + <a |
| 49 | + href="https://clang.llvm.org/docs/ClangFormat.html#vim-integration" |
| 50 | + >Vim</a |
| 51 | + >, |
| 52 | + <a |
| 53 | + href="https://clang.llvm.org/docs/ClangFormat.html#visual-studio-integration" |
| 54 | + >Visual Studio</a |
| 55 | + >, |
| 56 | + <a |
| 57 | + href="https://marketplace.visualstudio.com/items?itemName=xaver.clang-format" |
| 58 | + >Visual Studio Code</a |
| 59 | + >). Be sure to use version 9.0.x, or you might have problems with |
| 60 | + the CI clang-format checker. |
| 61 | + </li> |
| 62 | + </ul> |
| 63 | + </section> |
| 64 | + |
| 65 | + <section id="javascript"> |
| 66 | + <h3>JavaScript and HTML</h3> |
| 67 | + <p> |
| 68 | + quick-lint-js’ web code (CSS, HTML, and JavaScript) is formatted using |
| 69 | + the <a href="https://prettier.io/">Prettier</a> tool. During |
| 70 | + development, use Prettier in one of two ways: |
| 71 | + </p> |
| 72 | + <ul> |
| 73 | + <li> |
| 74 | + In the <code>plugin/vscode</code>, <code>plugin/vscode-lsp</code>, |
| 75 | + <code>wasm</code>, or <code>website</code> directory, install |
| 76 | + Prettier with <code>yarn install</code> then run it with |
| 77 | + <code>yarn fmt</code>. This formats all of quick-lint-js’ code in |
| 78 | + that subproject with one command. |
| 79 | + </li> |
| 80 | + <li> |
| 81 | + Run Prettier in your editor with |
| 82 | + <a href="https://prettier.io/docs/en/editors.html" |
| 83 | + >Prettier editor integration</a |
| 84 | + >. You need to run <code>yarn install</code> in the subproject’s |
| 85 | + directory in order for editor integration to work. |
| 86 | + </li> |
| 87 | + </ul> |
| 88 | + </section> |
| 89 | + </main> |
| 90 | + |
| 91 | + <footer><%- await include("../../common-footer-nav.ejs.html") %></footer> |
| 92 | + </body> |
| 93 | +</html> |
| 94 | + |
| 95 | +<!-- |
| 96 | +quick-lint-js finds bugs in JavaScript programs. |
| 97 | +Copyright (C) 2020 Matthew "strager" Glazar |
| 98 | +
|
| 99 | +This file is part of quick-lint-js. |
| 100 | +
|
| 101 | +quick-lint-js is free software: you can redistribute it and/or modify |
| 102 | +it under the terms of the GNU General Public License as published by |
| 103 | +the Free Software Foundation, either version 3 of the License, or |
| 104 | +(at your option) any later version. |
| 105 | +
|
| 106 | +quick-lint-js is distributed in the hope that it will be useful, |
| 107 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 108 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 109 | +GNU General Public License for more details. |
| 110 | +
|
| 111 | +You should have received a copy of the GNU General Public License |
| 112 | +along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>. |
| 113 | +--> |
0 commit comments