Skip to content

Commit

Permalink
chore: Update prettier & its workflows (#1455)
Browse files Browse the repository at this point in the history
* updating prettier

* prettifying stuff
  • Loading branch information
wuweiweiwu committed Nov 11, 2019
1 parent e5a8d2d commit 7414707
Show file tree
Hide file tree
Showing 19 changed files with 890 additions and 314 deletions.
10 changes: 2 additions & 8 deletions .eslintrc
@@ -1,13 +1,7 @@
{
"parser": "babel-eslint",
"plugins": [
"react"
],
"extends": [
"fbjs",
"eslint:recommended",
"plugin:prettier/recommended"
],
"plugins": ["react"],
"extends": ["fbjs", "eslint:recommended", "plugin:prettier/recommended"],
"rules": {
"no-console": 0
}
Expand Down
1 change: 0 additions & 1 deletion .prettierrc
@@ -1,7 +1,6 @@
{
"bracketSpacing": false,
"jsxBracketSameLine": true,
"parser": "flow",
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all"
Expand Down
626 changes: 436 additions & 190 deletions CHANGELOG.md

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions CODE_OF_CONDUCT.md
Expand Up @@ -23,29 +23,29 @@ Although this list cannot be exhaustive, we explicitly honor diversity and hope

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language.
* Being respectful of differing viewpoints and experiences.
* Gracefully accepting constructive feedback.
* Focusing on what is best for the community.
* Showing empathy and kindness towards other community members.
* Encouraging and raising up your peers in the project so you can all bask in hacks and glory.
- Using welcoming and inclusive language.
- Being respectful of differing viewpoints and experiences.
- Gracefully accepting constructive feedback.
- Focusing on what is best for the community.
- Showing empathy and kindness towards other community members.
- Encouraging and raising up your peers in the project so you can all bask in hacks and glory.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances, including when simulated online. The only exception to sexual topics is channels/spaces specifically for topics of sexual identity.
* Casual mention of slavery or indentured servitude and/or false comparisons of one's occupation or situation to slavery. Please consider using or asking about alternate terminology when referring to such metaphors in technology.
* Making light of/making mocking comments about trigger warnings and content warnings.
* Trolling, insulting/derogatory comments, and personal or political attacks.
* Public or private harassment, deliberate intimidation, or threats.
* Publishing others' private information, such as a physical or electronic address, without explicit permission. This includes any sort of "outing" of any aspect of someone's identity without their consent.
* Publishing private screenshots or quotes of interactions in the context of this project without all quoted users' *explicit* consent.
* Publishing of private communication that doesn't have to do with reporting harrassment.
* Any of the above even when [presented as "ironic" or "joking"](https://en.wikipedia.org/wiki/Hipster_racism).
* Any attempt to present "reverse-ism" versions of the above as violations. Examples of reverse-isms are "reverse racism", "reverse sexism", "heterophobia", and "cisphobia".
* Unsolicited explanations under the assumption that someone doesn't already know it. Ask before you teach! Don't assume what people's knowledge gaps are.
* [Feigning or exaggerating surprise](https://www.recurse.com/manual#no-feigned-surprise) when someone admits to not knowing something.
* "[Well-actuallies](https://www.recurse.com/manual#no-well-actuallys)"
* Other conduct which could reasonably be considered inappropriate in a professional or community setting.
- The use of sexualized language or imagery and unwelcome sexual attention or advances, including when simulated online. The only exception to sexual topics is channels/spaces specifically for topics of sexual identity.
- Casual mention of slavery or indentured servitude and/or false comparisons of one's occupation or situation to slavery. Please consider using or asking about alternate terminology when referring to such metaphors in technology.
- Making light of/making mocking comments about trigger warnings and content warnings.
- Trolling, insulting/derogatory comments, and personal or political attacks.
- Public or private harassment, deliberate intimidation, or threats.
- Publishing others' private information, such as a physical or electronic address, without explicit permission. This includes any sort of "outing" of any aspect of someone's identity without their consent.
- Publishing private screenshots or quotes of interactions in the context of this project without all quoted users' _explicit_ consent.
- Publishing of private communication that doesn't have to do with reporting harrassment.
- Any of the above even when [presented as "ironic" or "joking"](https://en.wikipedia.org/wiki/Hipster_racism).
- Any attempt to present "reverse-ism" versions of the above as violations. Examples of reverse-isms are "reverse racism", "reverse sexism", "heterophobia", and "cisphobia".
- Unsolicited explanations under the assumption that someone doesn't already know it. Ask before you teach! Don't assume what people's knowledge gaps are.
- [Feigning or exaggerating surprise](https://www.recurse.com/manual#no-feigned-surprise) when someone admits to not knowing something.
- "[Well-actuallies](https://www.recurse.com/manual#no-well-actuallys)"
- Other conduct which could reasonably be considered inappropriate in a professional or community setting.

## Scope

Expand All @@ -69,24 +69,24 @@ Once the maintainers get involved, they will follow a documented series of steps

If you experience or witness unacceptable behavior—or have any other concerns—please report it by contacting us via the following methods:

* Through email:
* [brian.david.vaughn@gmail.com](mailto:brian.david.vaughn@gmail.com) (Brian Vaughn)
* [amarkon895@gmail.com](mailto:amarkon895@gmail.com) (Adam Markon)
- Through email:
- [brian.david.vaughn@gmail.com](mailto:brian.david.vaughn@gmail.com) (Brian Vaughn)
- [amarkon895@gmail.com](mailto:amarkon895@gmail.com) (Adam Markon)

All reports will be handled with discretion. In your report please include:

* Your contact information.
* Names (real, nicknames, or pseudonyms) of any individuals involved. If there are additional witnesses, please include them as well. Your account of what occurred, and if you believe the incident is ongoing. If there is a publicly available record (e.g. a mailing list archive or a public IRC logger), please include a link.
* Any additional information that may be helpful.
- Your contact information.
- Names (real, nicknames, or pseudonyms) of any individuals involved. If there are additional witnesses, please include them as well. Your account of what occurred, and if you believe the incident is ongoing. If there is a publicly available record (e.g. a mailing list archive or a public IRC logger), please include a link.
- Any additional information that may be helpful.

### Further Enforcement

If you've already followed the [initial enforcement steps](#enforcement), these are the steps maintainers will take for further enforcement, as needed:

1. Repeat the request to stop.
2. If the person doubles down, they will have offending messages removed or edited by a maintainers given an official warning. The PR or Issue may be locked.
3. If the behavior continues or is repeated later, the person will be blocked from participating for 24 hours.
4. If the behavior continues or is repeated after the temporary block, a long-term (6-12mo) ban will be used.
1. Repeat the request to stop.
2. If the person doubles down, they will have offending messages removed or edited by a maintainers given an official warning. The PR or Issue may be locked.
3. If the behavior continues or is repeated later, the person will be blocked from participating for 24 hours.
4. If the behavior continues or is repeated after the temporary block, a long-term (6-12mo) ban will be used.

On top of this, maintainers may remove any offending messages, images, contributions, etc, as they deem necessary.

Expand Down Expand Up @@ -116,7 +116,7 @@ The vast majority of situations work out like this. This interaction is common,

Sometimes, though, you need to get maintainers involved. Maintainers will do their best to resolve conflicts, but people who were harmed by something **will take priority**.

> Patt: "Honestly, sometimes I just really hate using $library and anyone who uses it probably sucks at their job."
> Patt: "Honestly, sometimes I just really hate using \$library and anyone who uses it probably sucks at their job."
> Alex: "Whoa there, could you dial it back a bit? There's a CoC thing about attacking folks' tech use like that."
Expand All @@ -132,7 +132,7 @@ Sometimes, though, you need to get maintainers involved. Maintainers will do the
> Patt: "@keeperofbits Okay sorry. I'm just frustrated and I'm kinda burnt out and I guess I got carried away. I'll DM Alex a note apologizing and edit my messages. Sorry for the trouble."
> KeeperOfCommitBits: "@patt Thanks for that. I hear you on the stress. Burnout sucks :/. Have a good one!"
> KeeperOfCommitBits: "@patt Thanks for that. I hear you on the stress. Burnout sucks :/. Have a good one!"
#### The Nope Case

Expand Down
15 changes: 9 additions & 6 deletions CONTRIBUTING.md
Expand Up @@ -11,10 +11,11 @@ In return, they should reciprocate that respect in addressing your issue or asse

The issue tracker is the preferred channel for bug reports but please respect the following restrictions:

* Please **do not** use the issue tracker for personal support requests (use [Slack](https://react-virtualized.now.sh)).
* Please **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others.
- Please **do not** use the issue tracker for personal support requests (use [Slack](https://react-virtualized.now.sh)).
- Please **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others.

<a name="bugs"></a>

## Bug reports

A bug is a _demonstrable problem_ that is caused by the code in the repository.
Expand Down Expand Up @@ -50,17 +51,17 @@ Example:
> This might include the lines of code that you have identified as causing the bug,
> and potential solutions (and your opinions on their merits).

<a name="features"></a>

## Feature requests

Feature requests are welcome.
But take a moment to find out whether your idea fits with the scope and aims of the project.
It's up to *you* to make a strong case to convince the project's developers of the merits of this feature.
It's up to _you_ to make a strong case to convince the project's developers of the merits of this feature.
Please provide as much detail and context as possible.


<a name="pull-requests"></a>

## Pull requests

Good pull requests - patches, improvements, new features - are a fantastic help.
Expand Down Expand Up @@ -123,11 +124,12 @@ Follow this process if you'd like your work considered for inclusion in the proj
```

8. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
with a clear title and description.
with a clear title and description.

**IMPORTANT**: By submitting a patch, you agree to allow the project owner to license your work under the same license as that used by this project (MIT).

<a name="running-local-demo"></a>

## Running Local Demo

You can run the local demo with NPM like so:
Expand All @@ -140,6 +142,7 @@ yarn start
The local app will then be available at http://localhost:3001

<a name="running-tests"></a>

## Running Tests

All unit tests must pass before a pull request will be approved.
Expand Down
17 changes: 8 additions & 9 deletions package.json
Expand Up @@ -37,14 +37,12 @@
"test:jest": "jest --no-watchman --runInBand",
"test:ci": "jest --no-watchman --maxWorkers 2 --coverage && codecov",
"watch": "watch 'clear && npm run test -s' source",
"watch:jest": "jest --no-watchman --watch",
"precommit": "lint-staged"
"watch:jest": "jest --no-watchman --watch"
},
"lint-staged": {
"*.{js,md}": [
"prettier --write",
"git add"
]
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"babel": {
"presets": [
Expand Down Expand Up @@ -139,15 +137,16 @@
"flow-copy-source": "^1.2.1",
"gh-pages": "^1.0.0",
"html-webpack-plugin": "^2.30.1",
"husky": "^0.14.3",
"husky": "^3.0.9",
"immutable": "^3.7.5",
"jest": "^22.0.4",
"jest-environment-puppeteer": "^1.1.1",
"lint-staged": "^7.0.4",
"postcss": "^6.0.14",
"postcss-cli": "^4.1.1",
"postcss-loader": "^2.0.9",
"prettier": "^1.9.2",
"prettier": "1.19.1",
"pretty-quick": "^2.0.1",
"puppeteer": "^1.1.1",
"react": "^16.2.0",
"react-codemirror": "^1.0.0",
Expand Down
8 changes: 4 additions & 4 deletions source/ArrowKeyStepper/ArrowKeyStepper.example.js
Expand Up @@ -59,7 +59,7 @@ export default class ArrowKeyStepperExample extends React.PureComponent<
<strong>mode</strong>:
<label>
<input
aria-label="Set mode equal to &quot;cells&quot;"
aria-label='Set mode equal to "cells"'
checked={mode === 'cells'}
className={styles.Radio}
type="radio"
Expand All @@ -72,7 +72,7 @@ export default class ArrowKeyStepperExample extends React.PureComponent<
</label>
<label>
<input
aria-label="Set mode equal to &quot;edges&quot;"
aria-label='Set mode equal to "edges"'
checked={mode === 'edges'}
className={styles.Radio}
type="radio"
Expand Down Expand Up @@ -146,11 +146,11 @@ export default class ArrowKeyStepperExample extends React.PureComponent<
}

_getColumnWidth = ({index}: {index: number}) => {
return (1 + index % 3) * 60;
return (1 + (index % 3)) * 60;
};

_getRowHeight = ({index}: {index: number}) => {
return (1 + index % 3) * 30;
return (1 + (index % 3)) * 30;
};

_cellRenderer = ({
Expand Down
Expand Up @@ -48,7 +48,7 @@ export default class DynamicHeightList extends React.PureComponent {
const classNames = getClassName({columnIndex: 0, rowIndex: index});

const imageWidth = 300;
const imageHeight = datum.size * (1 + index % 3);
const imageHeight = datum.size * (1 + (index % 3));

const source = `https://www.fillmurray.com/${imageWidth}/${imageHeight}`;

Expand Down
4 changes: 1 addition & 3 deletions source/Collection/utils/calculateSizeAndPositionData.js
Expand Up @@ -25,9 +25,7 @@ export default function calculateSizeAndPositionData({
) {
throw Error(
`Invalid metadata returned for cell ${index}:
x:${cellMetadatum.x}, y:${cellMetadatum.y}, width:${
cellMetadatum.width
}, height:${cellMetadatum.height}`,
x:${cellMetadatum.x}, y:${cellMetadatum.y}, width:${cellMetadatum.width}, height:${cellMetadatum.height}`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion source/Grid/Grid.jest.js
Expand Up @@ -2452,7 +2452,7 @@ describe('Grid', () => {
height: 100,
rowHeight: 100,
columnWidth: 100,
rowCount: getMaxElementSize() * 2 / 100, // lots of offset
rowCount: (getMaxElementSize() * 2) / 100, // lots of offset
scrollTop: 2000,
}),
);
Expand Down
3 changes: 2 additions & 1 deletion source/Grid/Grid.js
Expand Up @@ -736,7 +736,8 @@ class Grid extends React.PureComponent<Props, State> {
// So we should always recalculate offset afterwards.
const sizeJustIncreasedFromZero =
(prevProps.width === 0 || prevProps.height === 0) &&
(height > 0 && width > 0);
height > 0 &&
width > 0;

// Update scroll offsets if the current :scrollToColumn or :scrollToRow values requires it
// @TODO Do we also need this check or can the one in componentWillUpdate() suffice?
Expand Down
8 changes: 2 additions & 6 deletions source/Grid/index.js
Expand Up @@ -13,10 +13,6 @@ export type {

export {default} from './Grid';
export {default as Grid} from './Grid';
export {
default as accessibilityOverscanIndicesGetter,
} from './accessibilityOverscanIndicesGetter';
export {default as accessibilityOverscanIndicesGetter} from './accessibilityOverscanIndicesGetter';
export {default as defaultCellRangeRenderer} from './defaultCellRangeRenderer';
export {
default as defaultOverscanIndicesGetter,
} from './defaultOverscanIndicesGetter';
export {default as defaultOverscanIndicesGetter} from './defaultOverscanIndicesGetter';
4 changes: 3 additions & 1 deletion source/List/List.example.js
Expand Up @@ -223,7 +223,9 @@ export default class ListExample extends React.PureComponent {
case 100:
additionalContent = (
<div>
It is large-sized.<br />It has a 3rd row.
It is large-sized.
<br />
It has a 3rd row.
</div>
);
break;
Expand Down
6 changes: 3 additions & 3 deletions source/Masonry/Masonry.js
Expand Up @@ -238,9 +238,9 @@ class Masonry extends React.PureComponent<Props, State> {
const batchSize = Math.min(
cellCount - measuredCellCount,
Math.ceil(
(scrollTop + height + overscanByPixels - shortestColumnSize) /
cellMeasurerCache.defaultHeight *
width /
(((scrollTop + height + overscanByPixels - shortestColumnSize) /
cellMeasurerCache.defaultHeight) *
width) /
cellMeasurerCache.defaultWidth,
),
);
Expand Down

0 comments on commit 7414707

Please sign in to comment.