Skip to content

Commit

Permalink
Merge branch 'main' into eb-add-language-guidance
Browse files Browse the repository at this point in the history
* main:
  Expand the stack to include client-side frameworks
  Add HTML validation best practice (#588)
  Wrap in code to be consistent with line above’s factories.rb (#625)
  Remove the deprecated jscs configuration (#622)
  Restore Rubocop & Hound configuration (#623)
  Prefer MVVM on Android
  Update our Android best practices
  Added def tags to Data Glossary (#620)
  Fix typo in function components URL (#624)
  Fix broken link
  Ensure that guides have consistent formatting (#618)
  Combine style, best practice, and protocol guides (#615)
  Remove private/protected style guideline
  Rename Testing guide to Testing with RSpec (#614)
  Add back .rubocop.yml

# Conflicts:
#	README.md
  • Loading branch information
ericwbailey committed Oct 24, 2020
2 parents 23327b0 + 0668479 commit 93db0ad
Show file tree
Hide file tree
Showing 118 changed files with 3,168 additions and 2,404 deletions.
11 changes: 4 additions & 7 deletions .hound.yml
Expand Up @@ -2,22 +2,19 @@ coffeescript:
enabled: false
eslint:
enabled: true
config_file: style/javascript/.eslintrc.json
config_file: javascript/.eslintrc.json
version: 6.3.0
haml:
enabled: true
config_file: style/haml/haml.yml
config_file: haml/haml.yml
javascript:
enabled: false
jscs:
enabled: true
config_file: style/javascript/.jscsrc
rubocop:
enabled: true
config_file: style/ruby/.rubocop.yml
config_file: ruby/.rubocop.yml
version: 0.72.0
scss:
enabled: false
stylelint:
enabled: true
config_file: style/sass/.stylelintrc.json
config_file: sass/.stylelintrc.json
6 changes: 3 additions & 3 deletions CODE_OF_CONDUCT.md
@@ -1,6 +1,6 @@
# Code of Conduct

By participating in this project, you agree to abide by the
[thoughtbot code of conduct][tb-coc].
By participating in this project, you agree to abide by the [thoughtbot code of
conduct].

[tb-coc]: https://thoughtbot.com/open-source-code-of-conduct
[thoughtbot code of conduct]: https://thoughtbot.com/open-source-code-of-conduct
18 changes: 12 additions & 6 deletions CONTRIBUTING.md
@@ -1,12 +1,12 @@
# Contributing

We love contributions from everyone. By participating in this project, you
agree to abide by the [thoughtbot code of conduct][tb-coc].
We love contributions from everyone. By participating in this project, you agree
to abide by the [thoughtbot Code Of Conduct].

We expect everyone to follow the code of conduct anywhere in thoughtbot's
project codebases, issue trackers, chatrooms, and mailing lists.

[tb-coc]: https://thoughtbot.com/open-source-code-of-conduct
[thoughtbot code of conduct]: https://thoughtbot.com/open-source-code-of-conduct

## Getting Feedback

Expand All @@ -16,7 +16,13 @@ least a week to get feedback from everyone.

## Content

Decisions about which libraries to use should live in template projects such
as [Suspenders].
Decisions about which libraries to use should live in template projects such as
[Suspenders].

[Suspenders]: https://github.com/thoughtbot/suspenders
[suspenders]: https://github.com/thoughtbot/suspenders

### The Anatomy of a Guide

Whether you're creating a new guide or adding to an existing one, you can
reference [the template guide](/_template/) if you're unsure where to put
things.
102 changes: 93 additions & 9 deletions README.md
@@ -1,8 +1,8 @@
Guides
======
# Guides

[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)

<<<<<<< HEAD
Guides for getting things done, programming well, and programming in style.

* [Best Practices](./best-practices)
Expand Down Expand Up @@ -42,23 +42,107 @@ Contributing
------------

Please read the [contribution guidelines] before submitting a pull request.
=======
Guides for working together, getting things done, programming well, and
programming in style.

## High level guidelines

- Be consistent.
- Don't rewrite existing code to follow this guide.
- Don't violate a guideline without a good reason.
- A reason is good when you can convince a teammate.

## A note on the language

- "Avoid" means don't do it unless you have good reason.
- "Don't" means there's never a good reason.
- "Prefer" indicates a better option and its alternative to watch out for.
- "Use" is a positive instruction.

## Guides by category

- [thoughtbot Tech Stack](/tech-stack/)
- [General](/general/)

### Collaboration

- [Code Review](/code-review/)
- [Communication](/communication/)
- [Inclusive Culture](/inclusive-culture/)
- [Open Source](/open-source/)
- [Product Review](/product-review/)
- [Working Together](/working-together/)

### Protocols

- [Accessibility](/accessibility/)
- [Data](/data/)
- [Email](/email/)
- [Object-Oriented Design](/object-oriented-design/)
- [Security](/security/)
- [Web](/web/)
- [Web Performance](/web-performance/)

### Languages

- [Bash](/bash/)
- [CoffeeScript](/coffeescript/)
- [CSS](/css/)
- [Elixir](/elixir/)
- [ERB](/erb/)
- [HAML](/haml/)
- [Handlebars](/handlebars/)
- [Haskell](/haskell/)
- [HTML](/html/)
- [Java](/java/)
- [JavaScript](/javascript/)
- [Objective-C](/objective-c/)
- [Python](/python/)
- [Ruby](/ruby/)
- [Sass](/sass/)
- [Scala](/scala/)
- [Shell](/shell/)
- [Swift](/swift/)
- [TypeScript](/typescript/)

### Frameworks and platforms

- [Android](/android/)
- [Angular](/angular/)
- [Ember](/ember/)
- [iOS](/ios/)
- [Rails](/rails/)
- [React](/react/)
- [Testing with Jest](/testing-jest/)
- [Testing with RSpec](/testing-rspec/)

### Tools

- [Git](/git/)
- [GraphQL](/graphql/)
- [Postgres](/postgres/)
- [Relational Databases](/relational-databases/)

## Contributing

Please read the [contribution guidelines](/CONTRIBUTING.md) before submitting a
pull request.
>>>>>>> main
In particular: **if you have commit access, please don't merge changes without
waiting a week for everybody to leave feedback**.

[contribution guidelines]: /CONTRIBUTING.md
## Credits

Credits
-------

Thank you, [contributors](https://github.com/thoughtbot/guides/graphs/contributors)!
Thank you,
[contributors](https://github.com/thoughtbot/guides/graphs/contributors)!

![thoughtbot](http://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg)

Guides is maintained by [thoughtbot, inc](https://thoughtbot.com).

License
-------
## License

Guides is © 2020 thoughtbot, inc. It is distributed under the [Creative Commons
Attribution License](http://creativecommons.org/licenses/by/3.0/).
Expand Down
28 changes: 28 additions & 0 deletions _template/README.md
@@ -0,0 +1,28 @@
# Template

In a sentence or two, describe what this guide is about. A guide can be about a
programming language or framework, a design or development tool, or an entirely
non-technical topic.

## Best Practices

In this section (or as many sections as you need) convey the best practices
around the topic of the guide.

This typically takes one of three forms:

1. A section or sections with lists of specific
[guidelines](/README.md#a-note-on-the-language)
2. Primarily textual sections
3. A combination of both

## How to...

This section, if applicable, should index a list of "How-to" guides for this
guide's topic. These should be stored relative to this `README.md` file in a
folder named `how-to`.

Here are some examples:

- [Do something](./how-to/do-something.md)
- [Do something else](./how-to/do-something-else.md)
3 changes: 3 additions & 0 deletions _template/how-to/do-something-else.md
@@ -0,0 +1,3 @@
## How to Do Something Else

This is an example how-to guide. Write anything you want here!
3 changes: 3 additions & 0 deletions _template/how-to/do-something.md
@@ -0,0 +1,3 @@
## How to Do Something

This is an example how-to guide. Write anything you want here!
123 changes: 123 additions & 0 deletions accessibility/README.md
@@ -0,0 +1,123 @@
# Accessibility

A guide for auditing and maintaining accessible web sites and apps.

## Basics

thoughtbot strives for AA level [Web Content Accessibility Guideline (WCAG)]
compliance. Perform one or more of these checks to ensure your work is
accessible.

### Automation

Automated checks can catch a lot of common issues before they reach production.

- Use tools such as [WAVE] or [axe's browser extensions] to run audits on your
local build
- Use a CI/CD solution such as [AccessLint] or [axe]

### Usability

[Manual usability testing] ensures things work as intended.

- Test your local build using a screen reader such as [VoiceOver] or [NVDA]
- Use tools such as [Accessibility Insights] to catch issues that cannot be
found using automated checks
- Hire assistive technology users to user test your product

## Quick checks

### Design

- Ensure all content's foreground color values meet the [minimum contrast ratio]
for the background color they are placed over
- Ensure all interactive content has distinct hover and focus states to help
indicate interactivity
- Ensure color is not the only way to determine meaning
- Ensure interactive components use common UI affordances where applicable, to
help users understand how they can be operated
- Prefer icons and glyphs that don't rely on specialized knowledge to understand
their meaning, unless being used in a domain-specific context
- Prefer language that is [simple and direct]
- Ensure form inputs have labels that are visible in every state
- Ensure link and button text is descriptive and distinct
- Prefer content that is broken into logical sections, with headings that
explain the content that follows
- Prefer text sizing that is set to 16px or larger
- Ensure animation does not auto-play, can be paused, and avoids [vestibular and
seizure triggers]
- Ensure video content has captions
- Prefer larger interactive target sizes, with some space between grouped
interactive controls

### Development

- Ensure semantic markup is used to describe content
- Ensure content does not disappear off the screen when zoomed
- Ensure that interactive content can be tabbed to and activated using the
keyboard, and that the tab order matches reading order
- Ensure that heading elements are used, and that heading levels are placed in a
logical order
- Ensure that landmarks are used to describe the overall layout of the page or
view
- Ensure that alternative descriptions for image content are concise,
descriptive, and use punctuation (`alt` attributes for images, `title`
elements for SVGs)
- Ensure labels are programmatically associated with their inputs
- Prefer implementing a method to allow users to skip sections of repeated
content
- Ensure each page or view has a unique title that describes the content it
contains
- The `title` attribute is only used to describe `iframe` element contents
- Ensure that links are used to navigate to other locations and buttons are used
to trigger actions
- Ensure that focus is trapped inside of modal interactions
- Ensure `fieldset` and `legend` elements are used to group related inputs and
label them
- Ensure form feedback messaging is programmatically associated with the
relevant inputs

## Full audit

When at all possible, use the guidelines in the basics and quick check sections
to attempt to address accessibility in a proactive way.

If a thorough analysis needs to be performed, use the following workflow to
perform a comprehensive accessibility audit that checks against most WCAG
criterion:

1. Create a copy of the [Accessibility Audit Template] spreadsheet in Google
Drive
1. Break apart the site or app to be audited into discrete user flow sections,
ordered by importance
1. Add yourself as the section lead on the audit template, document the relevant
URL and date, and set a status
1. For each user flow, identify each component that enables the user flow to
function
1. For each component, check against the test criteria for each row, and then
assign it one of four ratings:
- **N/A**: This test does not apply to this component
- **Pass**: This component meets this test's criteria
- **Moderate**: This component does not meet this test's criteria, but can
worked around
- **Critical**: This component does not meet this test's criteria, and cannot
be worked around
1. Once a component is completed, update its status
1. Continue until all user flows have been audited

Use the Notes sheet to leave per-cell comments when necessary, referencing them
with a link. The next steps for an audit are handled on a per-project basis.

[accessibility audit template]: https://docs.google.com/spreadsheets/d/1Ys-0U5BY-Ct_phy7gk9XJmn4nBTMFTh08aTQ6U1kB_4/edit?usp=sharing
[accesslint]: https://github.com/marketplace/accesslint
[axe]: https://www.deque.com/axe/axe-for-web/integrations/
[axe's browser extensions]: https://www.deque.com/axe/axe-for-web/
[minimum contrast ratio]: https://webaim.org/resources/linkcontrastchecker/
[manual usability testing]: https://www.smashingmagazine.com/2018/09/importance-manual-accessibility-testing/
[nvda]: https://a11yproject.com/posts/getting-started-with-nvda/
[accessibility insights]: https://accessibilityinsights.io
[simple and direct]: https://datayze.com/readability-analyzer.php
[vestibular and seizure triggers]: https://alistapart.com/article/designing-safer-web-animation-for-motion-sensitivity/
[voiceover]: https://a11yproject.com/posts/getting-started-with-voiceover/
[wave]: https://wave.webaim.org/extension/
[web content accessibility guideline (wcag)]: https://www.w3.org/WAI/standards-guidelines/wcag/
12 changes: 12 additions & 0 deletions android/README.md
@@ -0,0 +1,12 @@
# Android

- Properties of views should be alphabetized, with the exception of `id`,
`layout_width`, and `layout_height` which should be placed first in that
order.
- Use Kotlin for all new code.
- Prefer pull request reviews from other Android developers but be open to
reviews from iOS and React Native developers as well.
- Prefer non-null types.
- Use string resources for all user-visible text.
- Prefer vector drawables over PNGs or JPEGs.
- Prefer Model-View-ViewModel (MVVM) for your app architecture.
File renamed without changes.
14 changes: 14 additions & 0 deletions angular/README.md
@@ -0,0 +1,14 @@
# Angular

- [Avoid manual dependency annotations]. Disable mangling or use a pre-processor
such as [ngannotate] for annotations.
- Prefer `factory` to `service`. If you desire a singleton, wrap the singleton
class in a factory function and return a new instance of that class from the
factory.
- Prefer the `translate` directive to the `translate` filter for [performance
reasons].
- Don't use the `jQuery` or `$` global. Access jQuery via `angular.element`.

[avoid manual dependency annotations]: http://robots.thoughtbot.com/avoid-angularjs-dependency-annotation-with-rails
[ngannotate]: https://github.com/kikonen/ngannotate-rails
[performance reasons]: https://github.com/angular-translate/angular-translate/wiki/Getting-Started#using-translate-directive
9 changes: 9 additions & 0 deletions bash/README.md
@@ -0,0 +1,9 @@
# Bash

In addition to [shell](/shell/) best practices:

- Prefer `${var,,}` and `${var^^}` over `tr` for changing case.
- Prefer `${var//from/to}` over `sed` for simple string replacements.
- Prefer `[[` over `test` or `[`.
- Prefer process substitution over a pipe in `while read` loops.
- Use `((` or `let`, not `$((` when you don't need the result

0 comments on commit 93db0ad

Please sign in to comment.