Skip to content

Commit

Permalink
Merge pull request #19 from pSpitzner/eslint-fix
Browse files Browse the repository at this point in the history
Fixes ESLint errors and we now read the default config
  • Loading branch information
pSpitzner authored Jul 16, 2024
2 parents be4fa17 + 762dc92 commit a909d58
Show file tree
Hide file tree
Showing 35 changed files with 455 additions and 393 deletions.
54 changes: 23 additions & 31 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,30 @@
name: ESLint

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]

jobs:
eslint:
name: Run eslint scanning
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps:
- name: Checkout code
uses: actions/checkout@v4
eslint:
name: Run eslint scanning
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install ESLint
run: |
npm install \
eslint@^8.57.0 \
eslint-plugin-react@^7.34.1 \
eslint-plugin-react-hooks@^4.6.2 \
eslint-plugin-react-refresh@^0.4.6 \
@typescript-eslint/eslint-plugin@^7.2.0 \
@typescript-eslint/parser@^7.2.0 \
@tanstack/eslint-plugin-query@^5.35.6
- name: Install ESLint
run: |
cd ./frontend
npm install
- name: Run ESLint
run: |
cd ./frontend
npx eslint .
--config .eslintrc.js
--ext .js,.jsx,.ts,.tsx
- name: Run ESLint
run: |
cd ./frontend
npm run lint
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# 24-05-22 version 0.0.1
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [0.0.2] - 24-07-16

### Fixed
- ESLint errors and Github action
- Now loading the default config

## 0.0.1 - 24-05-22
- initial commit

