Skip to content

Commit

Permalink
Merge pull request facebook#3189 from hzoo/more-lint
Browse files Browse the repository at this point in the history
More lint - remove spaces in object braces / array brackets
  • Loading branch information
zpao committed Feb 19, 2015
2 parents 629d400 + eba5d13 commit 21a9e8b
Show file tree
Hide file tree
Showing 39 changed files with 230 additions and 230 deletions.
2 changes: 1 addition & 1 deletion grunt/config/browserify.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var LICENSE_TEMPLATE =
*/';

function minify(src) {
return UglifyJS.minify(src, { fromString: true }).code;
return UglifyJS.minify(src, {fromString: true}).code;
}

// TODO: move this out to another build step maybe.
Expand Down
44 changes: 22 additions & 22 deletions grunt/config/webdriver-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = function(props) {

exports.local = {
webdriver: {
remote: { protocol: 'http:', hostname: '127.0.0.1', port: 9515, path: '/' }
remote: {protocol: 'http:', hostname: '127.0.0.1', port: 9515, path: '/'}
},
url: props.url,
onStart: props.onStart,
Expand Down Expand Up @@ -68,33 +68,33 @@ module.exports = function(props) {
/*eslint-disable camelcase*/
/* https://saucelabs.com/platforms */
exports.saucelabs_ios =
exports.saucelabs_ios7 = sauceItUp({ browserName: 'iphone', version: '7', platform:'OS X 10.9' });
exports.saucelabs_ios6_1 = sauceItUp({ browserName: 'iphone', version: '6.1', platform:'OS X 10.8' });
exports.saucelabs_ios6 = sauceItUp({ browserName: 'iphone', version: '6', platform:'OS X 10.8' });
exports.saucelabs_ios5_1 = sauceItUp({ browserName: 'iphone', version: '5.1', platform:'OS X 10.8' });
exports.saucelabs_ios5 = sauceItUp({ browserName: 'iphone', version: '5', platform:'OS X 10.6' });
exports.saucelabs_ios4 = sauceItUp({ browserName: 'iphone', version: '4', platform:'OS X 10.6' });
exports.saucelabs_ios7 = sauceItUp({browserName: 'iphone', version: '7', platform:'OS X 10.9'});
exports.saucelabs_ios6_1 = sauceItUp({browserName: 'iphone', version: '6.1', platform:'OS X 10.8'});
exports.saucelabs_ios6 = sauceItUp({browserName: 'iphone', version: '6', platform:'OS X 10.8'});
exports.saucelabs_ios5_1 = sauceItUp({browserName: 'iphone', version: '5.1', platform:'OS X 10.8'});
exports.saucelabs_ios5 = sauceItUp({browserName: 'iphone', version: '5', platform:'OS X 10.6'});
exports.saucelabs_ios4 = sauceItUp({browserName: 'iphone', version: '4', platform:'OS X 10.6'});

exports.saucelabs_ipad =
exports.saucelabs_ipad7 = sauceItUp({ browserName: 'ipad', version: '7', platform:'OS X 10.9' });
exports.saucelabs_ipad6_1 = sauceItUp({ browserName: 'ipad', version: '6.1', platform:'OS X 10.8' });
exports.saucelabs_ipad6 = sauceItUp({ browserName: 'ipad', version: '6', platform:'OS X 10.8' });
exports.saucelabs_ipad5_1 = sauceItUp({ browserName: 'ipad', version: '5.1', platform:'OS X 10.8' });
exports.saucelabs_ipad5 = sauceItUp({ browserName: 'ipad', version: '5', platform:'OS X 10.6' });
exports.saucelabs_ipad4 = sauceItUp({ browserName: 'ipad', version: '4', platform:'OS X 10.6' });
exports.saucelabs_ipad7 = sauceItUp({browserName: 'ipad', version: '7', platform:'OS X 10.9'});
exports.saucelabs_ipad6_1 = sauceItUp({browserName: 'ipad', version: '6.1', platform:'OS X 10.8'});
exports.saucelabs_ipad6 = sauceItUp({browserName: 'ipad', version: '6', platform:'OS X 10.8'});
exports.saucelabs_ipad5_1 = sauceItUp({browserName: 'ipad', version: '5.1', platform:'OS X 10.8'});
exports.saucelabs_ipad5 = sauceItUp({browserName: 'ipad', version: '5', platform:'OS X 10.6'});
exports.saucelabs_ipad4 = sauceItUp({browserName: 'ipad', version: '4', platform:'OS X 10.6'});

exports.saucelabs_android = sauceItUp({ browserName: 'android', version: '4.0', platform:'Linux' });
exports.saucelabs_android_tablet = sauceItUp({ browserName: 'android', version: '4.0', platform:'Linux', 'device-type':'tablet' });
exports.saucelabs_android = sauceItUp({browserName: 'android', version: '4.0', platform:'Linux'});
exports.saucelabs_android_tablet = sauceItUp({browserName: 'android', version: '4.0', platform:'Linux', 'device-type':'tablet'});

exports.saucelabs_safari = sauceItUp({ browserName: 'safari' });
exports.saucelabs_chrome = sauceItUp({ browserName: 'chrome' });
exports.saucelabs_firefox = sauceItUp({ browserName: 'firefox' });
exports.saucelabs_safari = sauceItUp({browserName: 'safari'});
exports.saucelabs_chrome = sauceItUp({browserName: 'chrome'});
exports.saucelabs_firefox = sauceItUp({browserName: 'firefox'});

exports.saucelabs_ie =
exports.saucelabs_ie8 = sauceItUp({ browserName: 'internet explorer', version: 8 });
exports.saucelabs_ie9 = sauceItUp({ browserName: 'internet explorer', version: 9 });
exports.saucelabs_ie10 = sauceItUp({ browserName: 'internet explorer', version: 10 });
exports.saucelabs_ie11 = sauceItUp({ browserName: 'internet explorer', version: 11, platform:'Windows 8.1' });
exports.saucelabs_ie8 = sauceItUp({browserName: 'internet explorer', version: 8});
exports.saucelabs_ie9 = sauceItUp({browserName: 'internet explorer', version: 9});
exports.saucelabs_ie10 = sauceItUp({browserName: 'internet explorer', version: 10});
exports.saucelabs_ie11 = sauceItUp({browserName: 'internet explorer', version: 11, platform:'Windows 8.1'});
/*eslint-enable camelcase*/

function sauceItUp(desiredCapabilities) {
Expand Down
4 changes: 2 additions & 2 deletions grunt/tasks/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module.exports = function() {
'install',
'--production',
tgz
], { cwd: dir }, function() {
], {cwd: dir}, function() {
var nodePath = path.join(dir, 'node_modules');
var pkgDir = path.join(nodePath, pkg.name);
var doneCount = 2;
Expand All @@ -83,7 +83,7 @@ module.exports = function() {
'/** @jsx React.DOM */ <div>oyez</div>;'
) + ')'
], {
env: { NODE_PATH: nodePath }
env: {NODE_PATH: nodePath}
}, function(result, code) {
assert.ok(result.stdout.indexOf(
'React.DOM.div(null, \'oyez\');'
Expand Down
8 changes: 4 additions & 4 deletions grunt/tasks/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function _gitCommitAndTag(cwd, commitMsg, tag, cb) {
// `git add -u` to make sure we remove deleted files
// `git commit -m {commitMsg}`
// `git tag -a {tag}`
var opts = { cwd: cwd};
var opts = {cwd: cwd};
var gitAddAll = {
cmd: 'git',
args: ['add', '*'],
Expand Down Expand Up @@ -91,7 +91,7 @@ function bower() {
// clean out the bower folder in case we're removing files
var files = grunt.file.expand(BOWER_GLOB);
files.forEach(function(file) {
grunt.file.delete(file, { force: true });
grunt.file.delete(file, {force: true});
});

// Update bower package version and save the file back.
Expand All @@ -113,7 +113,7 @@ function docs() {

var files = grunt.file.expand(GH_PAGES_GLOB);
files.forEach(function(file) {
grunt.file.delete(file, { force: true });
grunt.file.delete(file, {force: true});
});

grunt.file.copy('build/react-' + VERSION + '.zip', 'docs/downloads/react-' + VERSION + '.zip');
Expand All @@ -123,7 +123,7 @@ function docs() {
var rakeOpts = {
cmd: 'rake',
args: ['release'],
opts: { cwd: 'docs' }
opts: {cwd: 'docs'}
};
grunt.util.spawn(rakeOpts, function() {
// Commit the repo. We don't really care about tagging this.
Expand Down
2 changes: 1 addition & 1 deletion jest/ts-preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var fs = require('fs');
var path = require('path');
var ts = require('typescript');

var tsOptions = { module: 'commonjs' };
var tsOptions = {module: 'commonjs'};

function formatErrorMessage(error) {
return (
Expand Down
4 changes: 2 additions & 2 deletions perf/lib/BrowserPerfRunnerApp.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ BrowserPerfRunnerApp.renderBenchmarkCell = function(props, row, col) {
return (
React.DOM.td({key:key, style:{textAlign:'center', width:234, verticalAlign:'top'}},
benchmark.error && benchmark.error.message || '',
React.DOM.div({style: benchmark.isTheWinner ? { backgroundColor:'#0A5', color:'#AFA' } : {backgroundColor:'transparent', color:'inherit'}},
React.DOM.div({style: benchmark.isTheWinner ? {backgroundColor:'#0A5', color:'#AFA'} : {backgroundColor:'transparent', color:'inherit'}},
Math.round(1 / benchmark.stats.mean * 100) / 100, ' op/s ',
React.DOM.strong(null, Math.round(benchmark.stats.mean * 1000 * 100) / 100, ' ms/op '),
React.DOM.small(null, '(±' + (Math.round(benchmark.stats.rme * 10) / 10) + '%)')
Expand Down Expand Up @@ -198,7 +198,7 @@ var GridViewTable = React.createClass({
},

_renderCell: function(col) {
return this.props.renderCell({ value:this.props.value }, this._row, col);
return this.props.renderCell({value:this.props.value}, this._row, col);
},

_renderRow: function(row) {
Expand Down
2 changes: 1 addition & 1 deletion perf/lib/BrowserPerfRunnerContext.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var BenchmarkQueue = React.createClass({
if (self.props.onCompleteEach) {
self.props.onCompleteEach(queueItem);
}
self.setState({ queue:queue });
self.setState({queue:queue});
});
benchmark.run({async:true});
},
Expand Down
6 changes: 3 additions & 3 deletions perf/lib/todolist.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ todolist.App = React.createClass({
if (callback) {
callback = callback.bind(this, todo);
}
this.setState({ timerEvent:'addItem', timerStart:todolist.now(), timerEnd:null, todos:todos }, callback);
this.setState({timerEvent:'addItem', timerStart:todolist.now(), timerEnd:null, todos:todos}, callback);
return todo;
},
deleteItemById: function(id, callback) {
Expand All @@ -59,15 +59,15 @@ todolist.App = React.createClass({
return callback && callback(Error('todo with id ' + id + ' not found'));
}
todo.deleted = true;
this.setState({ timerEvent:'deleteItemById', timerStart:todolist.now(), timerEnd:null, todos:this.state.todos }, callback);
this.setState({timerEvent:'deleteItemById', timerStart:todolist.now(), timerEnd:null, todos:this.state.todos}, callback);
},
setItemCompleted: function(id, completed, callback) {
var todo = this._getById(id);
if (!todo) {
return callback && callback(Error('todo with id ' + id + ' not found'));
}
todo.completed = completed;
this.setState({ timerEvent:'setItemCompleted', timerStart:todolist.now(), timerEnd:null, todos:this.state.todos }, callback);
this.setState({timerEvent:'setItemCompleted', timerStart:todolist.now(), timerEnd:null, todos:this.state.todos}, callback);
},
_getById: function(id) {
id = +id;
Expand Down
2 changes: 1 addition & 1 deletion perf/tests/setState-callback-5.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports.setup = function() {

var AwesomeComponent = React.createClass({
getInitialState: function() {
return { random:null };
return {random:null};
},
render: function() {
if (!setState) {
Expand Down
2 changes: 1 addition & 1 deletion perf/tests/setState-callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports.setup = function() {

var AwesomeComponent = React.createClass({
getInitialState: function() {
return { random:null };
return {random:null};
},
render: function() {
if (!setState) {
Expand Down
2 changes: 1 addition & 1 deletion perf/tests/todolist-add.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports.defer = true;
exports.setup = function() {
_rootNode = document.createElement('div');
document.body.appendChild(_rootNode);
var appDescriptor = todolist.App({ fakeDataCount: 333 });
var appDescriptor = todolist.App({fakeDataCount: 333});
_app = React.render(appDescriptor, _rootNode);
};
exports.fn = function(deferred) {
Expand Down
2 changes: 1 addition & 1 deletion perf/tests/todolist-do-stuff.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports.defer = true;
exports.setup = function() {
_rootNode = document.createElement('div');
document.body.appendChild(_rootNode);
var appDescriptor = todolist.App({ fakeDataCount: 333 });
var appDescriptor = todolist.App({fakeDataCount: 333});
_app = React.render(appDescriptor, _rootNode);
};

Expand Down
2 changes: 1 addition & 1 deletion perf/tests/todolist-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports.defer = true;
exports.setup = function() {
_rootNode = document.createElement('div');
document.body.appendChild(_rootNode);
var appDescriptor = todolist.App({ fakeDataCount: 333 });
var appDescriptor = todolist.App({fakeDataCount: 333});
_app = React.render(appDescriptor, _rootNode);
_todo1 = _app.addItem('Howdy 1!');
_todo2 = _app.addItem('Howdy 2!');
Expand Down
2 changes: 1 addition & 1 deletion perf/tests/todolist-mount.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports.setup = function() {
};

exports.fn = function(deferred) {
React.render(todolist.App({ fakeDataCount: 333 }), _rootNode, function() {
React.render(todolist.App({fakeDataCount: 333}), _rootNode, function() {
deferred.resolve();
});
};
Expand Down
4 changes: 2 additions & 2 deletions src/addons/ReactFragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ if (__DEV__) {
Object.defineProperty(
{},
fragmentKey,
{ enumerable: false, value: true }
{enumerable: false, value: true}
);

Object.defineProperty(
{},
'key',
{ enumerable: true, get: dummy }
{enumerable: true, get: dummy}
);

canWarnForReactFragment = true;
Expand Down
2 changes: 1 addition & 1 deletion src/browser/__tests__/ReactDOM-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('ReactDOM', function() {
*/

it("allows a DOM element to be used with a string", function() {
var element = React.createElement('div', { className: 'foo' });
var element = React.createElement('div', {className: 'foo'});
var instance = ReactTestUtils.renderIntoDocument(element);
expect(instance.getDOMNode().tagName).toBe('DIV');
});
Expand Down
30 changes: 15 additions & 15 deletions src/browser/ui/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ describe('ReactDOMComponent', function() {
var stubStyle = container.firstChild.style;

// set initial style
var setup = { display: 'block', left: '1', top: 2, fontFamily: 'Arial' };
var setup = {display: 'block', left: '1', top: 2, fontFamily: 'Arial'};
React.render(<div style={setup} />, container);
expect(stubStyle.display).toEqual('block');
expect(stubStyle.left).toEqual('1px');
expect(stubStyle.fontFamily).toEqual('Arial');

// reset the style to their default state
var reset = { display: '', left: null, top: false, fontFamily: true };
var reset = {display: '', left: null, top: false, fontFamily: true};
React.render(<div style={reset} />, container);
expect(stubStyle.display).toEqual('');
expect(stubStyle.left).toEqual('');
Expand All @@ -61,7 +61,7 @@ describe('ReactDOMComponent', function() {
});

it("should update styles when mutating style object", function() {
var styles = { display: 'none', fontFamily: 'Arial', lineHeight: 1.2 };
var styles = {display: 'none', fontFamily: 'Arial', lineHeight: 1.2};
var container = document.createElement('div');
React.render(<div style={styles} />, container);

Expand Down Expand Up @@ -226,7 +226,7 @@ describe('ReactDOMComponent', function() {
var ReactReconcileTransaction = require('ReactReconcileTransaction');

var NodeStub = function(initialProps) {
this._currentElement = { props: initialProps };
this._currentElement = {props: initialProps};
this._rootNodeID = 'test';
};
assign(NodeStub.prototype, ReactDOMComponent.Mixin);
Expand All @@ -250,9 +250,9 @@ describe('ReactDOMComponent', function() {
});

it("should generate the correct markup with className", function() {
expect(genMarkup({ className: 'a' })).toHaveAttribute('class', 'a');
expect(genMarkup({ className: 'a b' })).toHaveAttribute('class', 'a b');
expect(genMarkup({ className: '' })).toHaveAttribute('class', '');
expect(genMarkup({className: 'a'})).toHaveAttribute('class', 'a');
expect(genMarkup({className: 'a b'})).toHaveAttribute('class', 'a b');
expect(genMarkup({className: ''})).toHaveAttribute('class', '');
});

it("should escape style names and values", function() {
Expand All @@ -276,7 +276,7 @@ describe('ReactDOMComponent', function() {
var ReactReconcileTransaction = require('ReactReconcileTransaction');

var NodeStub = function(initialProps) {
this._currentElement = { props: initialProps };
this._currentElement = {props: initialProps};
this._rootNodeID = 'test';
};
assign(NodeStub.prototype, ReactDOMComponent.Mixin);
Expand All @@ -297,7 +297,7 @@ describe('ReactDOMComponent', function() {
it("should handle dangerouslySetInnerHTML", function() {
var innerHTML = {__html: 'testContent'};
expect(
genMarkup({ dangerouslySetInnerHTML: innerHTML })
genMarkup({dangerouslySetInnerHTML: innerHTML})
).toHaveInnerhtml('testContent');
});
});
Expand Down Expand Up @@ -332,7 +332,7 @@ describe('ReactDOMComponent', function() {

it("should validate against multiple children props", function() {
expect(function() {
mountComponent({ children: '', dangerouslySetInnerHTML: '' });
mountComponent({children: '', dangerouslySetInnerHTML: ''});
}).toThrow(
'Invariant Violation: Can only set one of `children` or ' +
'`props.dangerouslySetInnerHTML`.'
Expand All @@ -342,7 +342,7 @@ describe('ReactDOMComponent', function() {
it('should validate against use of innerHTML', function() {

spyOn(console, 'warn');
mountComponent({ innerHTML: '<span>Hi Jim!</span>' });
mountComponent({innerHTML: '<span>Hi Jim!</span>'});
expect(console.warn.argsForCall.length).toBe(1);
expect(console.warn.argsForCall[0][0]).toContain(
'Directly setting property `innerHTML` is not permitted. '
Expand All @@ -351,7 +351,7 @@ describe('ReactDOMComponent', function() {

it('should validate use of dangerouslySetInnerHTML', function() {
expect(function() {
mountComponent({ dangerouslySetInnerHTML: '<span>Hi Jim!</span>' });
mountComponent({dangerouslySetInnerHTML: '<span>Hi Jim!</span>'});
}).toThrow(
'Invariant Violation: ' +
'`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
Expand All @@ -361,7 +361,7 @@ describe('ReactDOMComponent', function() {

it('should validate use of dangerouslySetInnerHTML', function() {
expect(function() {
mountComponent({ dangerouslySetInnerHTML: {foo: 'bar'} });
mountComponent({dangerouslySetInnerHTML: {foo: 'bar'} });
}).toThrow(
'Invariant Violation: ' +
'`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
Expand All @@ -371,14 +371,14 @@ describe('ReactDOMComponent', function() {

it("should warn about contentEditable and children", function() {
spyOn(console, 'warn');
mountComponent({ contentEditable: true, children: '' });
mountComponent({contentEditable: true, children: ''});
expect(console.warn.argsForCall.length).toBe(1);
expect(console.warn.argsForCall[0][0]).toContain('contentEditable');
});

it("should validate against invalid styles", function() {
expect(function() {
mountComponent({ style: 'display: none' });
mountComponent({style: 'display: none'});
}).toThrow(
'Invariant Violation: The `style` prop expects a mapping from style ' +
'properties to values, not a string. For example, ' +
Expand Down
Loading

0 comments on commit 21a9e8b

Please sign in to comment.