Skip to content
Browse files

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
  • Loading branch information...
1 parent 555fe1f commit bb8a1434493351d11dd276db8f67ea327f1f3e1b @spicyj spicyj committed with Facebook Github Bot 1
View
10 .eslintrc.js
@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2013-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.
+ */
module.exports = {
parser: 'babel-eslint',
@@ -11,5 +19,5 @@ module.exports = {
rules: {
'react/jsx-uses-react': 1,
'react/react-in-jsx-scope': 1,
- }
+ },
};
View
4 examples/tex/js/data/content.js
@@ -61,8 +61,8 @@ var rawContent = {
'\\left( \\sum_{k=1}^n b_k^2 \\right)'
),
},
- }
- }
+ },
+ },
};
export var content = convertFromRaw(rawContent);
View
12 examples/tex/server.js
@@ -23,7 +23,7 @@ const APP_PORT = 3000;
var compiler = webpack({
entry: path.resolve(__dirname, 'js', 'app.js'),
eslint: {
- configFile: '.eslintrc'
+ configFile: '.eslintrc',
},
module: {
loaders: [
@@ -34,16 +34,16 @@ var compiler = webpack({
},
{
test: /\.js$/,
- loader: 'eslint'
- }
- ]
+ loader: 'eslint',
+ },
+ ],
},
- output: {filename: 'app.js', path: '/'}
+ output: {filename: 'app.js', path: '/'},
});
var app = new WebpackDevServer(compiler, {
contentBase: '/public/',
publicPath: '/js/',
- stats: {colors: true}
+ stats: {colors: true},
});
// Serve static resources
app.use('/', express.static('public'));
View
18 gulpfile.js
@@ -30,11 +30,11 @@ var paths = {
src: [
'src/**/*.js',
'!src/**/__tests__/**/*.js',
- '!src/**/__mocks__/**/*.js'
+ '!src/**/__mocks__/**/*.js',
],
css: [
- 'src/**/*.css'
- ]
+ 'src/**/*.css',
+ ],
};
// Ensure that we use another plugin that isn't specified in the default Babel
@@ -52,12 +52,12 @@ var buildDist = function(opts) {
output: {
filename: opts.output,
libraryTarget: 'var',
- library: 'Draft'
+ library: 'Draft',
},
plugins: [
new webpackStream.webpack.optimize.OccurenceOrderPlugin(),
- new webpackStream.webpack.optimize.DedupePlugin()
- ]
+ new webpackStream.webpack.optimize.DedupePlugin(),
+ ],
};
if (!opts.debug) {
webpackOpts.plugins.push(
@@ -65,8 +65,8 @@ var buildDist = function(opts) {
compress: {
hoist_vars: true,
screw_ie8: true,
- warnings: false
- }
+ warnings: false,
+ },
})
);
}
@@ -134,7 +134,7 @@ gulp.task('css', function() {
gulp.task('dist', ['modules', 'css'], function() {
var opts = {
debug: true,
- output: 'Draft.js'
+ output: 'Draft.js',
};
return gulp.src('./lib/Draft.js')
.pipe(buildDist(opts))
View
9 scripts/babel/default-options.js
@@ -1,3 +1,12 @@
+/**
+ * Copyright (c) 2013-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.
+ */
+
var assign = require('object-assign');
var babelPluginModules = require('fbjs-scripts/babel/rewrite-modules');
View
9 scripts/jest/preprocessor.js
@@ -1,3 +1,12 @@
+/**
+ * Copyright (c) 2013-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.
+ */
+
var babel = require('babel-core');
var assign = require('object-assign');
var babelOpts = require('../babel/default-options');
View
16 website/core/DocsSidebar.js
@@ -1,8 +1,16 @@
/**
+ * Copyright (c) 2013-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.
+ *
* @providesModule DocsSidebar
* @jsx React.DOM
*/
+var React = require('React');
var Metadata = require('Metadata');
var DocsSidebar = React.createClass({
@@ -12,7 +20,7 @@ var DocsSidebar = React.createClass({
});
// Build a hashmap of article_id -> metadata
- var articles = {}
+ var articles = {};
for (var i = 0; i < metadatas.length; ++i) {
var metadata = metadatas[i];
articles[metadata.id] = metadata;
@@ -50,8 +58,8 @@ var DocsSidebar = React.createClass({
currentCategory && categories.push(currentCategory);
currentCategory = {
name: metadata.category,
- links: []
- }
+ links: [],
+ };
}
currentCategory.links.push(metadata);
metadata = articles[metadata.next];
@@ -89,7 +97,7 @@ var DocsSidebar = React.createClass({
</div>
)}
</div>;
- }
+ },
});
module.exports = DocsSidebar;
View
11 website/core/H2.js
@@ -1,4 +1,11 @@
/**
+ * Copyright (c) 2013-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.
+ *
* @providesModule H2
* @jsx React.DOM
*/
@@ -8,8 +15,8 @@ var Header = require('Header');
var H2 = React.createClass({
render: function() {
- return <Header {...this.props} level={2}>{this.props.children}</Header>
- }
+ return <Header {...this.props} level={2}>{this.props.children}</Header>;
+ },
});
module.exports = H2;
View
22 website/core/Header.js
@@ -1,4 +1,11 @@
/**
+ * Copyright (c) 2013-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.
+ *
* @providesModule Header
* @jsx React.DOM
*/
@@ -7,13 +14,12 @@ var React = require('React');
var Header = React.createClass({
slug: function(string) {
- // var accents = "àáäâèéëêìíïîòóöôùúüûñç";
- var accents = "\u00e0\u00e1\u00e4\u00e2\u00e8"
- + "\u00e9\u00eb\u00ea\u00ec\u00ed\u00ef"
- + "\u00ee\u00f2\u00f3\u00f6\u00f4\u00f9"
- + "\u00fa\u00fc\u00fb\u00f1\u00e7";
+ var accents = '\u00e0\u00e1\u00e4\u00e2\u00e8'
+ + '\u00e9\u00eb\u00ea\u00ec\u00ed\u00ef'
+ + '\u00ee\u00f2\u00f3\u00f6\u00f4\u00f9'
+ + '\u00fa\u00fc\u00fb\u00f1\u00e7';
- var without = "aaaaeeeeiiiioooouuuunc";
+ var without = 'aaaaeeeeiiiioooouuuunc';
return string
.toString()
@@ -24,7 +30,7 @@ var Header = React.createClass({
// Handle accentuated characters
.replace(
new RegExp('[' + accents + ']', 'g'),
- function (c) { return without.charAt(accents.indexOf(c)); })
+ function(c) { return without.charAt(accents.indexOf(c)); })
// Dash special characters
.replace(/[^a-z0-9]/g, '-')
@@ -47,7 +53,7 @@ var Header = React.createClass({
{' '}<a className="hash-link" href={'#' + slug}>#</a>
</Heading>
);
- }
+ },
});
module.exports = Header;
View
11 website/core/HeaderLinks.js
@@ -1,8 +1,17 @@
/**
+ * Copyright (c) 2013-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.
+ *
* @providesModule HeaderLinks
* @jsx React.DOM
*/
+var React = require('React');
+
var HeaderLinks = React.createClass({
links: [
{section: 'docs', href: '/draft-js/docs/overview.html#content', text: 'docs'},
@@ -25,7 +34,7 @@ var HeaderLinks = React.createClass({
}, this)}
</ul>
);
- }
+ },
});
module.exports = HeaderLinks;
View
114 website/core/Marked.js
@@ -5,6 +5,7 @@
*
* @providesModule Marked
* @jsx React.DOM
+ * @preserve-header
*/
var React = require('React');
@@ -29,40 +30,23 @@ var block = {
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
table: noop,
paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
- text: /^[^\n]+/
+ text: /^[^\n]+/,
};
block.bullet = /(?:[*+-]|\d+\.)/;
block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
-block.item = replace(block.item, 'gm')
- (/bull/g, block.bullet)
- ();
+block.item = replace(block.item, 'gm')(/bull/g, block.bullet)();
-block.list = replace(block.list)
- (/bull/g, block.bullet)
- ('hr', /\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)
- ();
+block.list = replace(block.list)(/bull/g, block.bullet)('hr', /\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)();
block._tag = '(?!(?:'
+ 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'
+ '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'
+ '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b';
-block.html = replace(block.html)
- ('comment', /<!--[\s\S]*?-->/)
- ('closed', /<(tag)[\s\S]+?<\/\1>/)
- ('closing', /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)
- (/tag/g, block._tag)
- ();
-
-block.paragraph = replace(block.paragraph)
- ('hr', block.hr)
- ('heading', block.heading)
- ('lheading', block.lheading)
- ('blockquote', block.blockquote)
- ('tag', '<' + block._tag)
- ('def', block.def)
- ();
+block.html = replace(block.html)('comment', /<!--[\s\S]*?-->/)('closed', /<(tag)[\s\S]+?<\/\1>/)('closing', /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g, block._tag)();
+
+block.paragraph = replace(block.paragraph)('hr', block.hr)('heading', block.heading)('lheading', block.lheading)('blockquote', block.blockquote)('tag', '<' + block._tag)('def', block.def)();
/**
* Normal Block Grammar
@@ -76,12 +60,10 @@ block.normal = merge({}, block);
block.gfm = merge({}, block.normal, {
fences: /^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,
- paragraph: /^/
+ paragraph: /^/,
});
-block.gfm.paragraph = replace(block.paragraph)
- ('(?!', '(?!' + block.gfm.fences.source.replace('\\1', '\\2') + '|')
- ();
+block.gfm.paragraph = replace(block.paragraph)('(?!', '(?!' + block.gfm.fences.source.replace('\\1', '\\2') + '|')();
/**
* GFM + Tables Block Grammar
@@ -89,7 +71,7 @@ block.gfm.paragraph = replace(block.paragraph)
block.tables = merge({}, block.gfm, {
nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,
- table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/
+ table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/,
});
/**
@@ -162,7 +144,7 @@ Lexer.prototype.token = function(src, top) {
src = src.substring(cap[0].length);
if (cap[0].length > 1) {
this.tokens.push({
- type: 'space'
+ type: 'space',
});
}
}
@@ -175,7 +157,7 @@ Lexer.prototype.token = function(src, top) {
type: 'code',
text: !this.options.pedantic
? cap.replace(/\n+$/, '')
- : cap
+ : cap,
});
continue;
}
@@ -186,7 +168,7 @@ Lexer.prototype.token = function(src, top) {
this.tokens.push({
type: 'code',
lang: cap[2],
- text: cap[3]
+ text: cap[3],
});
continue;
}
@@ -197,7 +179,7 @@ Lexer.prototype.token = function(src, top) {
this.tokens.push({
type: 'heading',
depth: cap[1].length,
- text: cap[2]
+ text: cap[2],
});
continue;
}
@@ -210,7 +192,7 @@ Lexer.prototype.token = function(src, top) {
type: 'table',
header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
- cells: cap[3].replace(/\n$/, '').split('\n')
+ cells: cap[3].replace(/\n$/, '').split('\n'),
};
for (i = 0; i < item.align.length; i++) {
@@ -240,7 +222,7 @@ Lexer.prototype.token = function(src, top) {
this.tokens.push({
type: 'heading',
depth: cap[2] === '=' ? 1 : 2,
- text: cap[1]
+ text: cap[1],
});
continue;
}
@@ -249,7 +231,7 @@ Lexer.prototype.token = function(src, top) {
if (cap = this.rules.hr.exec(src)) {
src = src.substring(cap[0].length);
this.tokens.push({
- type: 'hr'
+ type: 'hr',
});
continue;
}
@@ -259,7 +241,7 @@ Lexer.prototype.token = function(src, top) {
src = src.substring(cap[0].length);
this.tokens.push({
- type: 'blockquote_start'
+ type: 'blockquote_start',
});
cap = cap[0].replace(/^ *> ?/gm, '');
@@ -270,7 +252,7 @@ Lexer.prototype.token = function(src, top) {
this.token(cap, top);
this.tokens.push({
- type: 'blockquote_end'
+ type: 'blockquote_end',
});
continue;
@@ -283,7 +265,7 @@ Lexer.prototype.token = function(src, top) {
this.tokens.push({
type: 'list_start',
- ordered: bull.length > 1
+ ordered: bull.length > 1,
});
// Get each top-level item.
@@ -332,19 +314,19 @@ Lexer.prototype.token = function(src, top) {
this.tokens.push({
type: loose
? 'loose_item_start'
- : 'list_item_start'
+ : 'list_item_start',
});
// Recurse.
this.token(item, false);
this.tokens.push({
- type: 'list_item_end'
+ type: 'list_item_end',
});
}
this.tokens.push({
- type: 'list_end'
+ type: 'list_end',
});
continue;
@@ -358,7 +340,7 @@ Lexer.prototype.token = function(src, top) {
? 'paragraph'
: 'html',
pre: cap[1] === 'pre' || cap[1] === 'script',
- text: cap[0]
+ text: cap[0],
});
continue;
}
@@ -368,7 +350,7 @@ Lexer.prototype.token = function(src, top) {
src = src.substring(cap[0].length);
this.tokens.links[cap[1].toLowerCase()] = {
href: cap[2],
- title: cap[3]
+ title: cap[3],
};
continue;
}
@@ -381,7 +363,7 @@ Lexer.prototype.token = function(src, top) {
type: 'table',
header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
- cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n')
+ cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n'),
};
for (i = 0; i < item.align.length; i++) {
@@ -414,7 +396,7 @@ Lexer.prototype.token = function(src, top) {
type: 'paragraph',
text: cap[1][cap[1].length-1] === '\n'
? cap[1].slice(0, -1)
- : cap[1]
+ : cap[1],
});
continue;
}
@@ -425,7 +407,7 @@ Lexer.prototype.token = function(src, top) {
src = src.substring(cap[0].length);
this.tokens.push({
type: 'text',
- text: cap[0]
+ text: cap[0],
});
continue;
}
@@ -456,20 +438,15 @@ var inline = {
code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
br: /^ {2,}\n(?!\s*$)/,
del: noop,
- text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
+ text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,
};
inline._inside = /(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/;
inline._href = /\s*<?([^\s]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
-inline.link = replace(inline.link)
- ('inside', inline._inside)
- ('href', inline._href)
- ();
+inline.link = replace(inline.link)('inside', inline._inside)('href', inline._href)();
-inline.reflink = replace(inline.reflink)
- ('inside', inline._inside)
- ();
+inline.reflink = replace(inline.reflink)('inside', inline._inside)();
/**
* Normal Inline Grammar
@@ -483,7 +460,7 @@ inline.normal = merge({}, inline);
inline.pedantic = merge({}, inline.normal, {
strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
- em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/
+ em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
});
/**
@@ -494,10 +471,7 @@ inline.gfm = merge({}, inline.normal, {
escape: replace(inline.escape)('])', '~|])')(),
url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
del: /^~~(?=\S)([\s\S]*?\S)~~/,
- text: replace(inline.text)
- (']|', '~]|')
- ('|', '|https?://|')
- ()
+ text: replace(inline.text)(']|', '~]|')('|', '|https?://|')(),
});
/**
@@ -506,7 +480,7 @@ inline.gfm = merge({}, inline.normal, {
inline.breaks = merge({}, inline.gfm, {
br: replace(inline.br)('{2,}', '*')(),
- text: replace(inline.gfm.text)('{2,}', '*')()
+ text: replace(inline.gfm.text)('{2,}', '*')(),
});
/**
@@ -606,7 +580,7 @@ InlineLexer.prototype.output = function(src) {
src = src.substring(cap[0].length);
out.push(this.outputLink(cap, {
href: cap[2],
- title: cap[3]
+ title: cap[3],
}));
continue;
}
@@ -687,7 +661,7 @@ InlineLexer.prototype.sanitizeUrl = function(url) {
var prot = decodeURIComponent(url)
.replace(/[^A-Za-z0-9:]/g, '')
.toLowerCase();
- if (prot.indexOf('javascript:') === 0) {
+ if (prot.indexOf('javascript:') === 0) { // eslint-disable-line
return '#';
}
} catch (e) {
@@ -710,13 +684,13 @@ InlineLexer.prototype.outputLink = function(cap, link) {
return React.DOM.a({
href: this.sanitizeUrl(link.href),
title: link.title,
- target: shouldOpenInNewWindow ? '_blank' : ''
+ target: shouldOpenInNewWindow ? '_blank' : '',
}, this.output(cap[1]));
} else {
return React.DOM.img({
src: this.sanitizeUrl(link.href),
alt: cap[1],
- title: link.title
+ title: link.title,
}, null);
}
};
@@ -902,8 +876,8 @@ Parser.prototype.tok = function() {
case 'html': {
return React.DOM.div({
dangerouslySetInnerHTML: {
- __html: this.token.text
- }
+ __html: this.token.text,
+ },
});
}
case 'paragraph': {
@@ -983,7 +957,7 @@ function marked(src, opt, callback) {
, i = 0;
try {
- tokens = Lexer.lex(src, opt)
+ tokens = Lexer.lex(src, opt);
} catch (e) {
return callback(e);
}
@@ -1040,7 +1014,7 @@ function marked(src, opt, callback) {
} catch (e) {
e.message += '\nPlease report this to https://github.com/chjj/marked.';
if ((opt || marked.defaults).silent) {
- return [React.DOM.p(null, "An error occurred:"),
+ return [React.DOM.p(null, 'An error occurred:'),
React.DOM.pre(null, e.message)];
}
throw e;
@@ -1068,7 +1042,7 @@ marked.defaults = {
highlight: null,
langPrefix: 'lang-',
smartypants: false,
- paragraphFn: null
+ paragraphFn: null,
};
/**
@@ -1089,7 +1063,7 @@ marked.parse = marked;
var Marked = React.createClass({
render: function() {
return <div>{marked(this.props.children, this.props)}</div>;
- }
+ },
});
module.exports = Marked;
View
97 website/core/Prism.js
@@ -5,6 +5,7 @@
*
* @providesModule Prism
* @jsx React.DOM
+ * @preserve-header
*/
var React = require('React');
@@ -15,12 +16,12 @@ var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i;
var _ = {
util: {
- type: function (o) {
+ type: function(o) {
return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
},
// Deep clone a language definition (e.g. to extend it)
- clone: function (o) {
+ clone: function(o) {
var type = _.util.type(o);
switch (type) {
@@ -40,11 +41,11 @@ var _ = {
}
return o;
- }
+ },
},
languages: {
- extend: function (id, redef) {
+ extend: function(id, redef) {
var lang = _.util.clone(_.languages[id]);
for (var key in redef) {
@@ -55,7 +56,7 @@ var _ = {
},
// Insert a token before another token in a language literal
- insertBefore: function (inside, before, insert, root) {
+ insertBefore: function(inside, before, insert, root) {
root = root || _.languages;
var grammar = root[inside];
var ret = {};
@@ -90,7 +91,7 @@ var _ = {
_.languages.DFS(o[i], callback);
}
}
- }
+ },
},
tokenize: function(text, grammar, language) {
@@ -109,7 +110,7 @@ var _ = {
}
tokenloop: for (var token in grammar) {
- if(!grammar.hasOwnProperty(token) || !grammar[token]) {
+ if (!grammar.hasOwnProperty(token) || !grammar[token]) {
continue;
}
@@ -120,7 +121,7 @@ var _ = {
pattern = pattern.pattern || pattern;
- for (var i=0; i<strarr.length; i++) { // Dont cache length as it changes during the loop
+ for (var i=0; i<strarr.length; i++) { // Don't cache length as it changes during the loop
var str = strarr[i];
@@ -138,7 +139,7 @@ var _ = {
var match = pattern.exec(str);
if (match) {
- if(lookbehind) {
+ if (lookbehind) {
lookbehindLength = match[1].length;
}
@@ -174,7 +175,7 @@ var _ = {
hooks: {
all: {},
- add: function (name, callback) {
+ add: function(name, callback) {
var hooks = _.hooks.all;
hooks[name] = hooks[name] || [];
@@ -182,7 +183,7 @@ var _ = {
hooks[name].push(callback);
},
- run: function (name, env) {
+ run: function(name, env) {
var callbacks = _.hooks.all[name];
if (!callbacks || !callbacks.length) {
@@ -192,8 +193,8 @@ var _ = {
for (var i=0, callback; callback = callbacks[i++];) {
callback(env);
}
- }
- }
+ },
+ },
};
var Token = _.Token = function(type, content) {
@@ -214,8 +215,8 @@ Token.reactify = function(o, key) {
var attributes = {
className: 'token ' + o.type,
- key: key
- }
+ key: key,
+ };
if (o.type == 'comment') {
attributes.spellCheck = true;
}
@@ -235,26 +236,26 @@ _.languages.markup = {
pattern: /^&lt;\/?[\w:-]+/i,
inside: {
'punctuation': /^&lt;\/?/,
- 'namespace': /^[\w-]+?:/
- }
+ 'namespace': /^[\w-]+?:/,
+ },
},
'attr-value': {
pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,
inside: {
- 'punctuation': /=|>|"/g
- }
+ 'punctuation': /=|>|"/g,
+ },
},
'punctuation': /\/?>/g,
'attr-name': {
pattern: /[\w:-]+/g,
inside: {
- 'namespace': /^[\w-]+?:/
- }
- }
+ 'namespace': /^[\w-]+?:/,
+ },
+ },
- }
+ },
},
- 'entity': /&amp;#?[\da-z]{1,8};/gi
+ 'entity': /&amp;#?[\da-z]{1,8};/gi,
};
_.languages.css = {
@@ -262,8 +263,8 @@ _.languages.css = {
'atrule': {
pattern: /@[\w-]+?.*?(;|(?=\s*{))/gi,
inside: {
- 'punctuation': /[;:]/g
- }
+ 'punctuation': /[;:]/g,
+ },
},
'url': /url\((["']?).*?\1\)/gi,
'selector': /[^\{\}\s][^\{\};]*(?=\s*\{)/g,
@@ -271,7 +272,7 @@ _.languages.css = {
'string': /("|')(\\?.)*?\1/g,
'important': /\B!important\b/gi,
'ignore': /&(lt|gt|amp);/gi,
- 'punctuation': /[\{\};:]/g
+ 'punctuation': /[\{\};:]/g,
};
_.languages.insertBefore('markup', 'tag', {
@@ -280,50 +281,50 @@ _.languages.insertBefore('markup', 'tag', {
inside: {
'tag': {
pattern: /(&lt;|<)style[\w\W]*?(>|&gt;)|(&lt;|<)\/style(>|&gt;)/ig,
- inside: _.languages.markup.tag.inside
+ inside: _.languages.markup.tag.inside,
},
- rest: _.languages.css
- }
- }
+ rest: _.languages.css,
+ },
+ },
});
_.languages.clike = {
'comment': {
pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,
- lookbehind: true
+ lookbehind: true,
},
'string': /("|')(\\?.)*?\1/g,
'class-name': {
pattern: /((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,
lookbehind: true,
inside: {
- punctuation: /(\.|\\)/
- }
+ punctuation: /(\.|\\)/,
+ },
},
'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,
'boolean': /\b(true|false)\b/g,
'function': {
pattern: /[a-z0-9_]+\(/ig,
inside: {
- punctuation: /\(/
- }
+ punctuation: /\(/,
+ },
},
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,
'operator': /[-+]{1,2}|!|&lt;=?|>=?|={1,3}|(&amp;){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,
'ignore': /&(lt|gt|amp);/gi,
- 'punctuation': /[{}[\];(),.:]/g
+ 'punctuation': /[{}[\];(),.:]/g,
};
_.languages.javascript = _.languages.extend('clike', {
'keyword': /\b(var|let|if|else|while|do|for|return|in|instanceof|function|get|set|new|with|typeof|try|throw|catch|finally|null|break|continue|this)\b/g,
- 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g
+ 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g,
});
_.languages.insertBefore('javascript', 'keyword', {
'regex': {
pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,
- lookbehind: true
- }
+ lookbehind: true,
+ },
});
_.languages.insertBefore('markup', 'tag', {
@@ -332,20 +333,20 @@ _.languages.insertBefore('markup', 'tag', {
inside: {
'tag': {
pattern: /(&lt;|<)script[\w\W]*?(>|&gt;)|(&lt;|<)\/script(>|&gt;)/ig,
- inside: _.languages.markup.tag.inside
+ inside: _.languages.markup.tag.inside,
},
- rest: _.languages.javascript
- }
- }
+ rest: _.languages.javascript,
+ },
+ },
});
var Prism = React.createClass({
statics: {
- _: _
+ _: _,
},
getDefaultProps: function() {
return {
- language: 'javascript'
+ language: 'javascript',
};
},
render: function() {
@@ -355,7 +356,7 @@ var Prism = React.createClass({
{Token.reactify(_.tokenize(this.props.children, grammar))}
</pre>
);
- }
-})
+ },
+});
module.exports = Prism;
View
11 website/core/Site.js
@@ -1,4 +1,11 @@
/**
+ * Copyright (c) 2013-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.
+ *
* @providesModule Site
* @jsx React.DOM
*/
@@ -40,7 +47,7 @@ var Site = React.createClass({
{this.props.children}
<footer className="wrap">
- <div className="right">© 2016 Facebook Inc.</div>
+ <div className="right">&copy; 2016 Facebook Inc.</div>
</footer>
</div>
@@ -60,7 +67,7 @@ var Site = React.createClass({
</body>
</html>
);
- }
+ },
});
module.exports = Site;
View
9 website/core/center.js
@@ -1,4 +1,11 @@
/**
+ * Copyright (c) 2013-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.
+ *
* @providesModule center
* @jsx React.DOM
*/
@@ -15,7 +22,7 @@ var center = React.createClass({
return (
<div {...props} style={style}>{this.props.children}</div>
);
- }
+ },
});
module.exports = center;
View
7 website/core/unindent.js
@@ -1,4 +1,11 @@
/**
+ * Copyright (c) 2013-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.
+ *
* @providesModule unindent
*/
View
9 website/layout/DocsLayout.js
@@ -1,4 +1,11 @@
/**
+ * Copyright (c) 2013-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.
+ *
* @providesModule DocsLayout
* @jsx React.DOM
*/
@@ -27,7 +34,7 @@ var DocsLayout = React.createClass({
</section>
</Site>
);
- }
+ },
});
module.exports = DocsLayout;
View
4 website/layout/PageLayout.js
@@ -1,4 +1,6 @@
/**
+ * Copyright 2004-present Facebook. All Rights Reserved.
+ *
* @providesModule PageLayout
* @jsx React.DOM
*/
@@ -20,7 +22,7 @@ var support = React.createClass({
</section>
</Site>
);
- }
+ },
});
module.exports = support;
View
2 website/server/generate.js
@@ -56,7 +56,7 @@ glob('src/**/*.*', function(er, files) {
});
queue = queue.then(function() {
- console.log('It is live at: http://facebook.github.io/draft-js/')
+ console.log('It is live at: http://facebook.github.io/draft-js/');
}).finally(function() {
server.close();
}).catch(function(e) {
View
6 website/server/server.js
@@ -1,4 +1,6 @@
-"use strict";
+// Copyright 2004-present Facebook. All Rights Reserved.
+
+'use strict';
var compression = require('compression');
var connect = require('connect');
@@ -35,7 +37,7 @@ var buildOptions = {
},
serverRender: true,
dev: argv.dev !== 'false',
- static: true
+ static: true,
};
var app = connect()
View
4 website/src/draft-js/index.js
@@ -1,4 +1,6 @@
/**
+ * Copyright 2004-present Facebook. All Rights Reserved.
+ *
* This file provided by Facebook is for non-commercial testing and evaluation
* purposes only. Facebook reserves all rights not expressly granted.
*
@@ -259,7 +261,7 @@ var index = React.createClass({
<script type="text/babel" dangerouslySetInnerHTML={{__html: richExample}} />
</Site>
);
- }
+ },
});
module.exports = index;

0 comments on commit bb8a143

Please sign in to comment.
Something went wrong with that request. Please try again.