diff --git a/eslint.config.js b/eslint.config.js index 59b874d97..a6ce90d80 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,6 +2,7 @@ import globals from "globals"; import js from "@eslint/js"; import prettier from "eslint-config-prettier"; import svelte from "eslint-plugin-svelte"; +import simpleImportSort from "eslint-plugin-simple-import-sort"; import svelteParser from "svelte-eslint-parser"; import ts from "typescript-eslint"; @@ -11,6 +12,9 @@ export default [ ...ts.configs.recommended, prettier, { + plugins: { + "simple-import-sort": simpleImportSort, + }, languageOptions: { parser: ts.parser, parserOptions: { @@ -45,6 +49,27 @@ export default [ // Require let or const instead of var. // https://eslint.org/docs/rules/no-var "no-var": "warn", + "simple-import-sort/imports": [ + "warn", + { + groups: [ + // Type imports + ["\\u0000$"], + // Node.js built-in modules + ["^node:"], + // Everything not matched, aka third party packages + ["^"], + // Files under @app and @lib without an extension + ["^(@app\/lib).*(\.svelte$|\.ts$|\.js$){0}"], + // Files under @app and @lib ending in .svelte or svelte.ts + ["^(@app\/lib).*(\.svelte$)"], + // Svelte components imported through @app + ["^(@app).*(\.svelte$)"], + // Everything else imported through relative imports + ["^\\."], + ], + }, + ], // Require `===` and `!==` comparisons. eqeqeq: "warn", "@typescript-eslint/no-floating-promises": "warn", diff --git a/package-lock.json b/package-lock.json index bc10ac6c7..e216a22e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,6 +42,7 @@ "dompurify": "^3.2.5", "eslint": "^9.26.0", "eslint-config-prettier": "^10.1.5", + "eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-svelte": "^3.5.1", "execa": "^9.5.3", "fuzzysort": "^3.1.0", @@ -2319,10 +2320,11 @@ } }, "node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", "dev": true, + "license": "MIT", "dependencies": { "ms": "^2.1.3" }, @@ -2601,6 +2603,16 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-plugin-simple-import-sort": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-12.1.1.tgz", + "integrity": "sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, "node_modules/eslint-plugin-svelte": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/eslint-plugin-svelte/-/eslint-plugin-svelte-3.5.1.tgz", @@ -5051,10 +5063,11 @@ "dev": true }, "node_modules/tinyglobby": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.13.tgz", - "integrity": "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw==", + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", "dev": true, + "license": "MIT", "dependencies": { "fdir": "^6.4.4", "picomatch": "^4.0.2" diff --git a/package.json b/package.json index 671ca03b1..4f5e6ebae 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "check-rs": "scripts/check-rs", "test:unit": "TZ='UTC' vitest run", "test:e2e": "TZ='UTC' playwright test", - "format": "npx prettier '**/*.@(ts|js|svelte|json|css|html|yml)' --write", + "format": "npx prettier '**/*.@(ts|js|svelte|json|css|html|yml)' '!crates/**/*' --write", "generate-types": "cargo test --manifest-path ./crates/radicle-types/Cargo.toml", "tauri": "npx tauri" }, @@ -57,6 +57,7 @@ "dompurify": "^3.2.5", "eslint": "^9.26.0", "eslint-config-prettier": "^10.1.5", + "eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-svelte": "^3.5.1", "execa": "^9.5.3", "fuzzysort": "^3.1.0", diff --git a/playwright.config.ts b/playwright.config.ts index 14ea6abb4..2b44c7293 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,4 +1,5 @@ import type { PlaywrightTestConfig } from "@playwright/test"; + import { devices } from "@playwright/test"; const config: PlaywrightTestConfig = { diff --git a/src/App.svelte b/src/App.svelte index 06eb80237..d03ac3d1c 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1,42 +1,43 @@