Просмотр исходного кода

Merge pull request #9040 from weseek/revert-9027-fix/type-and-linting

Revert "fix: Type and linting for updating hast-util-sanitize"
reiji-h 1 год назад
Родитель
Сommit
352ba8ba1f

+ 1 - 3
apps/app/src/interfaces/services/rehype-sanitize.ts

@@ -1,6 +1,4 @@
-import type { defaultSchema } from 'hast-util-sanitize';
-
-type Attributes = typeof defaultSchema.attributes;
+import type { Attributes } from 'hast-util-sanitize/lib';
 
 export const RehypeSanitizeType = {
   RECOMMENDED: 'Recommended',

+ 0 - 9
apps/app/src/services/renderer/recommended-whitelist.spec.ts

@@ -14,9 +14,6 @@ describe('recommended-whitelist', () => {
 
   test('.attributes should return data attributes', () => {
     expect(attributes).not.toBeNull();
-
-    assert(attributes != null);
-
     expect(Object.keys(attributes)).includes('*');
     expect(attributes['*']).includes('alt');
     expect(attributes['*']).includes('align');
@@ -28,18 +25,12 @@ describe('recommended-whitelist', () => {
 
   test('.attributes should return iframe attributes', () => {
     expect(attributes).not.toBeNull();
-
-    assert(attributes != null);
-
     expect(Object.keys(attributes)).includes('iframe');
     expect(attributes.iframe).includes('src');
   });
 
   test('.attributes should return video attributes', () => {
     expect(attributes).not.toBeNull();
-
-    assert(attributes != null);
-
     expect(Object.keys(attributes)).includes('video');
     expect(attributes.iframe).includes('src');
   });

+ 1 - 2
apps/app/src/services/renderer/recommended-whitelist.ts

@@ -1,8 +1,7 @@
 import { defaultSchema } from 'hast-util-sanitize';
+import type { Attributes } from 'hast-util-sanitize/lib';
 import deepmerge from 'ts-deepmerge';
 
-type Attributes = typeof defaultSchema.attributes;
-
 /**
  * reference: https://meta.stackexchange.com/questions/1777/what-html-tags-are-allowed-on-stack-exchange-sites,
  *            https://github.com/jch/html-pipeline/blob/70b6903b025c668ff3c02a6fa382031661182147/lib/html/pipeline/sanitization_filter.rb#L41