refactor: lint

This commit is contained in:
liyasthomas
2021-05-18 14:57:29 +05:30
parent 7f248da0b3
commit cc27c552af
84 changed files with 1444 additions and 973 deletions

View File

@@ -21,7 +21,11 @@ describe("getSuitableLenses", () => {
})
const contentTypes = {
JSON: ["application/json", "application/ld+json", "application/hal+json; charset=utf8"],
JSON: [
"application/json",
"application/ld+json",
"application/hal+json; charset=utf8",
],
Image: [
"image/gif",
"image/jpeg; foo=bar",
@@ -32,11 +36,15 @@ describe("getSuitableLenses", () => {
"image/vnd.microsoft.icon",
],
HTML: ["text/html", "application/xhtml+xml", "text/html; charset=utf-8"],
XML: ["text/xml", "application/xml", "application/xhtml+xml; charset=utf-8"],
XML: [
"text/xml",
"application/xml",
"application/xhtml+xml; charset=utf-8",
],
}
lenses
.filter(({ lensName }) => lensName != rawLens.lensName)
.filter(({ lensName }) => lensName !== rawLens.lensName)
.forEach((el) => {
test(`returns ${el.lensName} lens for its content-types`, () => {
contentTypes[el.lensName].forEach((contentType) => {

View File

@@ -3,7 +3,8 @@ const htmlLens = {
isSupportedContentType: (contentType) =>
/\btext\/html|application\/xhtml\+xml\b/i.test(contentType),
renderer: "htmlres",
rendererImport: () => import("~/components/lenses/renderers/HTMLLensRenderer"),
rendererImport: () =>
import("~/components/lenses/renderers/HTMLLensRenderer"),
}
export default htmlLens

View File

@@ -1,9 +1,12 @@
const imageLens = {
lensName: "Image",
isSupportedContentType: (contentType) =>
/\bimage\/(?:gif|jpeg|png|bmp|svg\+xml|x-icon|vnd\.microsoft\.icon)\b/i.test(contentType),
/\bimage\/(?:gif|jpeg|png|bmp|svg\+xml|x-icon|vnd\.microsoft\.icon)\b/i.test(
contentType
),
renderer: "imageres",
rendererImport: () => import("~/components/lenses/renderers/ImageLensRenderer"),
rendererImport: () =>
import("~/components/lenses/renderers/ImageLensRenderer"),
}
export default imageLens

View File

@@ -1,10 +1,11 @@
import { isJSONContentType } from "../utils/contenttypes";
import { isJSONContentType } from "../utils/contenttypes"
const jsonLens = {
lensName: "JSON",
isSupportedContentType: isJSONContentType,
renderer: "json",
rendererImport: () => import("~/components/lenses/renderers/JSONLensRenderer"),
rendererImport: () =>
import("~/components/lenses/renderers/JSONLensRenderer"),
}
export default jsonLens