mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-20 16:49:52 +00:00
Fix lints
This commit is contained in:
parent
fda5765ff6
commit
646753526b
10 changed files with 55 additions and 50 deletions
|
|
@ -4,11 +4,11 @@ AWS.config.update({ region: "us-west-2" });
|
|||
const s3 = new AWS.S3();
|
||||
|
||||
function getFile(key) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve, rejectPromise) => {
|
||||
const bucketName = "winamp2-js-skins";
|
||||
s3.getObject({ Bucket: bucketName, Key: key }, (err, data) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
rejectPromise(err);
|
||||
return;
|
||||
}
|
||||
const body = Buffer.from(data.Body).toString("utf8");
|
||||
|
|
@ -18,11 +18,11 @@ function getFile(key) {
|
|||
}
|
||||
|
||||
function putFile(key, body) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve, rejectPromise) => {
|
||||
const bucketName = "winamp2-js-skins";
|
||||
s3.putObject({ Bucket: bucketName, Key: key, Body: body }, err => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
rejectPromise(err);
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ AWS.config.update({ region: "us-west-2" });
|
|||
const s3 = new AWS.S3();
|
||||
|
||||
function getFile(key) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve, rejectPromise) => {
|
||||
const bucketName = "winamp2-js-skins";
|
||||
s3.getObject({ Bucket: bucketName, Key: key }, (err, data) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
rejectPromise(err);
|
||||
return;
|
||||
}
|
||||
const body = Buffer.from(data.Body).toString("utf8");
|
||||
|
|
@ -18,11 +18,11 @@ function getFile(key) {
|
|||
}
|
||||
|
||||
function putFile(key, body) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve, rejectPromise) => {
|
||||
const bucketName = "winamp2-js-skins";
|
||||
s3.putObject({ Bucket: bucketName, Key: key, Body: body }, err => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
rejectPromise(err);
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ interface PortalProps {
|
|||
|
||||
const Portal = (props: PortalProps) => {
|
||||
const node: HTMLDivElement = useMemo(() => {
|
||||
const node = document.createElement("div");
|
||||
node.id = "webamp-context-menu";
|
||||
node.style.position = "absolute";
|
||||
node.style.top = "0";
|
||||
node.style.left = "0";
|
||||
node.style.zIndex = String(props.zIndex + 1);
|
||||
return node;
|
||||
const div = document.createElement("div");
|
||||
div.id = "webamp-context-menu";
|
||||
div.style.position = "absolute";
|
||||
div.style.top = "0";
|
||||
div.style.left = "0";
|
||||
div.style.zIndex = String(props.zIndex + 1);
|
||||
return div;
|
||||
}, [props.zIndex]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ function Milkdrop(props: Props) {
|
|||
windowId={WINDOWS.MILKDROP}
|
||||
onKeyDown={handleKeyDown}
|
||||
>
|
||||
{(windowSize: { width: number; height: number }) => {
|
||||
const size = props.fullscreen ? screenSize : windowSize;
|
||||
{(genWindowSize: { width: number; height: number }) => {
|
||||
const size = props.fullscreen ? screenSize : genWindowSize;
|
||||
return (
|
||||
<MilkdropContextMenu>
|
||||
<Background>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ const playlist = (
|
|||
selectedTracks: new Set([state.trackOrder[action.index]]),
|
||||
lastSelectedIndex: action.index,
|
||||
};
|
||||
case CTRL_CLICKED_TRACK:
|
||||
case CTRL_CLICKED_TRACK: {
|
||||
const id = state.trackOrder[action.index];
|
||||
const newSelectedTracks = new Set(state.selectedTracks);
|
||||
toggleSetMembership(newSelectedTracks, id);
|
||||
|
|
@ -63,6 +63,7 @@ const playlist = (
|
|||
// Winamp 2 does, so we'll copy it.
|
||||
lastSelectedIndex: action.index,
|
||||
};
|
||||
}
|
||||
case SHIFT_CLICKED_TRACK:
|
||||
if (state.lastSelectedIndex == null) {
|
||||
return state;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ export const parseIni = (text: string): IniData => {
|
|||
const value = match[2]
|
||||
// Ignore anything after a second `=`
|
||||
// TODO: What if this is inside quotes or escaped?
|
||||
.replace(/=.*$/g, "")
|
||||
.replace(/\=.*$/g, "")
|
||||
.trim()
|
||||
// Strip quotes
|
||||
// TODO: What about escaped quotes?
|
||||
|
|
|
|||
|
|
@ -195,8 +195,8 @@ class Winamp {
|
|||
|
||||
if (importConvertPreset != null && presetConverterEndpoint != null) {
|
||||
convertPreset = async (file: File): Promise<Object> => {
|
||||
const { convertPreset } = await importConvertPreset();
|
||||
return convertPreset(
|
||||
const { convertPreset: convert } = await importConvertPreset();
|
||||
return convert(
|
||||
await FileUtils.genStringFromFileReference(file),
|
||||
presetConverterEndpoint
|
||||
);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,17 @@ function readFileAsArrayBuffer(file) {
|
|||
});
|
||||
}
|
||||
|
||||
function backgroundColorFromMessageTitle(messageTitle) {
|
||||
switch (messageTitle) {
|
||||
case "Success":
|
||||
return "lightgreen";
|
||||
case "Fial":
|
||||
return "pink";
|
||||
default:
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
function Wrapper() {
|
||||
const [maki, setMaki] = React.useState(null);
|
||||
const onDrop = React.useCallback(async acceptedFiles => {
|
||||
|
|
@ -134,18 +145,17 @@ function Debugger({ maki }) {
|
|||
|
||||
const nextValue = React.useCallback(
|
||||
value => {
|
||||
const { i, stack, variables, commands } = value;
|
||||
dispatch({
|
||||
type: "STEPPED",
|
||||
variables,
|
||||
commands,
|
||||
commandOffset: i,
|
||||
stack,
|
||||
variables: value.variables,
|
||||
commands: value.commands,
|
||||
commandOffset: value.i,
|
||||
stack: value.stack,
|
||||
});
|
||||
if (paused) {
|
||||
return false;
|
||||
}
|
||||
if (breakPoints.has(i)) {
|
||||
if (breakPoints.has(value.i)) {
|
||||
dispatch({ type: "PAUSE" });
|
||||
return;
|
||||
}
|
||||
|
|
@ -208,26 +218,20 @@ function Debugger({ maki }) {
|
|||
<table>
|
||||
<tbody>
|
||||
{messages.map(
|
||||
({ message, messageTitle, flag, notanymoreId }, i) => (
|
||||
<tr key={i}>
|
||||
<td>{i}</td>
|
||||
<td>{message}</td>
|
||||
<td
|
||||
style={{
|
||||
backgroundColor:
|
||||
messageTitle === "Success"
|
||||
? "lightgreen"
|
||||
: messageTitle === "Fail"
|
||||
? "pink"
|
||||
: "none",
|
||||
}}
|
||||
>
|
||||
{messageTitle}
|
||||
</td>
|
||||
<td>{flag}</td>
|
||||
<td>{notanymoreId}</td>
|
||||
</tr>
|
||||
)
|
||||
({ message, messageTitle, flag, notanymoreId }, i) => {
|
||||
const backgroundColor = backgroundColorFromMessageTitle(
|
||||
messageTitle
|
||||
);
|
||||
return (
|
||||
<tr key={i}>
|
||||
<td>{i}</td>
|
||||
<td>{message}</td>
|
||||
<td style={{ backgroundColor }}>{messageTitle}</td>
|
||||
<td>{flag}</td>
|
||||
<td>{notanymoreId}</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { xml2js } from "xml-js";
|
||||
|
||||
let i = 0;
|
||||
let nextId = 0;
|
||||
export function getId() {
|
||||
return i++;
|
||||
return nextId++;
|
||||
}
|
||||
|
||||
// Depth-first tree map
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ describe("inlineIncludes", () => {
|
|||
test("inlines the contents of included files as children of the include node", async () => {
|
||||
const zip = await getSkinZip();
|
||||
const originalFile = zip.file;
|
||||
zip.file = jest.fn(path => originalFile.call(zip, path));
|
||||
zip.file = jest.fn(filePath => originalFile.call(zip, filePath));
|
||||
|
||||
const xml = await Utils.readXml(zip, "SkIn.XmL");
|
||||
const resolvedXml = await Utils.inlineIncludes(xml, zip);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue