2017-03-22 15:30:54 -04:00
|
|
|
# Frontend Development Guidelines
|
|
|
|
|
|
|
|
This document describes various guidelines to ensure consistency and quality
|
|
|
|
across GitLab's frontend team.
|
|
|
|
|
|
|
|
## Overview
|
|
|
|
|
|
|
|
GitLab is built on top of [Ruby on Rails][rails] using [Haml][haml] with
|
|
|
|
[Hamlit][hamlit]. Be wary of [the limitations that come with using
|
|
|
|
Hamlit][hamlit-limits]. We also use [SCSS][scss] and plain JavaScript with
|
|
|
|
modern ECMAScript standards supported through [Babel][babel] and ES module
|
|
|
|
support through [webpack][webpack].
|
|
|
|
|
|
|
|
We also utilize [webpack][webpack] to handle the bundling, minification, and
|
|
|
|
compression of our assets.
|
|
|
|
|
|
|
|
Working with our frontend assets requires Node (v4.3 or greater) and Yarn
|
|
|
|
(v0.17 or greater). You can find information on how to install these on our
|
|
|
|
[installation guide][install].
|
|
|
|
|
|
|
|
[jQuery][jquery] is used throughout the application's JavaScript, with
|
|
|
|
[Vue.js][vue] for particularly advanced, dynamic elements.
|
|
|
|
|
|
|
|
### Browser Support
|
|
|
|
|
|
|
|
For our currently-supported browsers, see our [requirements][requirements].
|
|
|
|
|
2017-04-20 07:24:40 -04:00
|
|
|
---
|
|
|
|
|
|
|
|
## Development Process
|
|
|
|
|
|
|
|
### Share your work early
|
|
|
|
1. Before writing code guarantee your vision of the architecture is aligned with
|
|
|
|
GitLab's architecture.
|
|
|
|
1. Add a diagram to the issue and ask a Frontend Architecture about it.
|
|
|
|
|
|
|
|
![Diagram of Issue Boards Architecture](img/boards_diagram.png)
|
|
|
|
|
|
|
|
1. Don't take more than one week between starting work on a feature and
|
|
|
|
sharing a Merge Request with a reviewer or a maintainer.
|
|
|
|
|
|
|
|
### Vue features
|
|
|
|
1. Follow the steps in [Vue.js Best Practices](vue.md)
|
|
|
|
1. Follow the style guide.
|
|
|
|
1. Only a handful of people are allowed to merge Vue related features.
|
2017-04-20 08:41:18 -04:00
|
|
|
Reach out to one of Vue experts early in this process.
|
2017-04-20 07:24:40 -04:00
|
|
|
|
|
|
|
|
2017-03-22 15:30:54 -04:00
|
|
|
---
|
|
|
|
|
|
|
|
## [Architecture](architecture.md)
|
|
|
|
How we go about making fundamental design decisions in GitLab's frontend team
|
|
|
|
or make changes to our frontend development guidelines.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
2017-10-11 01:59:34 -04:00
|
|
|
## [Testing](../testing_guide/frontend_testing.md)
|
|
|
|
|
2017-03-22 15:30:54 -04:00
|
|
|
How we write frontend tests, run the GitLab test suite, and debug test related
|
|
|
|
issues.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## [Design Patterns](design_patterns.md)
|
|
|
|
Common JavaScript design patterns in GitLab's codebase.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## [Vue.js Best Practices](vue.md)
|
|
|
|
Vue specific design patterns and practices.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
2017-11-20 04:57:08 -05:00
|
|
|
## [Axios](axios.md)
|
|
|
|
Axios specific practices and gotchas.
|
2017-10-23 08:07:44 -04:00
|
|
|
|
2017-09-22 04:39:47 -04:00
|
|
|
## [Icons](icons.md)
|
|
|
|
How we use SVG for our Icons.
|
|
|
|
|
2017-11-17 05:57:57 -05:00
|
|
|
## [Dropdowns](dropdowns.md)
|
|
|
|
How we use dropdowns.
|
2017-09-22 04:39:47 -04:00
|
|
|
---
|
|
|
|
|
2017-03-22 15:30:54 -04:00
|
|
|
## Style Guides
|
|
|
|
|
|
|
|
### [JavaScript Style Guide](style_guide_js.md)
|
|
|
|
|
|
|
|
We use eslint to enforce our JavaScript style guides. Our guide is based on
|
|
|
|
the excellent [Airbnb][airbnb-js-style-guide] style guide with a few small
|
|
|
|
changes.
|
|
|
|
|
|
|
|
### [SCSS Style Guide](style_guide_scss.md)
|
|
|
|
|
|
|
|
Our SCSS conventions which are enforced through [scss-lint][scss-lint].
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## [Performance](performance.md)
|
|
|
|
Best practices for monitoring and maximizing frontend performance.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## [Security](security.md)
|
|
|
|
Frontend security practices.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## [Accessibility](accessibility.md)
|
|
|
|
Our accessibility standards and resources.
|
|
|
|
|
2017-10-24 00:16:57 -04:00
|
|
|
## [Internationalization (i18n) and Translations](../i18n/externalization.md)
|
|
|
|
Frontend internationalization support is described in [this document](../i18n/).
|
|
|
|
The [externalization part of the guide](../i18n/externalization.md) explains the helpers/methods available.
|
|
|
|
|
2017-03-22 15:30:54 -04:00
|
|
|
|
|
|
|
[rails]: http://rubyonrails.org/
|
|
|
|
[haml]: http://haml.info/
|
|
|
|
[hamlit]: https://github.com/k0kubun/hamlit
|
|
|
|
[hamlit-limits]: https://github.com/k0kubun/hamlit/blob/master/REFERENCE.md#limitations
|
|
|
|
[scss]: http://sass-lang.com/
|
|
|
|
[babel]: https://babeljs.io/
|
|
|
|
[webpack]: https://webpack.js.org/
|
|
|
|
[jquery]: https://jquery.com/
|
|
|
|
[vue]: http://vuejs.org/
|
|
|
|
[airbnb-js-style-guide]: https://github.com/airbnb/javascript
|
|
|
|
[scss-lint]: https://github.com/brigade/scss-lint
|
|
|
|
[install]: ../../install/installation.md#4-node
|
|
|
|
[requirements]: ../../install/requirements.md#supported-web-browsers
|
2017-04-19 11:16:58 -04:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## [DropLab](droplab/droplab.md)
|
|
|
|
Our internal `DropLab` dropdown library.
|
|
|
|
|
|
|
|
* [DropLab](droplab/droplab.md)
|
|
|
|
* [Ajax plugin](droplab/plugins/ajax.md)
|
|
|
|
* [Filter plugin](droplab/plugins/filter.md)
|
|
|
|
* [InputSetter plugin](droplab/plugins/input_setter.md)
|