Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

chore: add ESLint + Prettier for JS/TS, ruff for Python,

Gabriel Stein23d343337667
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 000000000..c37e1be10
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,6 @@
+node_modules
+dist
+build
+src/dist
+*.min.js
+package-lock.json
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 000000000..b978ae664
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,11 @@
+{
+ "semi": true,
+ "singleQuote": false,
+ "tabWidth": 2,
+ "trailingComma": "es5",
+ "printWidth": 100,
+ "bracketSpacing": true,
+ "arrowParens": "always",
+ "endOfLine": "lf",
+ "jsxSingleQuote": false
+}
diff --git a/eslint.config.js b/eslint.config.js
new file mode 100644
index 000000000..67042d284
--- /dev/null
+++ b/eslint.config.js
@@ -0,0 +1,36 @@
+import js from "@eslint/js";
+import globals from "globals";
+
+export default [
+ {
+ ignores: [
+ "dist/**",
+ "node_modules/**",
+ "src/dist/**",
+ "*.min.js",
+ "build/**",
+ ],
+ },
+ // Main process files (CommonJS)
+ {
+ files: ["*.js", "src/helpers/**/*.js", "src/utils/**/*.js", "scripts/**/*.js"],
+ languageOptions: {
+ ecmaVersion: 2022,
+ sourceType: "commonjs",
+ globals: {
+ ...globals.node,
+ ...globals.commonjs,
+ },
+ },
+ rules: {
+ ...js.configs.recommended.rules,
+ // Relaxed rules - catch syntax errors but don't be too strict
+ "no-unused-vars": ["warn", { varsIgnorePattern: "^_", argsIgnorePattern: "^_" }],
+ "no-console": "off",
+ "no-empty": ["error", { allowEmptyCatch: true }],
+ "no-constant-condition": ["error", { checkLoops: false }],
+ "prefer-const": "off",
+ "no-var": "off",
+ },
+ },
+];
diff --git a/package-lock.json b/package-lock.json
index 894fa270a..b8f05e19e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "open-whispr",
- "version": "1.0.14",
+ "version": "1.0.15",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "open-whispr",
- "version": "1.0.14",
+ "version": "1.0.15",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
@@ -49,6 +49,7 @@
"eslint-plugin-react-refresh": "^0.4.19",
"globals": "^16.0.0",
"postcss": "^8.5.6",
+ "prettier": "^3.4.2",
"tailwindcss": "^4.1.10",
"vite": "^6.3.5"
}
@@ -7443,6 +7444,22 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/prettier": {
+ "version": "3.7.4",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz",
+ "integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "prettier": "bin/prettier.cjs"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/prettier/prettier?sponsor=1"
+ }
+ },
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
diff --git a/package.json b/package.json
index aa4738523..fa7c4616e 100644
--- a/package.json
+++ b/package.json
@@ -28,7 +28,10 @@
"pack": "npm run build:renderer && CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --dir",
"predist": "npm run compile:globe",
"dist": "npm run build:renderer && electron-builder",
- "lint": "cd src && eslint .",
+ "format:js": "eslint . --fix && cd src && eslint . --fix && prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
+ "format:py": "python -m ruff check --fix *.py && python -m ruff format *.py",
+ "format": "npm run format:js && npm run format:py",
+ "format:check": "eslint . && cd src && eslint . && prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\" && python -m ruff check *.py",
"preview": "cd src && vite preview",
"clean": "node cleanup.js"
},
@@ -61,6 +64,7 @@
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.19",
"globals": "^16.0.0",
+ "prettier": "^3.4.2",
"postcss": "^8.5.6",
"tailwindcss": "^4.1.10",
"vite": "^6.3.5"
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 000000000..a0a03b555
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,23 @@
+[tool.ruff]
+# Relaxed Python linting and formatting
+line-length = 120
+target-version = "py311"
+
+[tool.ruff.lint]
+# Only catch important issues, not style nitpicks
+select = [
+ "E", # pycodestyle errors (syntax issues)
+ "F", # pyflakes (undefined names, unused imports)
+ "W", # pycodestyle warnings
+]
+ignore = [
+ "E501", # line too long (let formatter handle it)
+ "E402", # module level import not at top
+ "W503", # line break before binary operator
+]
+
+[tool.ruff.format]
+# Use double quotes like Prettier
+quote-style = "double"
+indent-style = "space"
+line-ending = "lf"
diff --git a/src/eslint.config.js b/src/eslint.config.js
index ec2b712d3..f6b44c3e1 100644
--- a/src/eslint.config.js
+++ b/src/eslint.config.js
@@ -1,33 +1,72 @@
-import js from '@eslint/js'
-import globals from 'globals'
-import reactHooks from 'eslint-plugin-react-hooks'
-import reactRefresh from 'eslint-plugin-react-refresh'
+import js from "@eslint/js";
+import globals from "globals";
+import reactHooks from "eslint-plugin-react-hooks";
+import reactRefresh from "eslint-plugin-react-refresh";
export default [
- { ignores: ['dist'] },
+ { ignores: ["dist"] },
+ // JS and JSX files
{
- files: ['**/*.{js,jsx}'],
+ files: ["**/*.{js,jsx}"],
languageOptions: {
- ecmaVersion: 2020,
- globals: globals.browser,
+ ecmaVersion: 2022,
+ globals: {
+ ...globals.browser,
+ ...globals.node,
+ },
parserOptions: {
- ecmaVersion: 'latest',
+ ecmaVersion: "latest",
ecmaFeatures: { jsx: true },
- sourceType: 'module',
+ sourceType: "module",
},
},
plugins: {
- 'react-hooks': reactHooks,
- 'react-refresh': reactRefresh,
+ "react-hooks": reactHooks,
+ "react-refresh": reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
- 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
- 'react-refresh/only-export-components': [
- 'warn',
+ // Relaxed rules
+ "no-unused-vars": ["warn", { varsIgnorePattern: "^[A-Z_]", argsIgnorePattern: "^_" }],
+ "no-console": "off",
+ "no-empty": ["error", { allowEmptyCatch: true }],
+ "react-refresh/only-export-components": [
+ "warn",
+ { allowConstantExport: true },
+ ],
+ },
+ },
+ // TypeScript files
+ {
+ files: ["**/*.{ts,tsx}"],
+ languageOptions: {
+ ecmaVersion: 2022,
+ globals: {
+ ...globals.browser,
+ ...globals.node,
+ },
+ parserOptions: {
+ ecmaVersion: "latest",
+ ecmaFeatures: { jsx: true },
+ sourceType: "module",
+ },
+ },
+ plugins: {
+ "react-hooks": reactHooks,
+ "react-refresh": reactRefresh,
+ },
+ rules: {
+ ...reactHooks.configs.recommended.rules,
+ // TypeScript handles these better
+ "no-undef": "off",
+ "no-unused-vars": "off",
+ "no-console": "off",
+ "no-empty": ["error", { allowEmptyCatch: true }],
+ "react-refresh/only-export-components": [
+ "warn",
{ allowConstantExport: true },
],
},
},
-]
+];