Skip to content

Commit

Permalink
Add linting for insensitive and inconsiderate language (facebook#1337)
Browse files Browse the repository at this point in the history
* Add linting for insensitive and inconsiderate language

* Add .alexrc.js

* Update alex rules

* Minor updates to formatting

* Fix deploy_website job name

* Update alex rules

* Add lintv and .alexignore

* Fix lint issues
  • Loading branch information
rickhanlonii authored Oct 14, 2019
1 parent 9fa2e4a commit 0c9962b
Show file tree
Hide file tree
Showing 71 changed files with 1,676 additions and 218 deletions.
69 changes: 69 additions & 0 deletions .alexignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# The Code of Conduct calls out language that can't be used so it's not linted.
CODE_OF_CONDUCT.md

# We will handle the blog posts after the main docs are linted.
website/blog/

# The version docs are actively being linted.
# If you want to lint one of these directories, remove it from the list here and then run:
# `yarn lintv website/versioned_docs/version-{version number}/`
# Once you fix all of the errors, commit all of the changes including this file.
#
# To be considerate to the reviewer, please submit each version in different PRs.
website/versioned_docs/version-0.5/
website/versioned_docs/version-0.6/
website/versioned_docs/version-0.7/
website/versioned_docs/version-0.8/
website/versioned_docs/version-0.9/
website/versioned_docs/version-0.10/
website/versioned_docs/version-0.11/
website/versioned_docs/version-0.12/
website/versioned_docs/version-0.13/
website/versioned_docs/version-0.14/
website/versioned_docs/version-0.15/
website/versioned_docs/version-0.16/
website/versioned_docs/version-0.17/
website/versioned_docs/version-0.18/
website/versioned_docs/version-0.19/
website/versioned_docs/version-0.20/
website/versioned_docs/version-0.21/
website/versioned_docs/version-0.22/
website/versioned_docs/version-0.23/
website/versioned_docs/version-0.24/
website/versioned_docs/version-0.25/
website/versioned_docs/version-0.26/
website/versioned_docs/version-0.27/
website/versioned_docs/version-0.28/
website/versioned_docs/version-0.29/
website/versioned_docs/version-0.30/
website/versioned_docs/version-0.31/
website/versioned_docs/version-0.32/
website/versioned_docs/version-0.33/
website/versioned_docs/version-0.34/
website/versioned_docs/version-0.35/
website/versioned_docs/version-0.36/
website/versioned_docs/version-0.37/
website/versioned_docs/version-0.38/
website/versioned_docs/version-0.39/
website/versioned_docs/version-0.40/
website/versioned_docs/version-0.41/
website/versioned_docs/version-0.42/
website/versioned_docs/version-0.43/
website/versioned_docs/version-0.44/
website/versioned_docs/version-0.45/
website/versioned_docs/version-0.46/
website/versioned_docs/version-0.47/
website/versioned_docs/version-0.48/
website/versioned_docs/version-0.49/
website/versioned_docs/version-0.50/
website/versioned_docs/version-0.51/
website/versioned_docs/version-0.52/
website/versioned_docs/version-0.53/
website/versioned_docs/version-0.54/
website/versioned_docs/version-0.55/
website/versioned_docs/version-0.56/
website/versioned_docs/version-0.57/
website/versioned_docs/version-0.58/
website/versioned_docs/version-0.59/
website/versioned_docs/version-0.60/
website/versioned_docs/version-0.61/
18 changes: 18 additions & 0 deletions .alexrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

exports.allow = [
// We frequently refer to form props by their name "disabled".
// Ideally we would alex-ignore only the valid uses (PRs accepted).
"invalid",

// Unfortunately "watchman" is a library name that we depend on.
"watchman-watchwoman"
];

// Use a "maybe" level of profanity instead of the default "unlikely".
exports.profanitySureness = 1;
26 changes: 21 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ jobs:
- ~/react-native-website

# --------------------------------------------------
# JOB: test_website
# Test website can be built and has no lint issues.
# JOB: test
# Test that the website can be built.
# --------------------------------------------------
test_website:
test:
executor: node8
working_directory: ~/react-native-website/website
steps:
Expand All @@ -67,6 +67,17 @@ jobs:
if [ ! -f build/react-native/index.html ]; then
exit 1;
fi
# --------------------------------------------------
# JOB: lint
# Lint the docs.
# --------------------------------------------------
language_lint:
executor: node8
working_directory: ~/react-native-website/website
steps:
- restore_cache_checkout
- run_yarn
- run: yarn lint

# --------------------------------------------------
# JOB: deploy_website
Expand Down Expand Up @@ -101,8 +112,13 @@ workflows:
jobs:
- setup

# Test website
- test_website:
# Run tests
- test:
requires:
- setup

# Run lints
- language_lint:
requires:
- setup

Expand Down
4 changes: 2 additions & 2 deletions docs/accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ In the above example, the `accessibilityLabel` on the TouchableOpacity element w

#### accessibilityHint (iOS, Android)

An accessibility hint helps users understand what will happen when they perform an action on the accessibility element when that result is not obvious from the accessibility label.
An accessibility hint helps users understand what will happen when they perform an action on the accessibility element when that result is not clear from the accessibility label.

To use, set the `accessibilityHint` property to a custom string on your View, Text or Touchable:

Expand Down Expand Up @@ -185,7 +185,7 @@ In the case of two overlapping UI components with the same parent, default acces
</View>
```

In the above example, the yellow layout and its descendants are completely invisible to TalkBack and all other accessibility services. So we can easily use overlapping views with the same parent without confusing TalkBack.
In the above example, the yellow layout and its descendants are completely invisible to TalkBack and all other accessibility services. So we can use overlapping views with the same parent without confusing TalkBack.

### Accessibility Actions

Expand Down
16 changes: 8 additions & 8 deletions docs/animated.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ id: animated
title: Animated
---

The `Animated` library is designed to make animations fluid, powerful, and easy to build and maintain. `Animated` focuses on declarative relationships between inputs and outputs, with configurable transforms in between, and simple `start`/`stop` methods to control time-based animation execution.
The `Animated` library is designed to make animations fluid, powerful, and painless to build and maintain. `Animated` focuses on declarative relationships between inputs and outputs, with configurable transforms in between, and `start`/`stop` methods to control time-based animation execution.

The simplest workflow for creating an animation is to create an `Animated.Value`, hook it up to one or more style attributes of an animated component, and then drive updates via animations using `Animated.timing()`:
The most basic workflow for creating an animation is to create an `Animated.Value`, hook it up to one or more style attributes of an animated component, and then drive updates via animations using `Animated.timing()`:

```jsx
Animated.timing(
Expand Down Expand Up @@ -33,7 +33,7 @@ There are two value types you can use with `Animated`:
`Animated` provides three types of animation types. Each animation type provides a particular animation curve that controls how your values animate from their initial value to the final value:

- [`Animated.decay()`](animated.md#decay) starts with an initial velocity and gradually slows to a stop.
- [`Animated.spring()`](animated.md#spring) provides a simple spring physics model.
- [`Animated.spring()`](animated.md#spring) provides a basic spring physics model.
- [`Animated.timing()`](animated.md#timing) animates a value over time using [easing functions](easing.md).

In most cases, you will be using `timing()`. By default, it uses a symmetric easeInOut curve that conveys the gradual acceleration of an object to full speed and concludes by gradually decelerating to a stop.
Expand All @@ -50,7 +50,7 @@ You can use the native driver by specifying `useNativeDriver: true` in your anim

### Animatable components

Only animatable components can be animated. These special components do the magic of binding the animated values to the properties, and do targeted native updates to avoid the cost of the react render and reconciliation process on every frame. They also handle cleanup on unmount so they are safe by default.
Only animatable components can be animated. These unique components do the magic of binding the animated values to the properties, and do targeted native updates to avoid the cost of the react render and reconciliation process on every frame. They also handle cleanup on unmount so they are safe by default.

- [`createAnimatedComponent()`](animated.md#createanimatedcomponent) can be used to make a component animatable.

Expand All @@ -72,7 +72,7 @@ Animations can also be combined in complex ways using composition functions:
- [`Animated.sequence()`](animated.md#sequence) starts the animations in order, waiting for each to complete before starting the next.
- [`Animated.stagger()`](animated.md#stagger) starts animations in order and in parallel, but with successive delays.

Animations can also be chained together simply by setting the `toValue` of one animation to be another `Animated.Value`. See [Tracking dynamic values](animations.md#tracking-dynamic-values) in the Animations guide.
Animations can also be chained together by setting the `toValue` of one animation to be another `Animated.Value`. See [Tracking dynamic values](animations.md#tracking-dynamic-values) in the Animations guide.

By default, if one animation is stopped or interrupted, then all other animations in the group are also stopped.

Expand Down Expand Up @@ -169,14 +169,14 @@ Config is an object that may have the following options.

Note that you can only define one of bounciness/speed, tension/friction, or stiffness/damping/mass, but not more than one:

The friction/tension or bounciness/speed options match the spring model in [Facebook Pop](https://github.com/facebook/pop), [Rebound](http://facebook.github.io/rebound/), and [Origami](http://origami.design/).
The friction/tension or bounciness/speed options match the spring model in [`Facebook Pop`](https://github.com/facebook/pop), [Rebound](http://facebook.github.io/rebound/), and [Origami](http://origami.design/).

- `friction`: Controls "bounciness"/overshoot. Default 7.
- `tension`: Controls speed. Default 40.
- `speed`: Controls speed of the animation. Default 12.
- `bounciness`: Controls bounciness. Default 8.

Specifying stiffness/damping/mass as parameters makes `Animated.spring` use an analytical spring model based on the motion equations of a [damped harmonic oscillator](https://en.wikipedia.org/wiki/Harmonic_oscillator#Damped_harmonic_oscillator). This behavior is slightly more precise and faithful to the physics behind spring dynamics, and closely mimics the implementation in iOS's CASpringAnimation primitive.
Specifying stiffness/damping/mass as parameters makes `Animated.spring` use an analytical spring model based on the motion equations of a [damped harmonic oscillator](https://en.wikipedia.org/wiki/Harmonic_oscillator#Damped_harmonic_oscillator). This behavior is slightly more precise and faithful to the physics behind spring dynamics, and closely mimics the implementation in iOS's CASpringAnimation.

- `stiffness`: The spring stiffness coefficient. Default 100.
- `damping`: Defines how the spring’s motion should be damped due to the forces of friction. Default 10.
Expand Down Expand Up @@ -344,7 +344,7 @@ Config is an object that may have the following options:
static forkEvent(event, listener)
```
Advanced imperative API for snooping on animated events that are passed in through props. It permits to add a new javascript listener to an existing `AnimatedEvent`. If `animatedEvent` is a simple javascript listener, it will merge the 2 listeners into a single one, and if `animatedEvent` is null/undefined, it will assign the javascript listener directly. Use values directly where possible.
Advanced imperative API for snooping on animated events that are passed in through props. It permits to add a new javascript listener to an existing `AnimatedEvent`. If `animatedEvent` is a javascript listener, it will merge the 2 listeners into a single one, and if `animatedEvent` is null/undefined, it will assign the javascript listener directly. Use values directly where possible.
---
Expand Down
Loading

0 comments on commit 0c9962b

Please sign in to comment.