fix lint
parent
b616fd025e
commit
4439a04689
|
@ -95,6 +95,7 @@ module.exports = {
|
|||
"new-cap": ["warn"],
|
||||
"key-spacing": ["warn"],
|
||||
"prefer-const": ["warn"],
|
||||
"arrow-parens": "off",
|
||||
|
||||
// crashes currently: https://github.com/eslint/eslint/issues/6274
|
||||
"generator-star-spacing": "off",
|
||||
|
|
|
@ -16,11 +16,6 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import { Value } from 'slate';
|
||||
import Html from 'slate-html-serializer';
|
||||
import Md from 'slate-md-serializer';
|
||||
import Plain from 'slate-plain-serializer';
|
||||
import * as RichText from './RichText';
|
||||
import Markdown from './Markdown';
|
||||
|
||||
import _clamp from 'lodash/clamp';
|
||||
|
||||
|
@ -38,17 +33,17 @@ class HistoryItem {
|
|||
this.format = format;
|
||||
}
|
||||
|
||||
static fromJSON(obj): HistoryItem {
|
||||
static fromJSON(obj: Object): HistoryItem {
|
||||
return new HistoryItem(
|
||||
Value.fromJSON(obj.value),
|
||||
obj.format
|
||||
obj.format,
|
||||
);
|
||||
}
|
||||
|
||||
toJSON(): Object {
|
||||
return {
|
||||
value: this.value.toJSON(),
|
||||
format: this.format
|
||||
format: this.format,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -67,10 +62,9 @@ export default class ComposerHistoryManager {
|
|||
for (; item = sessionStorage.getItem(`${this.prefix}[${this.currentIndex}]`); this.currentIndex++) {
|
||||
try {
|
||||
this.history.push(
|
||||
HistoryItem.fromJSON(JSON.parse(item))
|
||||
HistoryItem.fromJSON(JSON.parse(item)),
|
||||
);
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
console.warn("Throwing away unserialisable history", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,8 +132,7 @@ export default class CommandProvider extends AutocompleteProvider {
|
|||
let results;
|
||||
if (command[0] == '/') {
|
||||
results = COMMANDS;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
results = this.matcher.match(command[0]);
|
||||
}
|
||||
completions = results.map((result) => {
|
||||
|
|
|
@ -31,7 +31,7 @@ class PlainWithPillsSerializer {
|
|||
* @param {String} options.pillFormat - either 'md', 'plain', 'id'
|
||||
*/
|
||||
constructor(options = {}) {
|
||||
let {
|
||||
const {
|
||||
pillFormat = 'plain',
|
||||
} = options;
|
||||
this.pillFormat = pillFormat;
|
||||
|
@ -46,7 +46,7 @@ class PlainWithPillsSerializer {
|
|||
* @return {String}
|
||||
*/
|
||||
serialize = value => {
|
||||
return this._serializeNode(value.document)
|
||||
return this._serializeNode(value.document);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,8 +61,7 @@ class PlainWithPillsSerializer {
|
|||
(node.object == 'block' && Block.isBlockList(node.nodes))
|
||||
) {
|
||||
return node.nodes.map(this._serializeNode).join('\n');
|
||||
}
|
||||
else if (node.type == 'emoji') {
|
||||
} else if (node.type == 'emoji') {
|
||||
return node.data.get('emojiUnicode');
|
||||
} else if (node.type == 'pill') {
|
||||
switch (this.pillFormat) {
|
||||
|
@ -73,11 +72,9 @@ class PlainWithPillsSerializer {
|
|||
case 'id':
|
||||
return node.data.get('completionId') || node.data.get('completion');
|
||||
}
|
||||
}
|
||||
else if (node.nodes) {
|
||||
} else if (node.nodes) {
|
||||
return node.nodes.map(this._serializeNode).join('');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return node.text;
|
||||
}
|
||||
}
|
||||
|
@ -89,4 +86,4 @@ class PlainWithPillsSerializer {
|
|||
* @type {PlainWithPillsSerializer}
|
||||
*/
|
||||
|
||||
export default PlainWithPillsSerializer
|
||||
export default PlainWithPillsSerializer;
|
||||
|
|
Loading…
Reference in New Issue