diff --git a/.eslintrc.yml b/.eslintrc.yml index e3bfeab87..401c6cd4f 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -24,9 +24,18 @@ rules: prefer-arrow-callback: error prefer-const: error react/no-deprecated: off + react/prop-types: off strict: error symbol-description: error yoda: - error - never - exceptRange: true +overrides: + - files: + - website/playground/** + env: + es6: true + browser: true + parserOptions: + sourceType: module diff --git a/website/playground/Playground.js b/website/playground/Playground.js index 3c0ef6d04..ea86b93d3 100644 --- a/website/playground/Playground.js +++ b/website/playground/Playground.js @@ -10,7 +10,6 @@ import formatMarkdown from "./markdown"; import { Sidebar, SidebarCategory } from "./sidebar/components"; import SidebarOptions from "./sidebar/SidebarOptions"; -import Option from "./sidebar/options"; import { Checkbox } from "./sidebar/inputs"; const CATEGORIES_ORDER = ["Global", "JavaScript", "Markdown", "Special"]; @@ -68,14 +67,14 @@ class Playground extends React.Component { } render() { - const { availableOptions } = this.props; + const { availableOptions, worker } = this.props; const { content, options } = this.state; return ( {editorState => ( Clear
- window.location.href}> + Copy link { const { uid, message, error } = event.data; - if (!handlers[uid]) return; + if (!handlers[uid]) { + return; + } const [resolve, reject] = handlers[uid]; delete handlers[uid]; diff --git a/website/playground/buttons.js b/website/playground/buttons.js index cc51ecd02..32c7081c0 100644 --- a/website/playground/buttons.js +++ b/website/playground/buttons.js @@ -30,7 +30,9 @@ export class ClipboardButton extends React.Component { showTooltip(text) { this.setState({ showTooltip: true, tooltipText: text }, () => { - if (this.timer) clearTimeout(this.timer); + if (this.timer) { + clearTimeout(this.timer); + } this.timer = setTimeout(() => { this.timer = null; this.setState({ showTooltip: false }); diff --git a/website/playground/helpers.js b/website/playground/helpers.js index f36930bb3..d54395b8d 100644 --- a/website/playground/helpers.js +++ b/website/playground/helpers.js @@ -1,5 +1,5 @@ export function stateToggler(key) { - return state => ({ [key]: !Boolean(state[key]) }); + return state => ({ [key]: !state[key] }); } const hasOwnProperty = Object.prototype.hasOwnProperty; @@ -10,14 +10,15 @@ function is(x, y) { // Steps 1-5, 7-10 // Steps 6.b-6.e: +0 != -0 return x !== 0 || 1 / x === 1 / y; - } else { - // Step 6.a: NaN == NaN - return x !== x && y !== y; } + // Step 6.a: NaN == NaN + return x !== x && y !== y; } export function shallowEqual(objA, objB) { - if (is(objA, objB)) return true; + if (is(objA, objB)) { + return true; + } if ( typeof objA !== "object" || @@ -31,7 +32,9 @@ export function shallowEqual(objA, objB) { const keysA = Object.keys(objA); const keysB = Object.keys(objB); - if (keysA.length !== keysB.length) return false; + if (keysA.length !== keysB.length) { + return false; + } for (let i = 0; i < keysA.length; i++) { if ( diff --git a/website/playground/index.js b/website/playground/index.js index 871f387c4..b2419bbf8 100644 --- a/website/playground/index.js +++ b/website/playground/index.js @@ -45,7 +45,9 @@ class App extends React.Component { render() { const { loaded, availableOptions, version } = this.state; - if (!loaded) return "Loading..."; + if (!loaded) { + return "Loading..."; + } return ( @@ -69,7 +71,9 @@ function parsePrettierOptions(supportInfo) { }, {}); return ENABLED_OPTIONS.reduce((optionsList, optionConfig) => { - if (!supportedOptions[optionConfig.name]) return optionsList; + if (!supportedOptions[optionConfig.name]) { + return optionsList; + } const option = Object.assign( {}, diff --git a/website/playground/markdown.js b/website/playground/markdown.js index 366aff9a6..f67b0be30 100644 --- a/website/playground/markdown.js +++ b/website/playground/markdown.js @@ -55,13 +55,13 @@ function formatCLIOptions(cliOptions) { } function codeBlock(content, syntax) { - var backtickSequences = content.match(/`+/g) || []; - var longestBacktickSequenceLength = Math.max.apply( + const backtickSequences = content.match(/`+/g) || []; + const longestBacktickSequenceLength = Math.max.apply( null, backtickSequences.map(backticks => backticks.length) ); - var fenceLength = Math.max(3, longestBacktickSequenceLength + 1); - var fence = Array(fenceLength + 1).join("`"); + const fenceLength = Math.max(3, longestBacktickSequenceLength + 1); + const fence = Array(fenceLength + 1).join("`"); return [fence + (syntax || ""), content, fence].join("\n"); }