fix lint warnings

This commit is contained in:
Konstantin Schaper
2020-10-16 09:40:10 +02:00
parent af09435f51
commit 47aa05dfe0
5 changed files with 117 additions and 77 deletions

View File

@@ -772,6 +772,7 @@
<exclude>**/logback.ci.xml</exclude> <exclude>**/logback.ci.xml</exclude>
<exclude>**/pkg/ourPackage/scm-source.properties</exclude> <exclude>**/pkg/ourPackage/scm-source.properties</exclude>
<exclude>**/.vagrant/**</exclude> <exclude>**/.vagrant/**</exclude>
<exclude>**/*.css</exclude>
</excludes> </excludes>
<mapping> <mapping>
<tsx>SLASHSTAR_STYLE</tsx> <tsx>SLASHSTAR_STYLE</tsx>

View File

@@ -24,8 +24,12 @@
import React, { FC, useReducer } from "react"; import React, { FC, useReducer } from "react";
import { Repository, AnnotatedSource, AnnotatedLine } from "@scm-manager/ui-types"; import { Repository, AnnotatedSource, AnnotatedLine } from "@scm-manager/ui-types";
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore // @ts-ignore
import { PrismAsyncLight as ReactSyntaxHighlighter, createElement } from "react-syntax-highlighter"; import { PrismAsyncLight as ReactSyntaxHighlighter, createElement } from "react-syntax-highlighter";
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
// eslint-disable-next-line no-restricted-imports
import highlightingTheme from "@scm-manager/ui-styles/src/syntax-highlighting.js"; import highlightingTheme from "@scm-manager/ui-styles/src/syntax-highlighting.js";
import { DateInput } from "../../useDateFormatter"; import { DateInput } from "../../useDateFormatter";
import Popover from "./Popover"; import Popover from "./Popover";

View File

@@ -22,11 +22,41 @@
* SOFTWARE. * SOFTWARE.
*/ */
// eslint-disable-next-line import/no-extraneous-dependencies
const css = require("css");
// eslint-disable-next-line import/no-extraneous-dependencies
const prettier = require("prettier");
// eslint-disable-next-line import/no-extraneous-dependencies
const camel = require("to-camel-case");
const path = require("path"); const path = require("path");
const fs = require("fs"); const fs = require("fs");
const css = require("css");
const camel = require("to-camel-case"); const licenseHeader = `/*
const prettier = require("prettier"); * MIT License
*
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/`;
function createJavascriptStyleSheet(directory, inputFile, outputFile) { function createJavascriptStyleSheet(directory, inputFile, outputFile) {
fs.readFile(path.join(__dirname, `${directory}/${inputFile}`), "utf-8", (err, data) => { fs.readFile(path.join(__dirname, `${directory}/${inputFile}`), "utf-8", (err, data) => {
@@ -42,12 +72,14 @@ function createJavascriptStyleSheet(directory, inputFile, outputFile) {
(camelCaseDeclarationProp[0] === "o" && !camelCaseDeclarationProp.includes("overflow")) (camelCaseDeclarationProp[0] === "o" && !camelCaseDeclarationProp.includes("overflow"))
? `${camelCaseDeclarationProp.substring(0, 1).toUpperCase()}${camelCaseDeclarationProp.substring(1)}` ? `${camelCaseDeclarationProp.substring(0, 1).toUpperCase()}${camelCaseDeclarationProp.substring(1)}`
: camelCaseDeclarationProp; : camelCaseDeclarationProp;
// eslint-disable-next-line no-param-reassign
declarations[key] = declaration.value; declarations[key] = declaration.value;
} }
return declarations; return declarations;
}, {}); }, {});
if (selector.substring(0, 6) === ".token") { if (selector.substring(0, 6) === ".token") {
// eslint-disable-next-line no-param-reassign
selector = selector.substring(7); selector = selector.substring(7);
// Regex to fix Prism theme selectors // Regex to fix Prism theme selectors
@@ -55,15 +87,20 @@ function createJavascriptStyleSheet(directory, inputFile, outputFile) {
// - Remove the space (descendant combinator) // - Remove the space (descendant combinator)
// to allow for styling multiple classes // to allow for styling multiple classes
// Ref: https://github.com/react-syntax-highlighter/react-syntax-highlighter/pull/305 // Ref: https://github.com/react-syntax-highlighter/react-syntax-highlighter/pull/305
// eslint-disable-next-line no-param-reassign
selector = selector.replace(/(?<=\w) (\.token)?(?=\.)/g, ""); selector = selector.replace(/(?<=\w) (\.token)?(?=\.)/g, "");
} }
// eslint-disable-next-line no-param-reassign
selectors[selector] = selectorObject; selectors[selector] = selectorObject;
return selectors; return selectors;
}, {}); }, {});
// eslint-disable-next-line no-param-reassign
sheet = Object.keys(style).reduce((stylesheet, selector) => { sheet = Object.keys(style).reduce((stylesheet, selector) => {
if (stylesheet[selector]) { if (stylesheet[selector]) {
// eslint-disable-next-line
stylesheet[selector] = { ...stylesheet[selector], ...style[selector] }; stylesheet[selector] = { ...stylesheet[selector], ...style[selector] };
} else { } else {
// eslint-disable-next-line no-param-reassign
stylesheet[selector] = style[selector]; stylesheet[selector] = style[selector];
} }
return stylesheet; return stylesheet;
@@ -73,7 +110,9 @@ function createJavascriptStyleSheet(directory, inputFile, outputFile) {
}, {}); }, {});
fs.writeFile( fs.writeFile(
path.join(__dirname, directory, outputFile), path.join(__dirname, directory, outputFile),
prettier.format(`/* --- DO NOT EDIT --- */ prettier.format(`${licenseHeader}
/* --- DO NOT EDIT --- */
/* Auto-generated from ${inputFile} */ /* Auto-generated from ${inputFile} */
export default ${JSON.stringify(javacriptStylesheet, null, 2)}`), export default ${JSON.stringify(javacriptStylesheet, null, 2)}`),
@@ -82,4 +121,4 @@ function createJavascriptStyleSheet(directory, inputFile, outputFile) {
}); });
} }
createJavascriptStyleSheet(path.join("..", "src"), "syntax-highlighting.css", "syntax-highlighting.js"); createJavascriptStyleSheet(path.join("..", "src"), "syntax-highlighting.css", "syntax-highlighting.ts");

