Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

Commit bb8a143

Browse files
sophiebitsFacebook Github Bot 1
authored andcommitted
Fix some lint errors in website
Summary:Fixes most errors and some warnings, especially the autofix ones. - copyright headers - no unicode in source files - `.indexOf('javascript:')` is legit; suppress the eslint error - trailing commas, semicolons bypass-lint Reviewed By: hellendag Differential Revision: D2981752 fb-gh-sync-id: 5ceb842c215c5787aa2c981a1eae3254f19ef687 shipit-source-id: 5ceb842c215c5787aa2c981a1eae3254f19ef687
1 parent 555fe1f commit bb8a143

20 files changed

Lines changed: 225 additions & 160 deletions

File tree

.eslintrc.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* Copyright (c) 2013-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
19

210
module.exports = {
311
parser: 'babel-eslint',
@@ -11,5 +19,5 @@ module.exports = {
1119
rules: {
1220
'react/jsx-uses-react': 1,
1321
'react/react-in-jsx-scope': 1,
14-
}
22+
},
1523
};

examples/tex/js/data/content.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ var rawContent = {
6161
'\\left( \\sum_{k=1}^n b_k^2 \\right)'
6262
),
6363
},
64-
}
65-
}
64+
},
65+
},
6666
};
6767

6868
export var content = convertFromRaw(rawContent);

examples/tex/server.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const APP_PORT = 3000;
2323
var compiler = webpack({
2424
entry: path.resolve(__dirname, 'js', 'app.js'),
2525
eslint: {
26-
configFile: '.eslintrc'
26+
configFile: '.eslintrc',
2727
},
2828
module: {
2929
loaders: [
@@ -34,16 +34,16 @@ var compiler = webpack({
3434
},
3535
{
3636
test: /\.js$/,
37-
loader: 'eslint'
38-
}
39-
]
37+
loader: 'eslint',
38+
},
39+
],
4040
},
41-
output: {filename: 'app.js', path: '/'}
41+
output: {filename: 'app.js', path: '/'},
4242
});
4343
var app = new WebpackDevServer(compiler, {
4444
contentBase: '/public/',
4545
publicPath: '/js/',
46-
stats: {colors: true}
46+
stats: {colors: true},
4747
});
4848
// Serve static resources
4949
app.use('/', express.static('public'));

gulpfile.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ var paths = {
3030
src: [
3131
'src/**/*.js',
3232
'!src/**/__tests__/**/*.js',
33-
'!src/**/__mocks__/**/*.js'
33+
'!src/**/__mocks__/**/*.js',
3434
],
3535
css: [
36-
'src/**/*.css'
37-
]
36+
'src/**/*.css',
37+
],
3838
};
3939

