Update prettier
This commit is contained in:
committed by
Umputun
parent
11f222c6e3
commit
71e0e98e05
@@ -4,7 +4,7 @@ if (!Element.prototype.matches) {
|
||||
}
|
||||
|
||||
if (!Element.prototype.closest) {
|
||||
Element.prototype.closest = function(s: string) {
|
||||
Element.prototype.closest = function (s: string) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-this-alias
|
||||
let el: any = this;
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ const authPanelMessages = defineMessages({
|
||||
},
|
||||
});
|
||||
|
||||
export default function() {
|
||||
export default function () {
|
||||
const dispatch = useDispatch();
|
||||
const provider = useSelector<StoreState, ProviderState>(store => store.provider);
|
||||
const user = useSelector<StoreState, User | null>(store => store.user);
|
||||
|
||||
+3
-6
@@ -32,11 +32,8 @@ describe('<SubscribeByRSS/>', () => {
|
||||
});
|
||||
|
||||
it('should have userId in site link', () => {
|
||||
expect(
|
||||
wrapper
|
||||
.find('.comment-form__rss-dropdown__link')
|
||||
.at(1)
|
||||
.prop('href')
|
||||
).toEqual(createSubscribeUrl('site', '&user=user-1'));
|
||||
expect(wrapper.find('.comment-form__rss-dropdown__link').at(1).prop('href')).toEqual(
|
||||
createSubscribeUrl('site', '&user=user-1')
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -552,18 +552,20 @@ export class CommentForm extends Component<Props, State> {
|
||||
)}
|
||||
</div>
|
||||
|
||||
{// TODO: it can be more elegant;
|
||||
// for example it can render full comment component here (or above textarea on mobile)
|
||||
!!preview && (
|
||||
<div className="comment-form__preview-wrapper">
|
||||
<div
|
||||
className={b('comment-form__preview', {
|
||||
mix: b('raw-content', {}, { theme: props.theme }),
|
||||
})}
|
||||
dangerouslySetInnerHTML={{ __html: preview }}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{
|
||||
// TODO: it can be more elegant;
|
||||
// for example it can render full comment component here (or above textarea on mobile)
|
||||
!!preview && (
|
||||
<div className="comment-form__preview-wrapper">
|
||||
<div
|
||||
className={b('comment-form__preview', {
|
||||
mix: b('raw-content', {}, { theme: props.theme }),
|
||||
})}
|
||||
dangerouslySetInnerHTML={{ __html: preview }}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -158,22 +158,12 @@ describe('<Comment />', () => {
|
||||
const voteButtons = element.find('.comment__vote');
|
||||
expect(voteButtons.length).toStrictEqual(2);
|
||||
|
||||
expect(
|
||||
voteButtons
|
||||
.at(0)
|
||||
.getDOMNode()
|
||||
.getAttribute('aria-disabled')
|
||||
).toStrictEqual('true');
|
||||
expect(voteButtons.at(0).getDOMNode().getAttribute('aria-disabled')).toStrictEqual('true');
|
||||
voteButtons.at(0).simulate('click');
|
||||
await sleep(100);
|
||||
expect(voteSpy).not.toBeCalled();
|
||||
|
||||
expect(
|
||||
voteButtons
|
||||
.at(1)
|
||||
.getDOMNode()
|
||||
.getAttribute('aria-disabled')
|
||||
).toStrictEqual('false');
|
||||
expect(voteButtons.at(1).getDOMNode().getAttribute('aria-disabled')).toStrictEqual('false');
|
||||
voteButtons.at(1).simulate('click');
|
||||
await sleep(100);
|
||||
expect(voteSpy).toBeCalled();
|
||||
@@ -192,22 +182,12 @@ describe('<Comment />', () => {
|
||||
const voteButtons = element.find('.comment__vote');
|
||||
expect(voteButtons.length).toStrictEqual(2);
|
||||
|
||||
expect(
|
||||
voteButtons
|
||||
.at(1)
|
||||
.getDOMNode()
|
||||
.getAttribute('aria-disabled')
|
||||
).toStrictEqual('true');
|
||||
expect(voteButtons.at(1).getDOMNode().getAttribute('aria-disabled')).toStrictEqual('true');
|
||||
voteButtons.at(1).simulate('click');
|
||||
await sleep(100);
|
||||
expect(voteSpy).not.toBeCalled();
|
||||
|
||||
expect(
|
||||
voteButtons
|
||||
.at(0)
|
||||
.getDOMNode()
|
||||
.getAttribute('aria-disabled')
|
||||
).toStrictEqual('false');
|
||||
expect(voteButtons.at(0).getDOMNode().getAttribute('aria-disabled')).toStrictEqual('false');
|
||||
voteButtons.at(0).simulate('click');
|
||||
await sleep(100);
|
||||
expect(voteSpy).toBeCalled();
|
||||
|
||||
@@ -37,7 +37,7 @@ function init(): void {
|
||||
}, {});
|
||||
|
||||
const oReq = new XMLHttpRequest();
|
||||
oReq.onreadystatechange = function(this: XMLHttpRequest) {
|
||||
oReq.onreadystatechange = function (this: XMLHttpRequest) {
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
try {
|
||||
const res = JSON.parse(this.responseText) as { url: string; count: number }[];
|
||||
|
||||
+57
-57
@@ -1,57 +1,57 @@
|
||||
/* eslint-disable no-console */
|
||||
import loadPolyfills from '@app/common/polyfills';
|
||||
import { NODE_ID } from '@app/common/constants';
|
||||
import { approveDeleteMe, getUser } from '@app/common/api';
|
||||
import { token } from '@app/common/settings';
|
||||
import { ApiError } from './common/types';
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
|
||||
async function init(): Promise<void> {
|
||||
__webpack_public_path__ = window.location.origin + '/web/';
|
||||
|
||||
await loadPolyfills();
|
||||
|
||||
const node = document.getElementById(NODE_ID);
|
||||
|
||||
if (!node) {
|
||||
console.error("Remark42: Can't find root node.");
|
||||
return;
|
||||
}
|
||||
|
||||
getUser().then(user => {
|
||||
if (!user || !user.admin) {
|
||||
handleNotAuthorizedError(node);
|
||||
return;
|
||||
}
|
||||
|
||||
approveDeleteMe(token!).then(
|
||||
data => {
|
||||
node.innerHTML = `
|
||||
<h3>User deleted successfully</h3>
|
||||
<pre>${JSON.stringify(data, null, 4)}</pre>
|
||||
`;
|
||||
},
|
||||
(err: Error | ApiError | string) => {
|
||||
const message =
|
||||
err instanceof Error ? err.message : typeof err === 'object' && err !== null && err.error ? err.error : err;
|
||||
console.error(err);
|
||||
node.innerHTML = `
|
||||
<h3>Something went wrong</h3>
|
||||
<pre>${message}</pre>
|
||||
`;
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function handleNotAuthorizedError(node: HTMLElement): void {
|
||||
node.innerHTML = `
|
||||
<h3>You are not logged in</h3>
|
||||
<p><a href='/web' target='_blank'>Sign in</a> as admin to delete user information</p>
|
||||
`;
|
||||
}
|
||||
/* eslint-disable no-console */
|
||||
import loadPolyfills from '@app/common/polyfills';
|
||||
import { NODE_ID } from '@app/common/constants';
|
||||
import { approveDeleteMe, getUser } from '@app/common/api';
|
||||
import { token } from '@app/common/settings';
|
||||
import { ApiError } from './common/types';
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
|
||||
async function init(): Promise<void> {
|
||||
__webpack_public_path__ = window.location.origin + '/web/';
|
||||
|
||||
await loadPolyfills();
|
||||
|
||||
const node = document.getElementById(NODE_ID);
|
||||
|
||||
if (!node) {
|
||||
console.error("Remark42: Can't find root node.");
|
||||
return;
|
||||
}
|
||||
|
||||
getUser().then(user => {
|
||||
if (!user || !user.admin) {
|
||||
handleNotAuthorizedError(node);
|
||||
return;
|
||||
}
|
||||
|
||||
approveDeleteMe(token!).then(
|
||||
data => {
|
||||
node.innerHTML = `
|
||||
<h3>User deleted successfully</h3>
|
||||
<pre>${JSON.stringify(data, null, 4)}</pre>
|
||||
`;
|
||||
},
|
||||
(err: Error | ApiError | string) => {
|
||||
const message =
|
||||
err instanceof Error ? err.message : typeof err === 'object' && err !== null && err.error ? err.error : err;
|
||||
console.error(err);
|
||||
node.innerHTML = `
|
||||
<h3>Something went wrong</h3>
|
||||
<pre>${message}</pre>
|
||||
`;
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function handleNotAuthorizedError(node: HTMLElement): void {
|
||||
node.innerHTML = `
|
||||
<h3>You are not logged in</h3>
|
||||
<p><a href='/web' target='_blank'>Sign in</a> as admin to delete user information</p>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ export default function debounce<T extends any[]>(
|
||||
wait: number = 1000
|
||||
): (...args: Parameters<typeof fn>) => void {
|
||||
let timeout: number | undefined;
|
||||
return function(this: any, ...args): void {
|
||||
return function (this: any, ...args): void {
|
||||
const laterCall = (): unknown => fn.apply(this, args);
|
||||
window.clearTimeout(timeout);
|
||||
timeout = window.setTimeout(laterCall, wait);
|
||||
|
||||
Generated
+3
-3
@@ -19832,9 +19832,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "1.19.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
|
||||
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz",
|
||||
"integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==",
|
||||
"dev": true
|
||||
},
|
||||
"prettier-linter-helpers": {
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"postcss-simple-vars": "^5.0.2",
|
||||
"postcss-url": "^8.0.0",
|
||||
"postcss-wrap": "0.0.4",
|
||||
"prettier": "^1.19.1",
|
||||
"prettier": "^2.0.5",
|
||||
"redux-mock-store": "^1.5.4",
|
||||
"size-limit": "^4.4.5",
|
||||
"style-loader": "^1.1.3",
|
||||
|
||||
Reference in New Issue
Block a user