From b9161c8c76b6aa73aae18d2d53cd595b4c3c7bab Mon Sep 17 00:00:00 2001 From: Adrien ERAUD Date: Tue, 11 Jun 2024 10:58:57 +0200 Subject: [PATCH] Bump dependencies --- .editorconfig | 2 +- .eslintignore | 11 ----- .eslintrc.js | 15 ------- .github/workflows/quality-control.yml | 2 +- .vscode/settings.json | 32 ++++++-------- eslint.config.mjs | 63 +++++++++++++++++++++++++++ package.json | 28 ++++++------ .prettierrc.js => prettier.config.mjs | 6 ++- src/index.ts | 2 +- tsconfig.json | 2 +- 10 files changed, 99 insertions(+), 64 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.js create mode 100644 eslint.config.mjs rename .prettierrc.js => prettier.config.mjs (66%) diff --git a/.editorconfig b/.editorconfig index 7392ff1..4e0b0da 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,6 +12,6 @@ insert_final_newline = false indent_style = space indent_size = 2 -[*.{js,ts}] +[*.{js,ts,cjs,mjs}] indent_style = space indent_size = 2 \ No newline at end of file diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 0af8f4f..0000000 --- a/.eslintignore +++ /dev/null @@ -1,11 +0,0 @@ -# Generated files -lib - -# Electron JS file -src/audio-analyzer/*.js - -# Yarn & node.js dependencies -package.json -node_modules/ -.pnp.* -.yarn/* \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 0c1d0c2..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-disable no-undef */ -module.exports = { - root: true, - env: { - es6: true, - node: true, - }, - parser: "@typescript-eslint/parser", - plugins: ["@typescript-eslint"], - extends: [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "prettier", - ], -}; diff --git a/.github/workflows/quality-control.yml b/.github/workflows/quality-control.yml index d239431..f0bf3c4 100644 --- a/.github/workflows/quality-control.yml +++ b/.github/workflows/quality-control.yml @@ -37,7 +37,7 @@ jobs: strategy: matrix: - node-version: [18.x, 20.x] + node-version: [20.x, 22.x] steps: - uses: actions/checkout@v4 diff --git a/.vscode/settings.json b/.vscode/settings.json index 735d492..6c56f76 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,29 +17,25 @@ "**/.yarn/**": true, "**/lib/**": true }, + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.codeActionsOnSave": { + "source.fixAll": "explicit", + "source.organizeImports": "explicit" + }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, - "[scss]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "editor.codeActionsOnSave": { - "source.fixAll": "explicit", - "source.organizeImports": "explicit" - }, "eslint.enable": true, - "eslint.format.enable": true, - "prettier.configPath": ".prettierrc.js", - "prettier.ignorePath": ".prettierignore", - "css.validate": false, - "less.validate": false, - "scss.validate": false, - "stylelint.enable": true, - "stylelint.validate": ["css", "scss"] + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact" + ], + "prettier.configPath": "prettier.config.mjs", + "prettier.ignorePath": ".prettierignore" } diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..853d879 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,63 @@ +import eslint from "@eslint/js"; +import prettierConfig from "eslint-config-prettier"; +import * as espree from "espree"; +import globals from "globals"; +import tseslint from "typescript-eslint"; + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommended, + { + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + ecmaVersion: 2022, + globals: { + ...globals.es2022, + ...globals.node, + }, + }, + }, + }, + prettierConfig, + { + ignores: [ + "package.json", + "node_modules/*", + ".yarn/*", + "lib/*", + "tempDir/*", + "tests/*.epub", + ], + }, + { + files: ["**/*.ts"], + rules: { + "@typescript-eslint/no-unused-vars": [ + "error", + { + args: "all", + argsIgnorePattern: "^_", + caughtErrors: "all", + caughtErrorsIgnorePattern: "^_", + }, + ], + }, + }, + { + files: ["src/audio-analyzer/*.js"], + rules: { + "@typescript-eslint/no-require-imports": "off", + }, + languageOptions: { + parser: espree, + sourceType: "commonjs", + ecmaVersion: 2022, + globals: { + ...globals.es2022, + ...globals.node, + }, + }, + } +); diff --git a/package.json b/package.json index 2cfea2d..7ff3c2a 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "access": "public" }, "engines": { - "node": "18.x || 20.x" + "node": "20.x || 22.x" }, "keywords": [ "waveform", @@ -27,35 +27,35 @@ ], "scripts": { "freshlock": "rm -rf node_modules/ && rm .yarn/install-state.gz && rm yarn.lock && yarn", - "check-lint": "eslint . --ext .js,.jsx,.ts,.tsx", + "check-lint": "eslint", "check-format": "prettier --check .", "check-tsc": "tsc --noEmit", - "lint": "eslint . --fix --ext .js,.jsx,.ts,.tsx", + "lint": "eslint --fix", "format": "prettier --write .", "build": "tsc && cp -R src/audio-analyzer lib", "test": "mocha" }, "dependencies": { - "electron": "^30.0.8", + "electron": "^31.0.0", "mime-types": "^2.1.35", - "uuid": "^9.0.1", + "uuid": "^10.0.0", "yargs": "^17.7.2" }, "devDependencies": { - "@tsconfig/node18": "^18.2.4", + "@eslint/js": "^9.4.0", + "@tsconfig/node20": "^20.1.4", "@types/mime-types": "^2.1.4", "@types/mocha": "^10.0.6", - "@types/node": "^20.12.12", - "@types/uuid": "^9.0.8", + "@types/node": "^20.14.2", "@types/yargs": "^17.0.32", - "@typescript-eslint/eslint-plugin": "^7.11.0", - "@typescript-eslint/parser": "^7.11.0", - "eslint": "^8.57.0", + "eslint": "^9.4.0", "eslint-config-prettier": "^9.1.0", + "globals": "^15.4.0", "mocha": "^10.4.0", - "prettier": "^3.2.5", + "prettier": "^3.3.2", "ts-node": "^10.9.2", - "typescript": "^5.4.5" + "typescript": "^5.4.5", + "typescript-eslint": "^8.0.0-alpha.30" }, - "packageManager": "yarn@4.2.2" + "packageManager": "yarn@4.3.0" } diff --git a/.prettierrc.js b/prettier.config.mjs similarity index 66% rename from .prettierrc.js rename to prettier.config.mjs index 6047371..6d51fcf 100644 --- a/.prettierrc.js +++ b/prettier.config.mjs @@ -1,9 +1,9 @@ -module.exports = { +const config = { printWidth: 120, trailingComma: "es5", overrides: [ { - files: [".eslintrc.*", ".prettierrc.*", "*.json", "*.md"], + files: ["eslint.config.mjs", "prettier.config.mjs", "*.json", "*.md"], options: { printWidth: 80, }, @@ -16,3 +16,5 @@ module.exports = { }, ], }; + +export default config; diff --git a/src/index.ts b/src/index.ts index e6a2991..30fc817 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,7 +25,7 @@ function cleanOutput(std: string): AudioAnalyzerError | AudioAnalyzerWaveform | for (const line of std.split("\n")) { try { result = JSON.parse(line); - } catch (err) { + } catch (_err) { /* Nothing to do */ } } diff --git a/tsconfig.json b/tsconfig.json index 8a8ad00..8bce2a1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "./node_modules/@tsconfig/node18/tsconfig.json", + "extends": "./node_modules/@tsconfig/node20/tsconfig.json", "compilerOptions": { /* Visit https://aka.ms/tsconfig.json to read more about this file */ "outDir": "lib",