Skip to content

A local-first personal finance app

Lint tweaks (#1223)

Shazib Hussain7165a2159d1d
diff --git a/.eslintignore b/.eslintignore
index 7e7060359a..5250cef354 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -10,6 +10,7 @@ packages/desktop-client/public/kcab/
packages/desktop-client/public/data/
packages/desktop-client/**/node_modules/*
packages/desktop-client/node_modules/
+packages/desktop-client/src/icons/**/*
packages/desktop-electron/client-build/
packages/desktop-electron/dist/
diff --git a/.eslintrc.js b/.eslintrc.js
index 0113177c33..795f7e4fd1 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -181,16 +181,6 @@ module.exports = {
],
},
},
- {
- files: ['./packages/loot-core/src/**/*'],
- rules: {
- // defining 'src' to check all packages is slow, so only do it for loot-core
- 'import/no-unused-modules': [
- 'error',
- { unusedExports: true, src: ['../**/*.{js,ts,tsx}'] },
- ],
- },
- },
{
files: [
'**/icons/**/*.js',
@@ -198,7 +188,6 @@ module.exports = {
'**/{mocks,__mocks__}/*.{js,ts,tsx}',
// can't correctly resolve usages
'**/*.{testing,electron,browser,web,api}.ts',
- 'packages/loot-core/src/server/main.ts',
],
rules: { 'import/no-unused-modules': 'off' },
},
diff --git a/package.json b/package.json
index eb8438fe50..4677accdb0 100644
--- a/package.json
+++ b/package.json
@@ -34,6 +34,7 @@
"rebuild-electron": "./node_modules/.bin/electron-rebuild -f -m ./packages/loot-core",
"rebuild-node": "yarn workspace loot-core rebuild",
"lint": "eslint . --max-warnings 0",
+ "lint:verbose": "DEBUG=eslint:cli-engine eslint . --max-warnings 0",
"typecheck": "yarn tsc",
"postinstall": "patch-package"
},
@@ -42,6 +43,7 @@
"eslint": "^8.37.0",
"eslint-config-react-app": "7.0.1",
"eslint-import-resolver-typescript": "3.5.5",
+ "eslint-plugin-import": "2.27.5",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-rulesdir": "^0.2.2",
diff --git a/packages/loot-core/src/server/main.ts b/packages/loot-core/src/server/main.ts
index 79715587a4..7b060f7af7 100644
--- a/packages/loot-core/src/server/main.ts
+++ b/packages/loot-core/src/server/main.ts
@@ -2350,6 +2350,7 @@ async function setupDocumentsDir() {
fs._setDocumentDir(documentDir);
}
+// eslint-disable-next-line import/no-unused-modules
export async function initApp(isDev, socketName) {
await sqlite.init();
await Promise.all([asyncStorage.init(), fs.init()]);
@@ -2412,6 +2413,7 @@ export async function initApp(isDev, socketName) {
}
}
+// eslint-disable-next-line import/no-unused-modules
export async function init(config) {
// Get from build
@@ -2450,6 +2452,7 @@ export async function init(config) {
}
// Export a few things required for the platform
+// eslint-disable-next-line import/no-unused-modules
export const lib = {
getDataDir: fs.getDataDir,
sendMessage: (msg, args) => connection.send(msg, args),
diff --git a/upcoming-release-notes/1223.md b/upcoming-release-notes/1223.md
new file mode 100644
index 0000000000..0c57a24167
--- /dev/null
+++ b/upcoming-release-notes/1223.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [Shazib]
+---
+
+Updated linter settings to resolve issues with import/no-unused-modules
diff --git a/yarn.lock b/yarn.lock
index 61b33fdfd2..139d497eee 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5020,6 +5020,7 @@ __metadata:
eslint: ^8.37.0
eslint-config-react-app: 7.0.1
eslint-import-resolver-typescript: 3.5.5
+ eslint-plugin-import: 2.27.5
eslint-plugin-prettier: 4.2.1
eslint-plugin-react: 7.32.2
eslint-plugin-rulesdir: ^0.2.2
@@ -8535,7 +8536,7 @@ __metadata:
languageName: node
linkType: hard
-"eslint-plugin-import@npm:^2.25.3":
+"eslint-plugin-import@npm:2.27.5, eslint-plugin-import@npm:^2.25.3":
version: 2.27.5
resolution: "eslint-plugin-import@npm:2.27.5"
dependencies: