xref: /aosp_15_r20/external/flatbuffers/Formatters.md (revision 890232f25432b36107d06881e0a25aaa6b473652)
1*890232f2SAndroid Build Coastguard Worker# Format Guidelines
2*890232f2SAndroid Build Coastguard Worker
3*890232f2SAndroid Build Coastguard WorkerIf you are interesting in contributing to the flatbuffers project, please take a second to read this document. Each language has it's own set of rules, that are defined in their respective formatter/linter documents.
4*890232f2SAndroid Build Coastguard Worker
5*890232f2SAndroid Build Coastguard Worker# Notes
6*890232f2SAndroid Build Coastguard Worker
7*890232f2SAndroid Build Coastguard Worker- Run the linter on the language you are working on before making a Pull Request.
8*890232f2SAndroid Build Coastguard Worker- DONT format/lint the generated code.
9*890232f2SAndroid Build Coastguard Worker
10*890232f2SAndroid Build Coastguard Worker# Languages
11*890232f2SAndroid Build Coastguard Worker
12*890232f2SAndroid Build Coastguard Worker## C++
13*890232f2SAndroid Build Coastguard Worker
14*890232f2SAndroid Build Coastguard WorkerC++ uses `clang-format` as it's formatter. Run the following script `sh scripts/clang-format-git.sh`, and it should style the C++ code according to [google style guide](https://google.github.io/styleguide/cppguide.html).
15*890232f2SAndroid Build Coastguard Worker
16*890232f2SAndroid Build Coastguard Worker## Swift
17*890232f2SAndroid Build Coastguard Worker
18*890232f2SAndroid Build Coastguard WorkerSwift uses swiftformat as it's formatter. Take a look at [how to install here](https://github.com/nicklockwood/SwiftFormat/blob/master/README.md#how-do-i-install-it). Run the following command `swiftformat --config swift.swiftformat .` in the root directory of the project
19*890232f2SAndroid Build Coastguard Worker
20*890232f2SAndroid Build Coastguard Worker## Typescript
21*890232f2SAndroid Build Coastguard Worker
22*890232f2SAndroid Build Coastguard WorkerTypescript uses eslint as it's linter. Take a look at [how to install here](https://eslint.org/docs/user-guide/getting-started). Run the following command `eslint ts/** --ext .ts` in the root directory of the project