diff --git a/web/.prettierrc.js b/web/.prettierrc.js index 9fc17188..a677742f 100644 --- a/web/.prettierrc.js +++ b/web/.prettierrc.js @@ -1,9 +1,9 @@ module.exports = { - printWidth: 120, - useTabs: false, - semi: true, - singleQuote: true, - trailingComma: 'es5', - bracketSpacing: true, - arrowParens: 'avoid', + printWidth: 120, + useTabs: false, + semi: true, + singleQuote: true, + trailingComma: 'es5', + bracketSpacing: true, + arrowParens: 'avoid', }; diff --git a/web/app/common/api.js b/web/app/common/api.js index a067fc1c..2f648d37 100644 --- a/web/app/common/api.js +++ b/web/app/common/api.js @@ -15,94 +15,108 @@ export const getPostComments = ({ sort, url }) => fetcher.get(`/find?url=${url}& export const getLastComments = ({ siteId, max }) => fetcher.get(`/last/${max}?site=${siteId}`); -export const getCommentsCount = ({ urls, siteId }) => fetcher.post({ - url: `/counts?site=${siteId}`, - body: urls, -}); +export const getCommentsCount = ({ urls, siteId }) => + fetcher.post({ + url: `/counts?site=${siteId}`, + body: urls, + }); export const getComment = ({ id }) => fetcher.get(`/id/${id}?url=${url}`); export const getUserComments = ({ user, limit }) => fetcher.get(`/comments?user=${user}&limit=${limit}`); -export const putCommentVote = ({ id, url, value }) => fetcher.put({ - url: `/vote/${id}?url=${url}&vote=${value}`, - withCredentials: true, -}); +export const putCommentVote = ({ id, url, value }) => + fetcher.put({ + url: `/vote/${id}?url=${url}&vote=${value}`, + withCredentials: true, + }); -export const addComment = ({ text, pid }) => fetcher.post({ - url: '/comment', - body: { - text, - locator: { - site: siteId, - url, +export const addComment = ({ text, pid }) => + fetcher.post({ + url: '/comment', + body: { + text, + locator: { + site: siteId, + url, + }, + ...(pid ? { pid } : {}), }, - ...(pid ? { pid } : {}), - }, - withCredentials: true, -}); + withCredentials: true, + }); -export const updateComment = ({ text, id }) => fetcher.put({ - url: `/comment/${id}?url=${url}`, - body: { - text, - }, - withCredentials: true, -}); +export const updateComment = ({ text, id }) => + fetcher.put({ + url: `/comment/${id}?url=${url}`, + body: { + text, + }, + withCredentials: true, + }); -export const getPreview = ({ text }) => fetcher.post({ - url: '/preview', - body: { - text, - }, - withCredentials: true, -}); +export const getPreview = ({ text }) => + fetcher.post({ + url: '/preview', + body: { + text, + }, + withCredentials: true, + }); -export const getUser = () => fetcher.get({ - url: '/user', - withCredentials: true -}); +export const getUser = () => + fetcher.get({ + url: '/user', + withCredentials: true, + }); /* admin */ -export const pinComment = ({ id, url }) => fetcher.put({ - url: `/admin/pin/${id}?url=${url}&pin=1`, - withCredentials: true, -}); +export const pinComment = ({ id, url }) => + fetcher.put({ + url: `/admin/pin/${id}?url=${url}&pin=1`, + withCredentials: true, + }); -export const unpinComment = ({ id, url }) => fetcher.put({ - url: `/admin/pin/${id}?url=${url}&pin=0`, - withCredentials: true, -}); +export const unpinComment = ({ id, url }) => + fetcher.put({ + url: `/admin/pin/${id}?url=${url}&pin=0`, + withCredentials: true, + }); -export const setVerifyStatus = ({ id }) => fetcher.put({ - url: `/admin/verify/${id}?verified=1`, - withCredentials: true, -}); +export const setVerifyStatus = ({ id }) => + fetcher.put({ + url: `/admin/verify/${id}?verified=1`, + withCredentials: true, + }); -export const removeVerifyStatus = ({ id }) => fetcher.put({ - url: `/admin/verify/${id}?verified=0`, - withCredentials: true, -}); +export const removeVerifyStatus = ({ id }) => + fetcher.put({ + url: `/admin/verify/${id}?verified=0`, + withCredentials: true, + }); -export const removeComment = ({ id }) => fetcher.delete({ - url: `/admin/comment/${id}?url=${url}`, - withCredentials: true, -}); +export const removeComment = ({ id }) => + fetcher.delete({ + url: `/admin/comment/${id}?url=${url}`, + withCredentials: true, + }); -export const blockUser = ({ id }) => fetcher.put({ - url: `/admin/user/${id}?block=1`, - withCredentials: true, -}); +export const blockUser = ({ id }) => + fetcher.put({ + url: `/admin/user/${id}?block=1`, + withCredentials: true, + }); -export const unblockUser = ({ id }) => fetcher.put({ - url: `/admin/user/${id}?block=0`, - withCredentials: true, -}); +export const unblockUser = ({ id }) => + fetcher.put({ + url: `/admin/user/${id}?block=0`, + withCredentials: true, + }); -export const getBlocked = () => fetcher.get({ - url: '/admin/blocked', - withCredentials: true, -}); +export const getBlocked = () => + fetcher.get({ + url: '/admin/blocked', + withCredentials: true, + }); export default { logOut, diff --git a/web/app/common/constants.js b/web/app/common/constants.js index f91fbbae..8a0e38ca 100644 --- a/web/app/common/constants.js +++ b/web/app/common/constants.js @@ -32,4 +32,4 @@ module.exports = { DEFAULT_SORT, LS_COLLAPSE_KEY, LS_SORT_KEY, -}; \ No newline at end of file +}; diff --git a/web/app/common/fetcher.js b/web/app/common/fetcher.js index e1411d2d..1e7b7b33 100644 --- a/web/app/common/fetcher.js +++ b/web/app/common/fetcher.js @@ -8,12 +8,8 @@ const methods = ['get', 'post', 'put', 'patch', 'delete', 'head']; methods.forEach(method => { fetcher[method] = data => { - const { - url, - body = {}, - withCredentials = false, - overriddenApiBase = API_BASE, - } = (typeof data === 'string' ? { url: data } : data); + const { url, body = {}, withCredentials = false, overriddenApiBase = API_BASE } = + typeof data === 'string' ? { url: data } : data; const basename = `${BASE_URL}${overriddenApiBase}`; return new Promise((resolve, reject) => { diff --git a/web/app/common/polyfills.js b/web/app/common/polyfills.js index 0a6bf4ee..e68f65a0 100644 --- a/web/app/common/polyfills.js +++ b/web/app/common/polyfills.js @@ -5,8 +5,8 @@ Promise.prototype.finally = function finallyFn(callback) { const constructor = this.constructor; return this.then( - (value) => constructor.resolve(callback()).then(() => value), - (reason) => constructor.resolve(callback()).then(() => reason) + value => constructor.resolve(callback()).then(() => value), + reason => constructor.resolve(callback()).then(() => reason) ); }; @@ -20,7 +20,8 @@ export default function loadPolyfills() { 'includes' in Array.prototype && 'assign' in Object && 'keys' in Object - ) return Promise.resolve(); + ) + return Promise.resolve(); return import(/* webpackChunkName: "polyfills" */ 'core-js'); }; diff --git a/web/app/common/settings.js b/web/app/common/settings.js index cc77b410..8d5862d6 100644 --- a/web/app/common/settings.js +++ b/web/app/common/settings.js @@ -1,8 +1,12 @@ -const querySettings = window.location.search.substr(1).split('&').reduce((acc, param) => { - const pair = param.split('='); - acc[pair[0]] = decodeURIComponent(pair[1]); - return acc; -}, {}) || {}; +const querySettings = + window.location.search + .substr(1) + .split('&') + .reduce((acc, param) => { + const pair = param.split('='); + acc[pair[0]] = decodeURIComponent(pair[1]); + return acc; + }, {}) || {}; export const siteId = querySettings['site_id']; export const url = querySettings['url']; diff --git a/web/app/common/store.js b/web/app/common/store.js index 991c8c29..bb33e90c 100644 --- a/web/app/common/store.js +++ b/web/app/common/store.js @@ -19,7 +19,6 @@ class Store { this.listeners[key].push(cb); } - set(key, obj) { this.data[key] = obj; diff --git a/web/app/common/store.test.js b/web/app/common/store.test.js index 191351b7..65fd66c6 100644 --- a/web/app/common/store.test.js +++ b/web/app/common/store.test.js @@ -6,8 +6,8 @@ describe('Store', () => { store.set('comments', []); store.onUpdate('comments', listener); - store.addComment({id:`new`}); + store.addComment({ id: `new` }); - expect(listener).toBeCalledWith([{"comment": {"id": "new"}}]); + expect(listener).toBeCalledWith([{ comment: { id: 'new' } }]); }); }); diff --git a/web/app/components/auth-panel/auth-panel.jsx b/web/app/components/auth-panel/auth-panel.jsx index 2a1e3d52..e0327b3b 100644 --- a/web/app/components/auth-panel/auth-panel.jsx +++ b/web/app/components/auth-panel/auth-panel.jsx @@ -46,7 +46,7 @@ export default class AuthPanel extends Component { {user.name} {isUserIdVisible && ({user.id})}.{' '} - + Sign out? @@ -79,7 +79,7 @@ export default class AuthPanel extends Component { {user.admin && ( {isBlockedVisible ? 'Hide' : 'Show'} blocked diff --git a/web/app/components/blocked-users/__list-item/_view/_invisible/blocked-users__list-item_view_invisible.scss b/web/app/components/blocked-users/__list-item/_view/_invisible/blocked-users__list-item_view_invisible.scss index d017c17b..de4dcbaa 100644 --- a/web/app/components/blocked-users/__list-item/_view/_invisible/blocked-users__list-item_view_invisible.scss +++ b/web/app/components/blocked-users/__list-item/_view/_invisible/blocked-users__list-item_view_invisible.scss @@ -1,6 +1,6 @@ .blocked-users__list-item_view_invisible { .blocked-users__username { - opacity: .5; + opacity: 0.5; text-decoration: line-through; } } diff --git a/web/app/components/blocked-users/blocked-users.jsx b/web/app/components/blocked-users/blocked-users.jsx index 3bbeb02f..c6752411 100644 --- a/web/app/components/blocked-users/blocked-users.jsx +++ b/web/app/components/blocked-users/blocked-users.jsx @@ -52,16 +52,12 @@ export default class BlockedUsers extends Component { {user.name}{' '} ({user.id}) {isUserUnblocked && ( - this.block(user))} - className="blocked-users__action"> + this.block(user))} className="blocked-users__action"> block )} {!isUserUnblocked && ( - this.unblock(user))} - className="blocked-users__action"> + this.unblock(user))} className="blocked-users__action"> unblock )} diff --git a/web/app/components/comment/__action/comment__action.scss b/web/app/components/comment/__action/comment__action.scss index 8c8d91c3..9e3a0fda 100644 --- a/web/app/components/comment/__action/comment__action.scss +++ b/web/app/components/comment/__action/comment__action.scss @@ -3,7 +3,7 @@ vertical-align: middle; cursor: pointer; user-select: none; - color: #259C9A; + color: #259c9a; &:hover { color: #31c7c5; diff --git a/web/app/components/comment/__control/comment__control.scss b/web/app/components/comment/__control/comment__control.scss index b1b1e100..dfc8b44c 100644 --- a/web/app/components/comment/__control/comment__control.scss +++ b/web/app/components/comment/__control/comment__control.scss @@ -1,7 +1,7 @@ .comment__control { margin-right: 8px; cursor: pointer; - color: #8CD4D4; + color: #8cd4d4; &:last-child { margin-right: 0; diff --git a/web/app/components/comment/__username/comment__username.scss b/web/app/components/comment/__username/comment__username.scss index 925ddfca..544734f4 100644 --- a/web/app/components/comment/__username/comment__username.scss +++ b/web/app/components/comment/__username/comment__username.scss @@ -7,6 +7,6 @@ cursor: pointer; &:hover { - opacity: .75; + opacity: 0.75; } } diff --git a/web/app/components/comment/__verification/comment__verification.scss b/web/app/components/comment/__verification/comment__verification.scss index 79b65086..76541375 100644 --- a/web/app/components/comment/__verification/comment__verification.scss +++ b/web/app/components/comment/__verification/comment__verification.scss @@ -8,6 +8,6 @@ background-size: cover; &:hover { - opacity: .75; + opacity: 0.75; } } diff --git a/web/app/components/comment/__vote/_disabled/comment__vote_disabled.scss b/web/app/components/comment/__vote/_disabled/comment__vote_disabled.scss index aaa0b69b..168e6602 100644 --- a/web/app/components/comment/__vote/_disabled/comment__vote_disabled.scss +++ b/web/app/components/comment/__vote/_disabled/comment__vote_disabled.scss @@ -1,5 +1,6 @@ .comment__vote_disabled { - &, &:hover { + &, + &:hover { background-image: url('comment__vote_disabled.svg'); cursor: not-allowed; } diff --git a/web/app/components/comment/__vote/_type/_down/comment__vote_type_down.scss b/web/app/components/comment/__vote/_type/_down/comment__vote_type_down.scss index 7f09db3f..82a16994 100644 --- a/web/app/components/comment/__vote/_type/_down/comment__vote_type_down.scss +++ b/web/app/components/comment/__vote/_type/_down/comment__vote_type_down.scss @@ -3,7 +3,8 @@ margin-left: 4px; &.comment__vote_selected { - &, &:hover { + &, + &:hover { background-image: url('comment__vote_type_down.svg'); } } diff --git a/web/app/components/comment/__vote/_type/_up/comment__vote_type_up.scss b/web/app/components/comment/__vote/_type/_up/comment__vote_type_up.scss index 9ecc2c13..1285f48b 100644 --- a/web/app/components/comment/__vote/_type/_up/comment__vote_type_up.scss +++ b/web/app/components/comment/__vote/_type/_up/comment__vote_type_up.scss @@ -2,7 +2,8 @@ margin-right: 4px; &.comment__vote_selected { - &, &:hover { + &, + &:hover { background-image: url('comment__vote_type_up.svg'); } } diff --git a/web/app/components/comment/_collapsed/comment_collapsed.scss b/web/app/components/comment/_collapsed/comment_collapsed.scss index 5eef321d..07c47849 100644 --- a/web/app/components/comment/_collapsed/comment_collapsed.scss +++ b/web/app/components/comment/_collapsed/comment_collapsed.scss @@ -1,6 +1,7 @@ .comment_collapsed { > .comment__body { - .comment__text, .comment__actions { + .comment__text, + .comment__actions { display: none; } } diff --git a/web/app/components/comment/_editing/comment_editing.scss b/web/app/components/comment/_editing/comment_editing.scss index bb546220..1fac8c17 100644 --- a/web/app/components/comment/_editing/comment_editing.scss +++ b/web/app/components/comment/_editing/comment_editing.scss @@ -13,7 +13,7 @@ } // it isn't mobile first, but it's fine here - @media (-moz-touch-enabled: 1) and (max-width: 768px), (pointer:coarse) and (max-width: 768px) { + @media (-moz-touch-enabled: 1) and (max-width: 768px), (pointer: coarse) and (max-width: 768px) { border: 8px solid #eee; padding-bottom: 0; diff --git a/web/app/components/comment/_level/comment_level.scss b/web/app/components/comment/_level/comment_level.scss index db3cdb60..bb3c39b3 100644 --- a/web/app/components/comment/_level/comment_level.scss +++ b/web/app/components/comment/_level/comment_level.scss @@ -7,7 +7,7 @@ $step: 24px; &.comment_replying { .comment__input { - @media (-moz-touch-enabled: 1) and (max-width: 768px), (pointer:coarse) and (max-width: 768px) { + @media (-moz-touch-enabled: 1) and (max-width: 768px), (pointer: coarse) and (max-width: 768px) { margin-left: -$i * $step; } } diff --git a/web/app/components/comment/_replying/comment_replying.scss b/web/app/components/comment/_replying/comment_replying.scss index 2980cf57..93d5a0f8 100644 --- a/web/app/components/comment/_replying/comment_replying.scss +++ b/web/app/components/comment/_replying/comment_replying.scss @@ -9,7 +9,7 @@ } // it isn't mobile first, but it's fine here - @media (-moz-touch-enabled: 1) and (max-width: 768px), (pointer:coarse) and (max-width: 768px) { + @media (-moz-touch-enabled: 1) and (max-width: 768px), (pointer: coarse) and (max-width: 768px) { border: 8px solid #eee; padding-bottom: 0; diff --git a/web/app/components/comment/_useless/comment_useless.scss b/web/app/components/comment/_useless/comment_useless.scss index 17d1393b..32144f07 100644 --- a/web/app/components/comment/_useless/comment_useless.scss +++ b/web/app/components/comment/_useless/comment_useless.scss @@ -1,5 +1,5 @@ .comment_useless { .comment__body { - opacity: .35; + opacity: 0.35; } } diff --git a/web/app/components/comment/_view/_admin/comment_view_admin.scss b/web/app/components/comment/_view/_admin/comment_view_admin.scss index d058caad..17221e1e 100644 --- a/web/app/components/comment/_view/_admin/comment_view_admin.scss +++ b/web/app/components/comment/_view/_admin/comment_view_admin.scss @@ -1,5 +1,5 @@ .comment_view_admin { .comment__username { color: #0e7e9d; - }; -} \ No newline at end of file + } +} diff --git a/web/app/components/comment/_view/_preview/comment_view_preview.scss b/web/app/components/comment/_view/_preview/comment_view_preview.scss index d06478f0..a43eaf1b 100644 --- a/web/app/components/comment/_view/_preview/comment_view_preview.scss +++ b/web/app/components/comment/_view/_preview/comment_view_preview.scss @@ -4,7 +4,7 @@ .comment__username { color: #0aa; - }; + } .comment__info { display: inline; diff --git a/web/app/components/comment/_view/_user/comment_view_user.scss b/web/app/components/comment/_view/_user/comment_view_user.scss index cef05242..85547936 100644 --- a/web/app/components/comment/_view/_user/comment_view_user.scss +++ b/web/app/components/comment/_view/_user/comment_view_user.scss @@ -1,6 +1,7 @@ .comment_view_user { &.comment_collapsed { - .comment__text, .comment__actions { + .comment__text, + .comment__actions { display: block; } } diff --git a/web/app/components/input/__button/_type/_preview/input__button_type_preview.scss b/web/app/components/input/__button/_type/_preview/input__button_type_preview.scss index 5bbeaca8..dfff3f52 100644 --- a/web/app/components/input/__button/_type/_preview/input__button_type_preview.scss +++ b/web/app/components/input/__button/_type/_preview/input__button_type_preview.scss @@ -2,7 +2,8 @@ background: #fff; color: #000; - &:hover, &:focus { + &:hover, + &:focus { box-shadow: inset 0 0 0 2px #0aa; color: #099; } diff --git a/web/app/components/input/__button/_type/_send/input__button_type_send.scss b/web/app/components/input/__button/_type/_send/input__button_type_send.scss index 313b0f5a..cf24b329 100644 --- a/web/app/components/input/__button/_type/_send/input__button_type_send.scss +++ b/web/app/components/input/__button/_type/_send/input__button_type_send.scss @@ -1,8 +1,9 @@ .input__button_type_send { - background: #259C9A; + background: #259c9a; color: #fff; - &:hover, &:focus { + &:hover, + &:focus { background: #0aa; } } diff --git a/web/app/components/input/__button/input__button.scss b/web/app/components/input/__button/input__button.scss index 1424ed0f..e8c4806c 100644 --- a/web/app/components/input/__button/input__button.scss +++ b/web/app/components/input/__button/input__button.scss @@ -12,7 +12,7 @@ } &:disabled { - opacity: .5; + opacity: 0.5; pointer-events: none; } } diff --git a/web/app/components/input/__field/input__field.scss b/web/app/components/input/__field/input__field.scss index 6a7f42f0..18183e70 100644 --- a/web/app/components/input/__field/input__field.scss +++ b/web/app/components/input/__field/input__field.scss @@ -21,7 +21,7 @@ transform: translateZ(0); // let's try to fix blinking in Safari, again &:focus { - box-shadow: inset 0 0 0 2px #259C9A; + box-shadow: inset 0 0 0 2px #259c9a; outline: none; } diff --git a/web/app/components/raw-content/raw-content.scss b/web/app/components/raw-content/raw-content.scss index 1d471c33..386bcded 100644 --- a/web/app/components/raw-content/raw-content.scss +++ b/web/app/components/raw-content/raw-content.scss @@ -30,7 +30,12 @@ max-height: 300px; } - h1, h2, h3, h4, h5, h6 { + h1, + h2, + h3, + h4, + h5, + h6 { &:first-child { margin-top: 0; } @@ -58,7 +63,8 @@ font-weight: 600; } - th, td { + th, + td { padding: 6px 13px; border: 1px solid #dfe2e5; } @@ -77,7 +83,7 @@ padding: 0.2em 0.4em; margin: 0; font-size: 85%; - background-color: rgba(#1b1f23, .05); + background-color: rgba(#1b1f23, 0.05); border-radius: 3px; } @@ -115,8 +121,10 @@ } } - sup, sub { - sup, sub { + sup, + sub { + sup, + sub { vertical-align: middle; // to prevent some visual cheats } } diff --git a/web/app/components/root/__show-more/root__show-more.scss b/web/app/components/root/__show-more/root__show-more.scss index 8c171808..c3186bf4 100644 --- a/web/app/components/root/__show-more/root__show-more.scss +++ b/web/app/components/root/__show-more/root__show-more.scss @@ -5,7 +5,7 @@ height: 36px; margin: 20px auto; padding: 0; - background: #259C9A; + background: #259c9a; border-radius: 4px; border: 0; font-size: 14px; @@ -14,7 +14,8 @@ color: #fff; cursor: pointer; - &:hover, &:focus { + &:hover, + &:focus { background: #0aa; } diff --git a/web/app/counter.js b/web/app/counter.js index c3bd53c5..19bd7c2d 100644 --- a/web/app/counter.js +++ b/web/app/counter.js @@ -13,7 +13,7 @@ function init() { const nodes = [].slice.call(document.getElementsByClassName(COUNTER_NODE_CLASSNAME)); if (!nodes) { - console.error('Remark42: Can\'t find counter nodes.'); + console.error("Remark42: Can't find counter nodes."); return; } @@ -34,9 +34,7 @@ function init() { return acc; }, {}); - api.getCommentsCount({ urls: Object.keys(map), siteId: remark_config.site_id }) - .then(res => { - res.forEach(item => (map[item.url].innerHTML = item.count)); - }); + api.getCommentsCount({ urls: Object.keys(map), siteId: remark_config.site_id }).then(res => { + res.forEach(item => (map[item.url].innerHTML = item.count)); + }); } - diff --git a/web/app/embed.js b/web/app/embed.js index 3db9101d..dfb418e2 100644 --- a/web/app/embed.js +++ b/web/app/embed.js @@ -11,7 +11,7 @@ function init() { const node = document.getElementById(NODE_ID); if (!node) { - console.error('Remark42: Can\'t find root node.'); + console.error("Remark42: Can't find root node."); return; } @@ -79,4 +79,3 @@ function init() { } } } - diff --git a/web/app/testUtils/index.js b/web/app/testUtils/index.js index e1e5abc6..e652394e 100644 --- a/web/app/testUtils/index.js +++ b/web/app/testUtils/index.js @@ -3,7 +3,7 @@ export function createDomContainer(setup) { beforeAll(() => { domContainer = document.createElement('div'); (document.body || document.documentElement).appendChild(domContainer); - setup({domContainer}); + setup({ domContainer }); }); beforeEach(() => { diff --git a/web/babelOptions.js b/web/babelOptions.js index 9c57a29b..4c7e0cae 100644 --- a/web/babelOptions.js +++ b/web/babelOptions.js @@ -1,15 +1,14 @@ module.exports = { presets: [ - ['env', { - targets: { - browsers: ['> 1%', 'android >= 4.4.4', 'ios >= 9', 'IE >= 11'] + [ + 'env', + { + targets: { + browsers: ['> 1%', 'android >= 4.4.4', 'ios >= 9', 'IE >= 11'], + }, + useBuiltIns: true, }, - useBuiltIns: true, - }], - ], - plugins: [ - 'syntax-dynamic-import', - 'transform-object-rest-spread', - ['transform-react-jsx', { 'pragma': 'h' }] + ], ], + plugins: ['syntax-dynamic-import', 'transform-object-rest-spread', ['transform-react-jsx', { pragma: 'h' }]], }; diff --git a/web/fileTransformer.js b/web/fileTransformer.js index bb6dd584..39711fa4 100644 --- a/web/fileTransformer.js +++ b/web/fileTransformer.js @@ -1,7 +1,6 @@ -const {createTransformer} = require(`babel-jest`); +const { createTransformer } = require(`babel-jest`); const babelOptions = require('./babelOptions'); - module.exports = createTransformer({ babelrc: false, ...babelOptions, diff --git a/web/webpack.config.js b/web/webpack.config.js index df89255d..38689684 100644 --- a/web/webpack.config.js +++ b/web/webpack.config.js @@ -28,15 +28,15 @@ const commonStyleLoaders = [ require('postcss-url')({ url: 'inline', maxSize: 5 }), require('postcss-wrap')({ selector: `#${NODE_ID}` }), require('postcss-csso'), - ] - } + ], + }, }, { loader: 'sass-loader', options: { includePaths: [path.resolve(__dirname, 'app')], - } - } + }, + }, ]; module.exports = { @@ -50,11 +50,11 @@ module.exports = { output: { path: publicFolder, filename: `[name].js`, - chunkFilename: '[name].js' + chunkFilename: '[name].js', }, resolve: { extensions: ['.jsx', '.js'], - modules: [path.resolve(__dirname, 'app'), path.resolve(__dirname, 'node_modules')] + modules: [path.resolve(__dirname, 'app'), path.resolve(__dirname, 'node_modules')], }, module: { rules: [ @@ -64,30 +64,28 @@ module.exports = { use: { loader: 'babel-loader', options: babelOptions, - } + }, }, { test: /\.scss$/, - use: env === 'production' - ? ExtractText.extract({ - fallback: 'style-loader', - use: commonStyleLoaders, - }) - : [ - 'style-loader', - ...commonStyleLoaders, - ], + use: + env === 'production' + ? ExtractText.extract({ + fallback: 'style-loader', + use: commonStyleLoaders, + }) + : ['style-loader', ...commonStyleLoaders], }, { test: /\.(png|jpg|jpeg|gif|svg)$/, use: { loader: 'file-loader', options: { - name: `files/[name].[hash].[ext]` - } - } - } - ] + name: `files/[name].[hash].[ext]`, + }, + }, + }, + ], }, plugins: [ new Clean(publicFolder), @@ -114,32 +112,38 @@ module.exports = { filename: 'last-comments.html', inject: false, }), - ...(env === 'production' ? [] : [new Html({ - template: path.resolve(__dirname, 'dev.ejs'), - filename: 'dev.html', - inject: false, - })]), + ...(env === 'production' + ? [] + : [ + new Html({ + template: path.resolve(__dirname, 'dev.ejs'), + filename: 'dev.html', + inject: false, + }), + ]), new ExtractText({ filename: `remark.css`, - allChunks: true + allChunks: true, }), new webpack.optimize.ModuleConcatenationPlugin(), ...(env === 'production' ? [new webpack.optimize.UglifyJsPlugin()] : []), - ...(process.env.CI === 'true' ? [] : [ - new BundleAnalyze({ - analyzerMode: 'static', - reportFilename: 'report.html', - defaultSizes: 'parsed', - generateStatsFile: false, - logLevel: 'info', - openAnalyzer: false - }) - ]), + ...(process.env.CI === 'true' + ? [] + : [ + new BundleAnalyze({ + analyzerMode: 'static', + reportFilename: 'report.html', + defaultSizes: 'parsed', + generateStatsFile: false, + logLevel: 'info', + openAnalyzer: false, + }), + ]), new Copy(['./iframe.html']), ], watch: env === 'dev', watchOptions: { - ignored: /(node_modules|\.vendor\.js$)/ + ignored: /(node_modules|\.vendor\.js$)/, }, devServer: { host: '0.0.0.0',