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-useless-escape': ['off'],
'no-multi-spaces': ['warn'], 'no-multi-spaces': ['warn'],
'no-control-regex': ['warn'], 'no-control-regex': ['warn'],
'no-empty': ['warn'],
'@typescript-eslint/no-var-requires': ['warn'], '@typescript-eslint/no-var-requires': ['warn'],
'@typescript-eslint/no-inferrable-types': ['warn'], '@typescript-eslint/no-inferrable-types': ['warn'],
'@typescript-eslint/no-empty-function': ['off'], '@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; if (!treeAdapter.isElementNode(node)) return;
switch (node.nodeName) { switch (node.nodeName) {
case 'br': case 'br': {
text += '\n'; text += '\n';
break; break;
}
case 'a': case 'a': {
const txt = getText(node); const txt = getText(node);
const rel = node.attrs.find(x => x.name === 'rel'); const rel = node.attrs.find(x => x.name === 'rel');
const href = node.attrs.find(x => x.name === 'href'); const href = node.attrs.find(x => x.name === 'href');
@ -87,8 +88,9 @@ export function fromHtml(html: string, hashtagNames?: string[]): string {
text += generateLink(); text += generateLink();
} }
break; break;
}
case 'p': case 'p': {
text += '\n\n'; text += '\n\n';
if (node.childNodes) { if (node.childNodes) {
for (const n of node.childNodes) { for (const n of node.childNodes) {
@ -96,8 +98,9 @@ export function fromHtml(html: string, hashtagNames?: string[]): string {
} }
} }
break; break;
}
default: default: {
if (node.childNodes) { if (node.childNodes) {
for (const n of node.childNodes) { for (const n of node.childNodes) {
analyze(n); analyze(n);
@ -107,3 +110,4 @@ export function fromHtml(html: string, hashtagNames?: string[]): string {
} }
} }
} }
}

View File

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

View File

@ -6,7 +6,7 @@
* @param last URL of last page (optional) * @param last URL of last page (optional)
* @param orderedItems attached objects (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 = { const page: any = {
id, id,
type: 'OrderedCollection', type: 'OrderedCollection',