4040
// Ensure that we use another plugin that isn't specified in the default Babel
@@ -52,21 +52,21 @@ var buildDist = function(opts) {
5252
output: {
5353
filename: opts.output,
5454
libraryTarget: 'var',
55-
library: 'Draft'
55+
library: 'Draft',
5656
},
5757
plugins: [
5858
new webpackStream.webpack.optimize.OccurenceOrderPlugin(),
59-
new webpackStream.webpack.optimize.DedupePlugin()
60-
]
59+
new webpackStream.webpack.optimize.DedupePlugin(),
60+
],
6161
};
6262
if (!opts.debug) {
6363
webpackOpts.plugins.push(
6464
new webpackStream.webpack.optimize.UglifyJsPlugin({
6565
compress: {
6666
hoist_vars: true,
6767
screw_ie8: true,
68-
warnings: false
69-
}
68+
warnings: false,
69+
},
7070
})
7171
);
7272
}
@@ -134,7 +134,7 @@ gulp.task('css', function() {
134134
gulp.task('dist', ['modules', 'css'], function() {
135135
var opts = {
136136
debug: true,
137-
output: 'Draft.js'
137+
output: 'Draft.js',
138138
};
139139
return gulp.src('./lib/Draft.js')
140140
.pipe(buildDist(opts))

scripts/babel/default-options.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* Copyright (c) 2013-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
110
var assign = require('object-assign');
211
var babelPluginModules = require('fbjs-scripts/babel/rewrite-modules');
312

scripts/jest/preprocessor.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* Copyright (c) 2013-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
110
var babel = require('babel-core');
211
var assign = require('object-assign');
312
var babelOpts = require('../babel/default-options');

website/core/DocsSidebar.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
/**
2+
* Copyright (c) 2013-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
29
* @providesModule DocsSidebar
310
* @jsx React.DOM
411
*/
512

13+
var React = require('React');
614
var Metadata = require('Metadata');
715

816
var DocsSidebar = React.createClass({
@@ -12,7 +20,7 @@ var DocsSidebar = React.createClass({
1220
});
1321

1422
// Build a hashmap of article_id -> metadata
15-
var articles = {}
23+
var articles = {};
1624
for (var i = 0; i < metadatas.length; ++i) {
1725
var metadata = metadatas[i];
1826
articles[metadata.id] = metadata;
@@ -50,8 +58,8 @@ var DocsSidebar = React.createClass({
5058
currentCategory && categories.push(currentCategory);
5159
currentCategory = {
5260
name: metadata.category,
53-
links: []
54-
}
61+
links: [],
62+
};
5563
}
5664
currentCategory.links.push(metadata);
5765
metadata = articles[metadata.next];
@@ -89,7 +97,7 @@ var DocsSidebar = React.createClass({
8997
</div>
9098
)}
9199
</div>;
92-
}
100+
},
93101
});
94102

95103
module.exports = DocsSidebar;

website/core/H2.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
/**
2+
* Copyright (c) 2013-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
29
* @providesModule H2
310
* @jsx React.DOM
411
*/
@@ -8,8 +15,8 @@ var Header = require('Header');
815

916
var H2 = React.createClass({
1017
render: function() {
11-
return <Header {...this.props} level={2}>{this.props.children}</Header>
12-
}
18+
return <Header {...this.props} level={2}>{this.props.children}</Header>;
19+
},
1320
});
1421

1522
module.exports = H2;

website/core/Header.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
/**
2+
* Copyright (c) 2013-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
29
* @providesModule Header
310
* @jsx React.DOM
411
*/
@@ -7,13 +14,12 @@ var React = require('React');
714

815
var Header = React.createClass({
916
slug: function(string) {
10-
// var accents = "àáäâèéëêìíïîòóöôùúüûñç";
11-
var accents = "\u00e0\u00e1\u00e4\u00e2\u00e8"
12-
+ "\u00e9\u00eb\u00ea\u00ec\u00ed\u00ef"
13-
+ "\u00ee\u00f2\u00f3\u00f6\u00f4\u00f9"
14-
+ "\u00fa\u00fc\u00fb\u00f1\u00e7";
17+
var accents = '\u00e0\u00e1\u00e4\u00e2\u00e8'
18+
+ '\u00e9\u00eb\u00ea\u00ec\u00ed\u00ef'
19+
+ '\u00ee\u00f2\u00f3\u00f6\u00f4\u00f9'
20+
+ '\u00fa\u00fc\u00fb\u00f1\u00e7';
1521

16-
var without = "aaaaeeeeiiiioooouuuunc";
22+
var without = 'aaaaeeeeiiiioooouuuunc';
1723

1824
return string
1925
.toString()
@@ -24,7 +30,7 @@ var Header = React.createClass({
2430
// Handle accentuated characters
2531
.replace(
2632
new RegExp('[' + accents + ']', 'g'),
27-
function (c) { return without.charAt(accents.indexOf(c)); })
33+
function(c) { return without.charAt(accents.indexOf(c)); })
2834

2935
// Dash special characters
3036
.replace(/[^a-z0-9]/g, '-')
@@ -47,7 +53,7 @@ var Header = React.createClass({
4753
{' '}<a className="hash-link" href={'#' + slug}>#</a>
4854
</Heading>
4955
);
50-
}
56+
},
5157
});
5258

5359
module.exports = Header;

website/core/HeaderLinks.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
/**
2+
* Copyright (c) 2013-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
29
* @providesModule HeaderLinks
310
* @jsx React.DOM
411
*/
512

13+
var React = require('React');
14+
615
var HeaderLinks = React.createClass({
716
links: [
817
{section: 'docs', href: '/draft-js/docs/overview.html#content', text: 'docs'},
@@ -25,7 +34,7 @@ var HeaderLinks = React.createClass({
2534
}, this)}
2635
</ul>
2736
);
28-
}
37+
},
2938
});
3039

3140
module.exports = HeaderLinks;

0 commit comments

Comments
 (0)