Skip to content

Commit e6a282a

Browse files
Claudio ProcidaVilém Jeniš
authored andcommitted
Add linting for insensitive and inconsiderate language (facebookarchive#2223)
Summary: **Summary** This PR, similarly to facebook/react-native-website#1337, adds [alexjs](https://alexjs.com/) linting to Draft.js in order to identify and prevent insensitive and inconsiderate language from landing on master. - Adds Alex - Configures Alex rules - **TODO:** Run Alex in Travis CI **Test Plan** - Run `yarn lint-docs` - Verify there are no lint violations Pull Request resolved: facebookarchive#2223 Differential Revision: D18046996 Pulled By: claudiopro fbshipit-source-id: 66ac935720a0b13576e9a133a3d5f8e98cc539cf
1 parent 6c70f13 commit e6a282a

24 files changed

+1504
-71
lines changed

.alexignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# The Code of Conduct calls out language that can't be used so it's not linted.
2+
CODE_OF_CONDUCT.md
3+
4+
# The CHANGELOG contains references to commit messages.
5+
CHANGELOG.md
6+
7+
# We will handle meeting notes and roadmap documents after the main docs are linted.
8+
meta/meeting-notes/**/*.md
9+
meta/roadmaps/*.md
10+
11+
# This README contains some domain specific language that fails validation.
12+
examples/draft-0-10-0/playground/README.md

.alexrc.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
exports.allow = [
9+
// We frequently refer to form props by their name "disabled".
10+
// Ideally we would alex-ignore only the valid uses (PRs accepted).
11+
"invalid",
12+
13+
// Unfortunately "watchman" is a library name that we depend on.
14+
"watchman-watchwoman"
15+
];
16+
17+
// Use a "maybe" level of profanity instead of the default "unlikely".
18+
exports.profanitySureness = 1;

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Contributing to Draft.js
2-
We want to make contributing to this project as easy and transparent as
2+
We want to make contributing to this project as approachable and transparent as
33
possible.
44

55
## Code of Conduct
@@ -65,7 +65,7 @@ Our philosophy regarding API changes is as follows:
6565
* In order to avoid stagnation we will allow for API changes in cases where
6666
there is no other way to achieve a high priority bug fix or improvement.
6767
* When there is an API change:
68-
* Changes will have a clearly documented reason and migration path
68+
* Changes will have a well documented reason and migration path
6969
* When deprecating a pattern, these steps will be followed:
7070
* We will test the change internally first at FB
7171
* A version will be released that supports both, with deprecation warnings

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ backed by an immutable model.
77

88
- **Extensible and Customizable:** We provide the building blocks to enable
99
the creation of a broad variety of rich text composition experiences, from
10-
simple text styles to embedded media.
10+
basic text styles to embedded media.
1111
- **Declarative Rich Text:** Draft.js fits seamlessly into
1212
[React](http://facebook.github.io/react/) applications,
1313
abstracting away the details of rendering, selection, and input behavior with a
@@ -138,7 +138,7 @@ Further examples of how Draft.js can be used are provided below.
138138

139139
### Examples
140140

141-
Visit http://draftjs.org/ to try out a simple rich editor example.
141+
Visit http://draftjs.org/ to try out a basic rich editor example.
142142

143143
The repository includes a variety of different editor examples to demonstrate
144144
some of the features offered by the framework.

docs/APIReference-Editor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ disabled.
146146

147147
This is useful when supporting interaction within
148148
[custom block components](/docs/advanced-topics-block-components.html)
149-
or if you just want to display content for a static use case.
149+
or if you only want to display content for a static use case.
150150

151151
Default is `false`.
152152

docs/APIReference-EditorState.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ operations.
530530
When performing operations that modify contents, we determine whether the
531531
current `ContentState` should be regarded as a "boundary" state that the user
532532
can reach by performing an undo operation. If so, the `ContentState` is pushed
533-
onto the `undoStack`. If not, the outgoing `ContentState` is simply discarded.
533+
onto the `undoStack`. If not, the outgoing `ContentState` is discarded.
534534
535535
You should not manage this property manually. If you would like to disable
536536
undo/redo behavior, use the `allowUndo` property.

docs/APIReference-Entity.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ for details on updating your application
1616
[see our v0.10 API Migration Guide](/docs/v0-10-api-migration.html#content).
1717

1818
Entity objects returned by `Entity` methods are represented as
19-
[DraftEntityInstance](https://github.com/facebook/draft-js/blob/master/src/model/entity/DraftEntityInstance.js) immutable records. These have a simple set of getter functions and should
19+
[DraftEntityInstance](https://github.com/facebook/draft-js/blob/master/src/model/entity/DraftEntityInstance.js) immutable records. These have a small set of getter functions and should
2020
be used only for retrieval.
2121

2222
## Overview

docs/APIReference-Modifier.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ insertText(
113113
): ContentState
114114
```
115115
Identical to `replaceText`, but enforces that the target range is collapsed
116-
so that no characters are replaced. This is just for convenience, since text
116+
so that no characters are replaced. This is only for convenience, since text
117117
edits are so often insertions rather than replacements.
118118

119119
### moveText
@@ -136,7 +136,7 @@ replaceWithFragment(
136136
fragment: BlockMap
137137
): ContentState
138138
```
139-
A "fragment" is a section of a block map, effectively just an
139+
A "fragment" is a section of a block map, effectively only an
140140
`OrderedMap<string, ContentBlock>` much the same as the full block map of a
141141
`ContentState` object.
142142

docs/Advanced-Topics-Block-Components.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ The recommendation above is especially important for custom block renderers
117117
that involve text input, like the TeX editor example.
118118

119119
It is also worth noting that within the Facebook Notes editor, we have not
120-
tried to perform any special SelectionState rendering or management on embedded
120+
tried to perform any specific SelectionState rendering or management on embedded
121121
media, such as rendering a highlight on an embedded photo when selecting it.
122122
This is in part because of the rich interaction provided on the media
123123
itself, with resize handles and other controls exposed to mouse behavior.

docs/Advanced-Topics-Custom-Block-Render.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class RichEditor extends React.Component {
6565
}
6666
```
6767

68-
There are cases where instead of overwriting the defaults, we just want to add new block types.
68+
There are cases where instead of overwriting the defaults, we only want to add new block types.
6969
This can be done by using the DefaultDraftBlockRenderMap reference to create a new blockRenderMap
7070

7171
*example of extending default block render map:*

0 commit comments

Comments
 (0)