This commit is contained in:
syuilo 2021-09-05 14:46:51 +09:00
parent 99ca3f0fde
commit 8823ae7e85
4 changed files with 11 additions and 6 deletions

View File

@ -37,6 +37,7 @@ module.exports = {
'no-useless-escape': ['off'],
'no-multi-spaces': ['warn'],
'no-control-regex': ['warn'],
'no-empty': ['warn'],
'@typescript-eslint/no-var-requires': ['warn'],
'@typescript-eslint/no-inferrable-types': ['warn'],
'@typescript-eslint/no-empty-function': ['off'],

View File

@ -37,11 +37,12 @@ export function fromHtml(html: string, hashtagNames?: string[]): string {
if (!treeAdapter.isElementNode(node)) return;
switch (node.nodeName) {
case 'br':
case 'br': {
text += '\n';
break;
}
case 'a':
case 'a': {
const txt = getText(node);
const rel = node.attrs.find(x => x.name === 'rel');
const href = node.attrs.find(x => x.name === 'href');
@ -87,8 +88,9 @@ export function fromHtml(html: string, hashtagNames?: string[]): string {
text += generateLink();
}
break;
}
case 'p':
case 'p': {
text += '\n\n';
if (node.childNodes) {
for (const n of node.childNodes) {
@ -96,14 +98,16 @@ export function fromHtml(html: string, hashtagNames?: string[]): string {
}
}
break;
}
default:
default: {
if (node.childNodes) {
for (const n of node.childNodes) {
analyze(n);
}
}
break;
}
}
}
}

View File

@ -278,7 +278,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us
* @param resolver Resolver
* @param hint Hint of Person object (Personの場合Remote resolveをせずに更新に利用します)
*/
export async function updatePerson(uri: string, resolver?: Resolver | null, hint?: object): Promise<void> {
export async function updatePerson(uri: string, resolver?: Resolver | null, hint?: Record<string, unknown>): Promise<void> {
if (typeof uri !== 'string') throw new Error('uri is not string');
// URIがこのサーバーを指しているならスキップ

View File

@ -6,7 +6,7 @@
* @param last URL of last page (optional)
* @param orderedItems attached objects (optional)
*/
export default function(id: string | null, totalItems: any, first?: string, last?: string, orderedItems?: object) {
export default function(id: string | null, totalItems: any, first?: string, last?: string, orderedItems?: Record<string, unknown>) {
const page: any = {
id,
type: 'OrderedCollection',