mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge branch 'master' into rollup
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
3. If you've changed APIs, update the documentation.
|
||||
4. Ensure the test suite passes (`npm test`).
|
||||
5. Make sure your code lints (`npm run lint`).
|
||||
6. Run the [Flow](https://flowtype.org/) typechecks (`npm run flow`).
|
||||
7. If you added or removed any tests, run `./scripts/fiber/record-tests` before submitting the pull request, and commit the resulting changes.
|
||||
8. If you haven't already, complete the [CLA](https://code.facebook.com/cla).
|
||||
6. Format your code with [prettier](https://github.com/prettier/prettier) (`npm run prettier`).
|
||||
7. Run the [Flow](https://flowtype.org/) typechecks (`npm run flow`).
|
||||
8. If you added or removed any tests, run `./scripts/fiber/record-tests` before submitting the pull request, and commit the resulting changes.
|
||||
9. If you haven't already, complete the CLA.
|
||||
|
||||
@@ -34,6 +34,10 @@ July 10-11 in Portland, Oregon USA
|
||||
|
||||
[Website](https://infinite.red/ChainReactConf) - [Twitter](https://twitter.com/chainreactconf)
|
||||
|
||||
### React Rally
|
||||
August 24-25 in Salt Lake City, Utah USA
|
||||
[Website](http://www.reactrally.com) - [Twitter](https://twitter.com/reactrally)
|
||||
|
||||
### ReactJS Day 2017
|
||||
October 6th in Verona, Italy
|
||||
|
||||
|
||||
@@ -81,9 +81,10 @@ The core team is monitoring for pull requests. We will review your pull request
|
||||
3. If you've changed APIs, update the documentation.
|
||||
4. Ensure the test suite passes (`npm test`).
|
||||
5. Make sure your code lints (`npm run lint`).
|
||||
6. Run the [Flow](https://flowtype.org/) typechecks (`npm run flow`).
|
||||
7. If you added or removed any tests, run `./scripts/fiber/record-tests` before submitting the pull request, and commit the resulting changes.
|
||||
8. If you haven't already, complete the CLA.
|
||||
6. Format your code with [prettier](https://github.com/prettier/prettier) (`npm run prettier`).
|
||||
7. Run the [Flow](https://flowtype.org/) typechecks (`npm run flow`).
|
||||
8. If you added or removed any tests, run `./scripts/fiber/record-tests` before submitting the pull request, and commit the resulting changes.
|
||||
9. If you haven't already, complete the CLA.
|
||||
|
||||
### Contributor License Agreement (CLA)
|
||||
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@
|
||||
"rollup": "node scripts/rollup/build.js",
|
||||
"test": "jest",
|
||||
"flow": "flow",
|
||||
"prettier": "prettier --write --no-bracket-spacing --single-quote --jsx-bracket-same-line --trailing-comma all --print-width 80 \"src/**/!(third_party)/*.js\""
|
||||
"prettier": "node ./scripts/prettier/index.js write"
|
||||
},
|
||||
"jest": {
|
||||
"modulePathIgnorePatterns": [
|
||||
|
||||
@@ -27,6 +27,7 @@ fi
|
||||
# These seem out of order but extract-errors must be run after jest.
|
||||
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
|
||||
COMMANDS_TO_RUN+=('./node_modules/.bin/gulp lint')
|
||||
COMMANDS_TO_RUN+=('node ./scripts/prettier/index')
|
||||
COMMANDS_TO_RUN+=('./node_modules/.bin/gulp flow')
|
||||
COMMANDS_TO_RUN+=('./node_modules/.bin/grunt build')
|
||||
COMMANDS_TO_RUN+=('./scripts/circleci/test_extract_errors.sh')
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
// Based on similar script in Jest
|
||||
// https://github.com/facebook/jest/blob/master/scripts/prettier.js
|
||||
|
||||
const chalk = require('chalk');
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
const execFileSync = require('child_process').execFileSync;
|
||||
|
||||
const shouldWrite = process.argv[2] === 'write';
|
||||
const isWindows = process.platform === 'win32';
|
||||
const prettier = isWindows ? 'prettier.cmd' : 'prettier';
|
||||
const prettierCmd = path.resolve(__dirname, '../../node_modules/.bin/' + prettier);
|
||||
const defaultOptions = {
|
||||
'bracket-spacing': 'false',
|
||||
'single-quote': 'true',
|
||||
'jsx-bracket-same-line': 'true',
|
||||
'trailing-comma': 'all',
|
||||
'print-width': 80,
|
||||
};
|
||||
const config = {
|
||||
default: {
|
||||
patterns: ['src/**/*.js'],
|
||||
ignore: [
|
||||
'**/third_party/**',
|
||||
'**/node_modules/**',
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
function exec(command, args) {
|
||||
console.log('> ' + [command].concat(args).join(' '));
|
||||
var options = {};
|
||||
return execFileSync(command, args, options).toString();
|
||||
}
|
||||
|
||||
Object.keys(config).forEach(key => {
|
||||
const patterns = config[key].patterns;
|
||||
const options = config[key].options;
|
||||
const ignore = config[key].ignore;
|
||||
|
||||
const globPattern = patterns.length > 1
|
||||
? `{${patterns.join(',')}}`
|
||||
: `${patterns.join(',')}`;
|
||||
const files = glob.sync(globPattern, {ignore});
|
||||
|
||||
const args = Object.keys(defaultOptions).map(
|
||||
k => `--${k}=${(options && options[k]) || defaultOptions[k]}`
|
||||
);
|
||||
args.push(`--${shouldWrite ? 'write' : 'l'}`);
|
||||
|
||||
try {
|
||||
exec(prettierCmd, [...args, ...files]);
|
||||
} catch (e) {
|
||||
if (!shouldWrite) {
|
||||
console.log(
|
||||
'\n' +
|
||||
chalk.red(
|
||||
` This project uses prettier to format all JavaScript code.\n`
|
||||
) +
|
||||
chalk.dim(` Please run `) +
|
||||
chalk.reset('yarn prettier') +
|
||||
chalk.dim(` and add changes to files listed above to your commit.`) +
|
||||
`\n`
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user