diff --git a/.eslintrc b/.eslintrc index 50a9f078..65734688 100644 --- a/.eslintrc +++ b/.eslintrc @@ -22,6 +22,11 @@ "arrow-parens": 0, "jsx-a11y/control-has-associated-label": 0, "react/prop-types": 0, - "no-multiple-empty-lines": ["error", { "max": 2, "maxBOF": 0, "maxEOF": 0 }] + "no-multiple-empty-lines": ["error", { "max": 2, "maxBOF": 0, "maxEOF": 0 }], + "no-promise-executor-return": 0, + "react/function-component-definition": 0 + }, + "parserOptions": { + "ecmaVersion": 2022 } } diff --git a/icon-gen.js b/icon-gen.js deleted file mode 100644 index e1bc3a40..00000000 --- a/icon-gen.js +++ /dev/null @@ -1,24 +0,0 @@ -const sharp = require('sharp'); -const icongen = require('icon-gen'); - -const svg2png = (from, to, width, height) => sharp(from) - .png() - .resize(width, height, { - fit: sharp.fit.contain, - background: { r: 0, g: 0, b: 0, alpha: 0 }, - }) - .toFile(to); - -(async () => { - await svg2png('src/icon.svg', './icon-build/app-512.png', 512, 512); - await svg2png('src/icon.svg', './build-resources/appx/StoreLogo.png', 50, 50); - await svg2png('src/icon.svg', './build-resources/appx/Square150x150Logo.png', 300, 300); - await svg2png('src/icon.svg', './build-resources/appx/Square44x44Logo.png', 44, 44); - await svg2png('src/icon.svg', './build-resources/appx/Wide310x150Logo.png', 620, 300); - - await icongen('./src/icon.svg', './icon-build', { icns: { sizes: [512, 1024] } }); - - // https://github.com/mifi/lossless-cut/issues/778 - // https://stackoverflow.com/questions/3236115/which-icon-sizes-should-my-windows-applications-icon-include - await icongen('./src/icon.svg', './icon-build', { ico: { sizes: [16, 24, 32, 40, 48, 64, 96, 128, 256, 512] } }); -})(); diff --git a/package.json b/package.json index 54c3c699..08cabc03 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,14 @@ "start": "concurrently -k \"npm run start:frontend\" \"npm run start:electron\"", "start:frontend": "cross-env BROWSER=none PORT=3001 DISABLE_ESLINT_PLUGIN=true react-scripts start", "start:electron": "wait-on http://localhost:3001 && electron .", - "icon-gen": "mkdirp icon-build build-resources/appx && node icon-gen.js", - "download-ffmpeg-mac": "mkdir -p ffmpeg/darwin && cd ffmpeg/darwin && wget https://github.com/mifi/ffmpeg-build-script/releases/download/n4.4.1/ffmpeg -O ffmpeg && wget https://github.com/mifi/ffmpeg-build-script/releases/download/n4.4.1/ffprobe -O ffprobe && chmod +x ffmpeg && chmod +x ffprobe", - "download-ffmpeg-linux": "mkdir -p ffmpeg/linux && cd ffmpeg/linux && wget https://github.com/mifi/ffmpeg-builds/releases/download/4.4.1/ffmpeg-release-amd64-static.tar.xz -O ffmpeg.xz && tar xvf ffmpeg.xz ffmpeg-4.4.1-amd64-static/ffmpeg ffmpeg-4.4.1-amd64-static/ffprobe --strip-components=1", - "download-ffmpeg-windows": "npx shx mkdir -p ffmpeg/win32 && cd ffmpeg/win32 && npx download-cli https://github.com/mifi/ffmpeg-builds/releases/download/4.4.1/ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4.zip --out . --filename ffmpeg.zip && 7z x ffmpeg.zip && npx shx mv ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4/bin/ffmpeg.exe ./ && npx shx mv ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4/bin/ffprobe.exe ./", + "icon-gen": "mkdirp icon-build build-resources/appx && node script/icon-gen.mjs", + "download-ffmpeg-mac": "mkdirp ffmpeg/darwin && cd ffmpeg/darwin && wget https://github.com/mifi/ffmpeg-build-script/releases/download/n4.4.1/ffmpeg -O ffmpeg && wget https://github.com/mifi/ffmpeg-build-script/releases/download/n4.4.1/ffprobe -O ffprobe && chmod +x ffmpeg && chmod +x ffprobe", + "download-ffmpeg-linux": "mkdirp ffmpeg/linux && cd ffmpeg/linux && wget https://github.com/mifi/ffmpeg-builds/releases/download/4.4.1/ffmpeg-release-amd64-static.tar.xz -O ffmpeg.xz && tar xvf ffmpeg.xz ffmpeg-4.4.1-amd64-static/ffmpeg ffmpeg-4.4.1-amd64-static/ffprobe --strip-components=1", + "download-ffmpeg-windows": "mkdirp ffmpeg/win32 && cd ffmpeg/win32 && npx download-cli https://github.com/mifi/ffmpeg-builds/releases/download/4.4.1/ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4.zip --out . --filename ffmpeg.zip && 7z x ffmpeg.zip && npx shx mv ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4/bin/ffmpeg.exe ./ && npx shx mv ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4/bin/ffprobe.exe ./", "build": "yarn icon-gen && react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "lint": "eslint --ext .jsx --ext .js .", + "lint": "eslint --ext .jsx --ext .js . --ext .mjs", "pack-mac": "electron-builder --mac -m dmg", "prepack-mac": "yarn build", "pack-mas-dev": "electron-builder --mac -m mas-dev -c.mas.provisioningProfile=LosslessCut_Dev.provisionprofile -c.mas.identity='Apple Development: Mikael Finstad (JH4PH8B3C8)'", @@ -54,7 +54,7 @@ "electron-builder-notarize": "1.1.2", "electron-devtools-installer": "^3.1.1", "eslint": "^7.32.0 || ^8.2.0", - "eslint-config-airbnb": "^18.2.1", + "eslint-config-airbnb": "^19.0.4", "eslint-plugin-import": "^2.25.3", "eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-react": "^7.28.0", diff --git a/script/icon-gen.mjs b/script/icon-gen.mjs new file mode 100644 index 00000000..6d77beff --- /dev/null +++ b/script/icon-gen.mjs @@ -0,0 +1,22 @@ +import sharp from 'sharp'; +import icongen from 'icon-gen'; + +const svg2png = (from, to, width, height) => sharp(from) + .png() + .resize(width, height, { + fit: sharp.fit.contain, + background: { r: 0, g: 0, b: 0, alpha: 0 }, + }) + .toFile(to); + +await svg2png('src/icon.svg', './icon-build/app-512.png', 512, 512); +await svg2png('src/icon.svg', './build-resources/appx/StoreLogo.png', 50, 50); +await svg2png('src/icon.svg', './build-resources/appx/Square150x150Logo.png', 300, 300); +await svg2png('src/icon.svg', './build-resources/appx/Square44x44Logo.png', 44, 44); +await svg2png('src/icon.svg', './build-resources/appx/Wide310x150Logo.png', 620, 300); + +await icongen('./src/icon.svg', './icon-build', { icns: { sizes: [512, 1024] } }); + +// https://github.com/mifi/lossless-cut/issues/778 +// https://stackoverflow.com/questions/3236115/which-icon-sizes-should-my-windows-applications-icon-include +await icongen('./src/icon.svg', './icon-build', { ico: { sizes: [16, 24, 32, 40, 48, 64, 96, 128, 256, 512] } }); diff --git a/src/App.jsx b/src/App.jsx index 1fbe0968..dfa9c7a4 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1092,8 +1092,9 @@ const App = memo(() => { } }, [previewFilePath, filePath, edlFilePath, cleanupChoices, isFileOpened, resetState, batchRemoveFile, setWorking]); - const inverseOrNormalSegments = useMemo(() => (invertCutSegments ? inverseCutSegments : apparentCutSegments), - [invertCutSegments, inverseCutSegments, apparentCutSegments]); + const inverseOrNormalSegments = useMemo(() => ( + invertCutSegments ? inverseCutSegments : apparentCutSegments + ), [invertCutSegments, inverseCutSegments, apparentCutSegments]); const enabledSegmentsRaw = useMemo(() => { // For invertCutSegments we do not support filtering diff --git a/src/Canvas.jsx b/src/Canvas.jsx index 6c597fa3..46772e8f 100644 --- a/src/Canvas.jsx +++ b/src/Canvas.jsx @@ -6,8 +6,7 @@ import CanvasPlayer from './CanvasPlayer'; const Canvas = memo(({ rotate, filePath, width, height, playerTime, streamIndex, commandedTime, playing }) => { const canvasRef = useRef(); - const canvasPlayer = useMemo(() => CanvasPlayer({ path: filePath, width, height, streamIndex }), - [filePath, width, height, streamIndex]); + const canvasPlayer = useMemo(() => CanvasPlayer({ path: filePath, width, height, streamIndex }), [filePath, width, height, streamIndex]); useEffect(() => { canvasPlayer.setCanvas(canvasRef.current); diff --git a/src/HelpSheet.jsx b/src/HelpSheet.jsx index 68ce804d..e1b64b0f 100644 --- a/src/HelpSheet.jsx +++ b/src/HelpSheet.jsx @@ -34,7 +34,7 @@ const HelpSheet = memo(({ visible, onTogglePress, ffmpegCommandLog, onKeyboardSh electron.shell.openExternal(githubLink)}>{githubLink}
- + } onClick={onKeyboardShortcutsDialogRequested}>{t('Keyboard & mouse shortcuts')}{t('Hover mouse over buttons in the main interface to see which function they have')}
diff --git a/src/Settings.jsx b/src/Settings.jsx index 0c7e49e0..361ea2c0 100644 --- a/src/Settings.jsx +++ b/src/Settings.jsx @@ -30,6 +30,10 @@ const langNames = { ko: '한국어', }; +// eslint-disable-next-line react/jsx-props-no-spreading +const Row = (props) =>