[0.0.2]: https://github.com/pSpitzner/beets-flask/compare/v0.0.1...v0.0.2
2 changes: 1 addition & 1 deletion backend/beets_flask/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.1'
__version__ = '0.0.2'
11 changes: 10 additions & 1 deletion backend/beets_flask/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@
```
"""

import confuse
from beets_flask.utility import log
from beets import config
config.set_env(prefix='BF')

config.set_env(prefix="BF")

try:
# docker container
default_source = confuse.YamlSource("/repo/configs/default.yaml", default=True)
except confuse.ConfigReadError:
# running as module. but we should place the default config where confuse looks for it.
default_source = confuse.YamlSource("./configs/default.yaml", default=True)
config.add(default_source) # .add inserts with lowest priority
62 changes: 0 additions & 62 deletions configs/beets_default.yaml

This file was deleted.

36 changes: 36 additions & 0 deletions configs/default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# ------------------------------------------------------------------------------------ #
# DO NOT EDIT THIS FILE #
# ------------------------------------------------------------------------------------ #
# these are the defaults for the gui.
# you must provide your own config and map it to /home/beetle/.config/beets/config.yaml
# to get started, see the example.yaml

gui:
num_workers_preview: 4

library:
readonly: no
include_paths: yes

tags:
expand_tags: yes
recent_days: 14
order_by: "name"

terminal:
start_path: "/repo"

inbox:
concat_nested_folders: yes
expand_files: no

# you must set inbox folders and the music directory in *your* beets config!
# (we only keep it around so the container can launch when nothing is configured)

folders:
Placeholder:
name: "Please configure your inbox!"
path: "/music/inbox"
autotag: no # no | "preview" | "import"

directory: /music/imported
2 changes: 1 addition & 1 deletion configs/beets_example.yaml → configs/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ gui:
tags:
expand_tags: yes # for tag groups, on page load, show tag details?
recent_days: 14 # Number of days to consider for the "recent" tag group
order_by: "name" # how to sort tags within the trag groups: "name" (the album folder basename) | "date_created" | "date_modified"

terminal:
start_path: "/music/inbox" # the directory where to start new terminal sessions

inbox:
concat_nested_folders: yes # show multiple folders in one line if they only have one child
expand_files: no # on page load, show files in (album) folders, or collapse them
order_by: "name" # how to sort tags within the trag groups: "name" (the album folder basename) | "date_created" | "date_modified"

folders: # keep in mind to volume-map these folders in your docker-compose.yml
Lorem:
Expand Down
9 changes: 1 addition & 8 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,9 @@ id

cd /repo


# Check if configs exist and copy if they dont
if [ ! -f /home/beetle/.config/beets/config.yaml ]; then
mkdir -p /home/beetle/.config/beets
cp /repo/configs/beets_default.yaml /home/beetle/.config/beets/config.yaml
fi

NUM_WORKERS_PREVIEW=$(yq e '.gui.num_workers_preview' /home/beetle/.config/beets/config.yaml)
if ! [[ "$NUM_WORKERS_PREVIEW" =~ ^[0-9]+$ ]]; then
NUM_WORKERS_PREVIEW=1
NUM_WORKERS_PREVIEW=4
fi

mkdir -p /repo/log
Expand Down
8 changes: 1 addition & 7 deletions entrypoint_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@ npm run dev &

cd /repo

# Check if configs exist and copy if they dont
if [ ! -f /home/beetle/.config/beets/config.yaml ]; then
mkdir -p /home/beetle/.config/beets
cp /repo/configs/beets_default.yaml /home/beetle/.config/beets/config.yaml
fi

NUM_WORKERS_PREVIEW=$(yq e '.gui.num_workers_preview' /home/beetle/.config/beets/config.yaml)
if ! [[ "$NUM_WORKERS_PREVIEW" =~ ^[0-9]+$ ]]; then
NUM_WORKERS_PREVIEW=1
NUM_WORKERS_PREVIEW=4
fi

mkdir -p /repo/log
Expand Down
9 changes: 4 additions & 5 deletions entrypoint_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@ cd /repo

redis-server --daemonize yes

# Check if configs exist and copy if they dont
if [ ! -f /home/beetle/.config/beets/config.yaml ]; then
mkdir -p /home/beetle/.config/beets
cp /repo/configs/beets_default.yaml /home/beetle/.config/beets/config.yaml
NUM_WORKERS_PREVIEW=$(yq e '.gui.num_workers_preview' /home/beetle/.config/beets/config.yaml)
if ! [[ "$NUM_WORKERS_PREVIEW" =~ ^[0-9]+$ ]]; then
NUM_WORKERS_PREVIEW=4
fi


for i in $(seq 1 $NUM_WORKERS_PREVIEW)
do
# also for tests redirect to /dev/null, otherwise, test printout gets scrambled
rq worker preview --log-format "Preview worker $i: %(message)s" > /dev/null &
done

NUM_WORKERS_IMPORT=1
for i in $(seq 1 $NUM_WORKERS_IMPORT)
do
rq worker import --log-format "Import worker $i: %(message)s" > /dev/null &
Expand Down
6 changes: 6 additions & 0 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ module.exports = {
'react-refresh/only-export-components': [
0,
],
"@typescript-eslint/no-empty-function": "off",
},
settings: {
react: {
version: '18.2',
},
},
parserOptions: {
ecmaVersion: "latest",
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "frontend",
"private": true,
"version": "0.0.1",
"version": "0.0.2",
"type": "module",
"scripts": {
"dev": "vite --host --cors",
Expand Down
11 changes: 4 additions & 7 deletions frontend/src/components/common/buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import { forwardRef, useState } from "react";






/**
* Renders an icon button with a mutation option.
*
Expand All @@ -30,8 +27,8 @@ export const IconButtonWithMutation = forwardRef(function IconButtonWithMutation
children,
...props
}: {
mutationOption?: UseMutationOptions<unknown, Error, any, unknown>
mutateArgs?: any;
mutationOption?: UseMutationOptions<unknown, Error, unknown, unknown>
mutateArgs?: unknown;
} & ButtonProps,
ref?: React.Ref<HTMLDivElement>
) {
Expand Down Expand Up @@ -96,8 +93,8 @@ export const IconButtonWithMutationAndFeedback = forwardRef(function IconButtonW
mutateArgs,
...props
}: {
mutationOption: UseMutationOptions<unknown, Error, any, unknown>
mutateArgs: any,
mutationOption: UseMutationOptions<unknown, Error, unknown, unknown>
mutateArgs: unknown,
confirmTitle: string;
} & ButtonProps,
ref?: React.Ref<HTMLDivElement>
Expand Down
Loading

0 comments on commit a909d58

Please sign in to comment.