View File

@@ -47,7 +47,6 @@
*/ */
pre[class*="language-"], pre[class*="language-"],
code[class*="language-"] { code[class*="language-"] {
color: #363636; color: #363636;
@@ -87,11 +86,8 @@ code[class*="language-"] {
} }
pre[class*="language-"]::selection, pre[class*="language-"]::selection,
code[class*="language-"]::selection, code[class*="language-"]::selection,
pre[class*="language-"]::mozselection, pre[class*="language-"]::mozselection,
code[class*="language-"]::mozselection { code[class*="language-"]::mozselection {
text-shadow: none; text-shadow: none;
@@ -103,7 +99,6 @@ code[class*="language-"]::mozselection {
@media print { @media print {
pre[class*="language-"], pre[class*="language-"],
code[class*="language-"] { code[class*="language-"] {
text-shadow: none; text-shadow: none;
@@ -149,11 +144,8 @@ pre[class*="language-"] {
} }
.token.comment, .token.comment,
.token.prolog, .token.prolog,
.token.doctype, .token.doctype,
.token.cdata { .token.cdata {
color: #9a9a9a; color: #9a9a9a;
@@ -167,17 +159,11 @@ pre[class*="language-"] {
} }
.token.property, .token.property,
.token.tag, .token.tag,
.token.boolean, .token.boolean,
.token.number, .token.number,
.token.constant, .token.constant,
.token.symbol, .token.symbol,
.token.deleted { .token.deleted {
color: #2c99c7; color: #2c99c7;
@@ -185,15 +171,10 @@ pre[class*="language-"] {
} }
.token.selector, .token.selector,
.token.attr-name, .token.attr-name,
.token.string, .token.string,
.token.char, .token.char,
.token.builtin, .token.builtin,
.token.inserted { .token.inserted {
color: #cca201; color: #cca201;
@@ -201,13 +182,9 @@ pre[class*="language-"] {
} }
.token.operator, .token.operator,
.token.entity, .token.entity,
.token.url, .token.url,
.language-css .token.string, .language-css .token.string,
.style .token.string { .style .token.string {
color: #686868; color: #686868;
@@ -217,9 +194,7 @@ pre[class*="language-"] {
} }
.token.atrule, .token.atrule,
.token.attr-value, .token.attr-value,
.token.keyword { .token.keyword {
color: #00a984; color: #00a984;
@@ -233,9 +208,7 @@ pre[class*="language-"] {
} }
.token.regex, .token.regex,
.token.important, .token.important,
.token.variable { .token.variable {
color: #a74eb2; color: #a74eb2;
@@ -243,7 +216,6 @@ pre[class*="language-"] {
} }
.token.important, .token.important,
.token.bold { .token.bold {
font-weight: bold; font-weight: bold;

View File

@@ -1,3 +1,27 @@
/*
* MIT License
*
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* --- DO NOT EDIT --- */ /* --- DO NOT EDIT --- */
/* Auto-generated from syntax-highlighting.css */ /* Auto-generated from syntax-highlighting.css */
@@ -23,7 +47,7 @@ export default {
padding: "1em", padding: "1em",
margin: ".5em 0", margin: ".5em 0",
overflow: "auto", overflow: "auto",
background: "#ffffff" background: "#ffffff",
}, },
'code[class*="language-"]': { 'code[class*="language-"]': {
color: "#363636", color: "#363636",
@@ -42,142 +66,142 @@ export default {
WebkitHyphens: "none", WebkitHyphens: "none",
MozHyphens: "none", MozHyphens: "none",
msHyphens: "none", msHyphens: "none",
hyphens: "none" hyphens: "none",
}, },
'pre[class*="language-"]::selection': { 'pre[class*="language-"]::selection': {
textShadow: "none", textShadow: "none",
background: "#7fe3cd" background: "#7fe3cd",
}, },
'code[class*="language-"]::selection': { 'code[class*="language-"]::selection': {
textShadow: "none", textShadow: "none",
background: "#7fe3cd" background: "#7fe3cd",
}, },
'pre[class*="language-"]::mozselection': { 'pre[class*="language-"]::mozselection': {
textShadow: "none", textShadow: "none",
background: "#7fe3cd" background: "#7fe3cd",
}, },
'code[class*="language-"]::mozselection': { 'code[class*="language-"]::mozselection': {
textShadow: "none", textShadow: "none",
background: "#7fe3cd" background: "#7fe3cd",
}, },
':not(pre) > code[class*="language-"]': { ':not(pre) > code[class*="language-"]': {
padding: ".1em .3em", padding: ".1em .3em",
borderRadius: ".3em", borderRadius: ".3em",
color: "#ff3860", color: "#ff3860",
background: "#fbe7eb" background: "#fbe7eb",
}, },
".namespace": { ".namespace": {
Opacity: ".7" Opacity: ".7",
}, },
comment: { comment: {
color: "#9a9a9a" color: "#9a9a9a",
}, },
prolog: { prolog: {
color: "#9a9a9a" color: "#9a9a9a",
}, },
doctype: { doctype: {
color: "#9a9a9a" color: "#9a9a9a",
}, },
cdata: { cdata: {
color: "#9a9a9a" color: "#9a9a9a",
}, },
punctuation: { punctuation: {
color: "#9a9a9a" color: "#9a9a9a",
}, },
property: { property: {
color: "#2c99c7" color: "#2c99c7",
}, },
tag: { tag: {
color: "#2c99c7" color: "#2c99c7",
}, },
boolean: { boolean: {
color: "#2c99c7" color: "#2c99c7",
}, },
number: { number: {
color: "#2c99c7" color: "#2c99c7",
}, },
constant: { constant: {
color: "#2c99c7" color: "#2c99c7",
}, },
symbol: { symbol: {
color: "#2c99c7" color: "#2c99c7",
}, },
deleted: { deleted: {
color: "#2c99c7" color: "#2c99c7",
}, },
selector: { selector: {
color: "#cca201" color: "#cca201",
}, },
"attr-name": { "attr-name": {
color: "#cca201" color: "#cca201",
}, },
string: { string: {
color: "#cca201" color: "#cca201",
}, },
char: { char: {
color: "#cca201" color: "#cca201",
}, },
builtin: { builtin: {
color: "#cca201" color: "#cca201",
}, },
inserted: { inserted: {
color: "#cca201" color: "#cca201",
}, },
operator: { operator: {
color: "#686868", color: "#686868",
background: "#ffffff" background: "#ffffff",
}, },
entity: { entity: {
color: "#686868", color: "#686868",
background: "#ffffff", background: "#ffffff",
cursor: "help" cursor: "help",
}, },
url: { url: {
color: "#686868", color: "#686868",
background: "#ffffff" background: "#ffffff",
}, },
".language-css .token.string": { ".language-css .token.string": {
color: "#686868", color: "#686868",
background: "#ffffff" background: "#ffffff",
}, },
".style .token.string": { ".style .token.string": {
color: "#686868", color: "#686868",
background: "#ffffff" background: "#ffffff",
}, },
atrule: { atrule: {
color: "#00a984" color: "#00a984",
}, },
"attr-value": { "attr-value": {
color: "#00a984" color: "#00a984",
}, },
keyword: { keyword: {
color: "#00a984" color: "#00a984",
}, },
function: { function: {
color: "#ff3860" color: "#ff3860",
}, },
regex: { regex: {
color: "#a74eb2" color: "#a74eb2",
}, },
important: { important: {
color: "#a74eb2", color: "#a74eb2",
fontWeight: "bold" fontWeight: "bold",
}, },
variable: { variable: {
color: "#a74eb2" color: "#a74eb2",
}, },
bold: { bold: {
fontWeight: "bold" fontWeight: "bold",
}, },
italic: { italic: {
fontStyle: "italic" fontStyle: "italic",
}, },
"pre[data-line]": { "pre[data-line]": {
position: "relative" position: "relative",
}, },
'pre[class*="language-"] > code[class*="language-"]': { 'pre[class*="language-"] > code[class*="language-"]': {
position: "relative", position: "relative",
zIndex: "1" zIndex: "1",
}, },
".line-highlight": { ".line-highlight": {
position: "absolute", position: "absolute",
@@ -190,6 +214,6 @@ export default {
zIndex: "0", zIndex: "0",
pointerEvents: "none", pointerEvents: "none",
lineHeight: "inherit", lineHeight: "inherit",
whiteSpace: "pre" whiteSpace: "pre",
} },
}; };