diff --git a/.dependency-cruiser.cjs b/.dependency-cruiser.cjs index 0cc7caf8..5fa3e1cd 100644 --- a/.dependency-cruiser.cjs +++ b/.dependency-cruiser.cjs @@ -1,389 +1,373 @@ /** @type {import('dependency-cruiser').IConfiguration} */ module.exports = { - forbidden: [ - { - name: 'no-circular', - severity: 'warn', - comment: - 'This dependency is part of a circular relationship. You might want to revise ' + - 'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ', - from: {}, - to: { - circular: true - } - }, - { - name: 'no-orphans', - comment: - "This is an orphan module - it's likely not used (anymore?). Either use it or " + - "remove it. If it's logical this module is an orphan (i.e. it's a config file), " + - "add an exception for it in your dependency-cruiser configuration. By default " + - "this rule does not scrutinize dot-files (e.g. .eslintrc.js), TypeScript declaration " + - "files (.d.ts), tsconfig.json and some of the babel and webpack configs.", - severity: 'warn', - from: { - orphan: true, - pathNot: [ - '(^|/)[.][^/]+[.](?:js|cjs|mjs|ts|cts|mts|json)$', // dot files - '[.]d[.]ts$', // TypeScript declaration files - '(^|/)tsconfig[.]json$', // TypeScript config - '(^|/)(?:babel|webpack)[.]config[.](?:js|cjs|mjs|ts|cts|mts|json)$' // other configs - ] - }, - to: {}, - }, - { - name: 'no-deprecated-core', - comment: - 'A module depends on a node core module that has been deprecated. Find an alternative - these are ' + - "bound to exist - node doesn't deprecate lightly.", - severity: 'warn', - from: {}, - to: { - dependencyTypes: [ - 'core' - ], - path: [ - '^v8/tools/codemap$', - '^v8/tools/consarray$', - '^v8/tools/csvparser$', - '^v8/tools/logreader$', - '^v8/tools/profile_view$', - '^v8/tools/profile$', - '^v8/tools/SourceMap$', - '^v8/tools/splaytree$', - '^v8/tools/tickprocessor-driver$', - '^v8/tools/tickprocessor$', - '^node-inspect/lib/_inspect$', - '^node-inspect/lib/internal/inspect_client$', - '^node-inspect/lib/internal/inspect_repl$', - '^async_hooks$', - '^punycode$', - '^domain$', - '^constants$', - '^sys$', - '^_linklist$', - '^_stream_wrap$' - ], - } - }, - { - name: 'not-to-deprecated', - comment: - 'This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later ' + - 'version of that module, or find an alternative. Deprecated modules are a security risk.', - severity: 'warn', - from: {}, - to: { - dependencyTypes: [ - 'deprecated' - ] - } - }, - { - name: 'no-non-package-json', - severity: 'error', - comment: - "This module depends on an npm package that isn't in the 'dependencies' section of your package.json. " + - "That's problematic as the package either (1) won't be available on live (2 - worse) will be " + - "available on live with an non-guaranteed version. Fix it by adding the package to the dependencies " + - "in your package.json.", - from: {}, - to: { - dependencyTypes: [ - 'npm-no-pkg', - 'npm-unknown' - ] - } - }, - { - name: 'not-to-unresolvable', - comment: - "This module depends on a module that cannot be found ('resolved to disk'). If it's an npm " + - 'module: add it to your package.json. In all other cases you likely already know what to do.', - severity: 'error', - from: {}, - to: { - couldNotResolve: true - } - }, - { - name: 'no-duplicate-dep-types', - comment: - "Likely this module depends on an external ('npm') package that occurs more than once " + - "in your package.json i.e. bot as a devDependencies and in dependencies. This will cause " + - "maintenance problems later on.", - severity: 'warn', - from: {}, - to: { - moreThanOneDependencyType: true, - // as it's pretty common to have a type import be a type only import - // _and_ (e.g.) a devDependency - don't consider type-only dependency - // types for this rule - dependencyTypesNot: ["type-only"] - } - }, + forbidden: [ + { + name: "no-circular", + severity: "warn", + comment: + "This dependency is part of a circular relationship. You might want to revise " + + "your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ", + from: {}, + to: { + circular: true, + }, + }, + { + name: "no-orphans", + comment: + "This is an orphan module - it's likely not used (anymore?). Either use it or " + + "remove it. If it's logical this module is an orphan (i.e. it's a config file), " + + "add an exception for it in your dependency-cruiser configuration. By default " + + "this rule does not scrutinize dot-files (e.g. .eslintrc.js), TypeScript declaration " + + "files (.d.ts), tsconfig.json and some of the babel and webpack configs.", + severity: "warn", + from: { + orphan: true, + pathNot: [ + "(^|/)[.][^/]+[.](?:js|cjs|mjs|ts|cts|mts|json)$", // dot files + "[.]d[.]ts$", // TypeScript declaration files + "(^|/)tsconfig[.]json$", // TypeScript config + "(^|/)(?:babel|webpack)[.]config[.](?:js|cjs|mjs|ts|cts|mts|json)$", // other configs + ], + }, + to: {}, + }, + { + name: "no-deprecated-core", + comment: + "A module depends on a node core module that has been deprecated. Find an alternative - these are " + + "bound to exist - node doesn't deprecate lightly.", + severity: "warn", + from: {}, + to: { + dependencyTypes: ["core"], + path: [ + "^v8/tools/codemap$", + "^v8/tools/consarray$", + "^v8/tools/csvparser$", + "^v8/tools/logreader$", + "^v8/tools/profile_view$", + "^v8/tools/profile$", + "^v8/tools/SourceMap$", + "^v8/tools/splaytree$", + "^v8/tools/tickprocessor-driver$", + "^v8/tools/tickprocessor$", + "^node-inspect/lib/_inspect$", + "^node-inspect/lib/internal/inspect_client$", + "^node-inspect/lib/internal/inspect_repl$", + "^async_hooks$", + "^punycode$", + "^domain$", + "^constants$", + "^sys$", + "^_linklist$", + "^_stream_wrap$", + ], + }, + }, + { + name: "not-to-deprecated", + comment: + "This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later " + + "version of that module, or find an alternative. Deprecated modules are a security risk.", + severity: "warn", + from: {}, + to: { + dependencyTypes: ["deprecated"], + }, + }, + { + name: "no-non-package-json", + severity: "error", + comment: + "This module depends on an npm package that isn't in the 'dependencies' section of your package.json. " + + "That's problematic as the package either (1) won't be available on live (2 - worse) will be " + + "available on live with an non-guaranteed version. Fix it by adding the package to the dependencies " + + "in your package.json.", + from: {}, + to: { + dependencyTypes: ["npm-no-pkg", "npm-unknown"], + }, + }, + { + name: "not-to-unresolvable", + comment: + "This module depends on a module that cannot be found ('resolved to disk'). If it's an npm " + + "module: add it to your package.json. In all other cases you likely already know what to do.", + severity: "error", + from: {}, + to: { + couldNotResolve: true, + }, + }, + { + name: "no-duplicate-dep-types", + comment: + "Likely this module depends on an external ('npm') package that occurs more than once " + + "in your package.json i.e. bot as a devDependencies and in dependencies. This will cause " + + "maintenance problems later on.", + severity: "warn", + from: {}, + to: { + moreThanOneDependencyType: true, + // as it's pretty common to have a type import be a type only import + // _and_ (e.g.) a devDependency - don't consider type-only dependency + // types for this rule + dependencyTypesNot: ["type-only"], + }, + }, - /* rules you might want to tweak for your specific situation: */ - - { - name: 'not-to-spec', - comment: - 'This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. ' + - "If there's something in a spec that's of use to other modules, it doesn't have that single " + - 'responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.', - severity: 'error', - from: {}, - to: { - path: '[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx|ls|coffee|litcoffee|coffee[.]md)$' - } - }, - { - name: 'not-to-dev-dep', - severity: 'error', - comment: - "This module depends on an npm package from the 'devDependencies' section of your " + - 'package.json. It looks like something that ships to production, though. To prevent problems ' + - "with npm packages that aren't there on production declare it (only!) in the 'dependencies'" + - 'section of your package.json. If this module is development only - add it to the ' + - 'from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration', - from: { - path: '^(packages)', - pathNot: '[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx|ls|coffee|litcoffee|coffee[.]md)$' - }, - to: { - dependencyTypes: [ - 'npm-dev', - ], - // type only dependencies are not a problem as they don't end up in the - // production code or are ignored by the runtime. - dependencyTypesNot: [ - 'type-only' - ], - pathNot: [ - 'node_modules/@types/' - ] - } - }, - { - name: 'optional-deps-used', - severity: 'info', - comment: - "This module depends on an npm package that is declared as an optional dependency " + - "in your package.json. As this makes sense in limited situations only, it's flagged here. " + - "If you're using an optional dependency here by design - add an exception to your" + - "dependency-cruiser configuration.", - from: {}, - to: { - dependencyTypes: [ - 'npm-optional' - ] - } - }, - { - name: 'peer-deps-used', - comment: - "This module depends on an npm package that is declared as a peer dependency " + - "in your package.json. This makes sense if your package is e.g. a plugin, but in " + - "other cases - maybe not so much. If the use of a peer dependency is intentional " + - "add an exception to your dependency-cruiser configuration.", - severity: 'warn', - from: {}, - to: { - dependencyTypes: [ - 'npm-peer' - ] - } - } - ], - options: { + /* rules you might want to tweak for your specific situation: */ - /* Which modules not to follow further when encountered */ - doNotFollow: { - /* path: an array of regular expressions in strings to match against */ - path: ['node_modules'] - }, + { + name: "not-to-spec", + comment: + "This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. " + + "If there's something in a spec that's of use to other modules, it doesn't have that single " + + "responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.", + severity: "error", + from: {}, + to: { + path: "[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx|ls|coffee|litcoffee|coffee[.]md)$", + }, + }, + { + name: "not-to-dev-dep", + severity: "error", + comment: + "This module depends on an npm package from the 'devDependencies' section of your " + + "package.json. It looks like something that ships to production, though. To prevent problems " + + "with npm packages that aren't there on production declare it (only!) in the 'dependencies'" + + "section of your package.json. If this module is development only - add it to the " + + "from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration", + from: { + path: "^(packages)", + pathNot: + "[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx|ls|coffee|litcoffee|coffee[.]md)$", + }, + to: { + dependencyTypes: ["npm-dev"], + // type only dependencies are not a problem as they don't end up in the + // production code or are ignored by the runtime. + dependencyTypesNot: ["type-only"], + pathNot: ["node_modules/@types/"], + }, + }, + { + name: "optional-deps-used", + severity: "info", + comment: + "This module depends on an npm package that is declared as an optional dependency " + + "in your package.json. As this makes sense in limited situations only, it's flagged here. " + + "If you're using an optional dependency here by design - add an exception to your" + + "dependency-cruiser configuration.", + from: {}, + to: { + dependencyTypes: ["npm-optional"], + }, + }, + { + name: "peer-deps-used", + comment: + "This module depends on an npm package that is declared as a peer dependency " + + "in your package.json. This makes sense if your package is e.g. a plugin, but in " + + "other cases - maybe not so much. If the use of a peer dependency is intentional " + + "add an exception to your dependency-cruiser configuration.", + severity: "warn", + from: {}, + to: { + dependencyTypes: ["npm-peer"], + }, + }, + ], + options: { + /* Which modules not to follow further when encountered */ + doNotFollow: { + /* path: an array of regular expressions in strings to match against */ + path: ["node_modules"], + }, - /* Which modules to exclude */ - // exclude : { - // /* path: an array of regular expressions in strings to match against */ - // path: '', - // }, + /* Which modules to exclude */ + // exclude : { + // /* path: an array of regular expressions in strings to match against */ + // path: '', + // }, - /* Which modules to exclusively include (array of regular expressions in strings) - dependency-cruiser will skip everything not matching this pattern - */ - // includeOnly : [''], + /* Which modules to exclusively include (array of regular expressions in strings) + dependency-cruiser will skip everything not matching this pattern + */ + // includeOnly : [''], - /* dependency-cruiser will include modules matching against the focus - regular expression in its output, as well as their direct neighbours - (dependencies and dependents) - */ - // focus : '', + /* dependency-cruiser will include modules matching against the focus + regular expression in its output, as well as their direct neighbours + (dependencies and dependents) + */ + // focus : '', - /* List of module systems to cruise. - When left out dependency-cruiser will fall back to the list of _all_ - module systems it knows of. It's the default because it's the safe option - It might come at a performance penalty, though. - moduleSystems: ['amd', 'cjs', 'es6', 'tsd'] - - As in practice only commonjs ('cjs') and ecmascript modules ('es6') - are widely used, you can limit the moduleSystems to those. - */ - - // moduleSystems: ['cjs', 'es6'], + /* List of module systems to cruise. + When left out dependency-cruiser will fall back to the list of _all_ + module systems it knows of. It's the default because it's the safe option + It might come at a performance penalty, though. + moduleSystems: ['amd', 'cjs', 'es6', 'tsd'] - /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/develop/' - to open it on your online repo or `vscode://file/${process.cwd()}/` to - open it in visual studio code), - */ - // prefix: `vscode://file/${process.cwd()}/`, + As in practice only commonjs ('cjs') and ecmascript modules ('es6') + are widely used, you can limit the moduleSystems to those. + */ - /* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation - true: also detect dependencies that only exist before typescript-to-javascript compilation - "specify": for each dependency identify whether it only exists before compilation or also after - */ - tsPreCompilationDeps: true, - - /* list of extensions to scan that aren't javascript or compile-to-javascript. - Empty by default. Only put extensions in here that you want to take into - account that are _not_ parsable. - */ - // extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"], + // moduleSystems: ['cjs', 'es6'], - /* if true combines the package.jsons found from the module up to the base - folder the cruise is initiated from. Useful for how (some) mono-repos - manage dependencies & dependency definitions. - */ - combinedDependencies: true, + /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/develop/' + to open it on your online repo or `vscode://file/${process.cwd()}/` to + open it in visual studio code), + */ + // prefix: `vscode://file/${process.cwd()}/`, - /* if true leave symlinks untouched, otherwise use the realpath */ - // preserveSymlinks: false, + /* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation + true: also detect dependencies that only exist before typescript-to-javascript compilation + "specify": for each dependency identify whether it only exists before compilation or also after + */ + tsPreCompilationDeps: true, - /* TypeScript project file ('tsconfig.json') to use for - (1) compilation and - (2) resolution (e.g. with the paths property) + /* list of extensions to scan that aren't javascript or compile-to-javascript. + Empty by default. Only put extensions in here that you want to take into + account that are _not_ parsable. + */ + // extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"], - The (optional) fileName attribute specifies which file to take (relative to - dependency-cruiser's current working directory). When not provided - defaults to './tsconfig.json'. - */ - tsConfig: { - fileName: 'tsconfig.base.json' - }, + /* if true combines the package.jsons found from the module up to the base + folder the cruise is initiated from. Useful for how (some) mono-repos + manage dependencies & dependency definitions. + */ + combinedDependencies: true, - /* Webpack configuration to use to get resolve options from. + /* if true leave symlinks untouched, otherwise use the realpath */ + // preserveSymlinks: false, - The (optional) fileName attribute specifies which file to take (relative - to dependency-cruiser's current working directory. When not provided defaults - to './webpack.conf.js'. + /* TypeScript project file ('tsconfig.json') to use for + (1) compilation and + (2) resolution (e.g. with the paths property) - The (optional) `env` and `arguments` attributes contain the parameters to be passed if - your webpack config is a function and takes them (see webpack documentation - for details) - */ - // webpackConfig: { - // fileName: 'webpack.config.js', - // env: {}, - // arguments: {} - // }, + The (optional) fileName attribute specifies which file to take (relative to + dependency-cruiser's current working directory). When not provided + defaults to './tsconfig.json'. + */ + tsConfig: { + fileName: "tsconfig.json", + }, - /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use - for compilation (and whatever other naughty things babel plugins do to - source code). - */ - // babelConfig: { - // fileName: '.babelrc', - // }, + /* Webpack configuration to use to get resolve options from. - /* List of strings you have in use in addition to cjs/ es6 requires - & imports to declare module dependencies. Use this e.g. if you've - re-declared require, use a require-wrapper or use window.require as - a hack. - */ - // exoticRequireStrings: [], - - /* options to pass on to enhanced-resolve, the package dependency-cruiser - uses to resolve module references to disk. The values below should be - suitable for most situations + The (optional) fileName attribute specifies which file to take (relative + to dependency-cruiser's current working directory. When not provided defaults + to './webpack.conf.js'. - If you use webpack: you can also set these in webpack.conf.js. The set - there will override the ones specified here. - */ - enhancedResolveOptions: { - /* What to consider as an 'exports' field in package.jsons */ - exportsFields: ["exports"], - /* List of conditions to check for in the exports field. - Only works when the 'exportsFields' array is non-empty. - */ - conditionNames: ["import", "require", "node", "default", "types"], - /* - The extensions, by default are the same as the ones dependency-cruiser - can access (run `npx depcruise --info` to see which ones that are in - _your_ environment. If that list is larger than you need you can pass - the extensions you actually use (e.g. [".js", ".jsx"]). This can speed - up the most expensive step in dependency cruising (module resolution) - quite a bit. - */ - // extensions: [".js", ".jsx", ".ts", ".tsx", ".d.ts"], - /* What to consider a 'main' field in package.json */ - mainFields: ["module", "main", "types", "typings"], - /* - A list of alias fields in package.jsons - See [this specification](https://github.com/defunctzombie/package-browser-field-spec) and - the [resolve.alias](https://webpack.js.org/configuration/resolve/#resolvealiasfields) - documentation in the webpack docs. - - Defaults to an empty array (don't use any alias fields). - */ - // aliasFields: ["browser"], - }, - reporterOptions: { - dot: { - /* pattern of modules that can be consolidated in the detailed - graphical dependency graph. The default pattern in this configuration - collapses everything in node_modules to one folder deep so you see - the external modules, but not the innards your app depends upon. + The (optional) `env` and `arguments` attributes contain the parameters to be passed if + your webpack config is a function and takes them (see webpack documentation + for details) */ - collapsePattern: 'node_modules/(?:@[^/]+/[^/]+|[^/]+)', + // webpackConfig: { + // fileName: 'webpack.config.js', + // env: {}, + // arguments: {} + // }, - /* Options to tweak the appearance of your graph.See - https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions - for details and some examples. If you don't specify a theme - don't worry - dependency-cruiser will fall back to the default one. - */ - // theme: { - // graph: { - // /* splines: "ortho" will give you straight lines at the expense of - // being slow to render on big graphs - // splines: "true" will give you bezier curves which are faster - // but might not look as nice - // */ - // splines: "true" - // }, - // } - }, - archi: { - /* pattern of modules that can be consolidated in the high level - graphical dependency graph. If you use the high level graphical - dependency graph reporter (`archi`) you probably want to tweak - this collapsePattern to your situation. + /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use + for compilation (and whatever other naughty things babel plugins do to + source code). + */ + // babelConfig: { + // fileName: '.babelrc', + // }, + + /* List of strings you have in use in addition to cjs/ es6 requires + & imports to declare module dependencies. Use this e.g. if you've + re-declared require, use a require-wrapper or use window.require as + a hack. */ - collapsePattern: '^(?:packages|src|lib(s?)|app(s?)|bin|test(s?)|spec(s?))/[^/]+|node_modules/(?:@[^/]+/[^/]+|[^/]+)', + // exoticRequireStrings: [], + + /* options to pass on to enhanced-resolve, the package dependency-cruiser + uses to resolve module references to disk. The values below should be + suitable for most situations - /* Options to tweak the appearance of your graph.See - https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions - for details and some examples. If you don't specify a theme - for 'archi' dependency-cruiser will use the one specified in the - dot section above and otherwise use the default one. + If you use webpack: you can also set these in webpack.conf.js. The set + there will override the ones specified here. */ - // theme: { - // }, - }, - "text": { - "highlightFocused": true - }, - } - } + enhancedResolveOptions: { + /* What to consider as an 'exports' field in package.jsons */ + exportsFields: ["exports"], + /* List of conditions to check for in the exports field. + Only works when the 'exportsFields' array is non-empty. + */ + conditionNames: ["import", "require", "node", "default", "types"], + /* + The extensions, by default are the same as the ones dependency-cruiser + can access (run `npx depcruise --info` to see which ones that are in + _your_ environment. If that list is larger than you need you can pass + the extensions you actually use (e.g. [".js", ".jsx"]). This can speed + up the most expensive step in dependency cruising (module resolution) + quite a bit. + */ + // extensions: [".js", ".jsx", ".ts", ".tsx", ".d.ts"], + /* What to consider a 'main' field in package.json */ + mainFields: ["module", "main", "types", "typings"], + /* + A list of alias fields in package.jsons + See [this specification](https://github.com/defunctzombie/package-browser-field-spec) and + the [resolve.alias](https://webpack.js.org/configuration/resolve/#resolvealiasfields) + documentation in the webpack docs. + + Defaults to an empty array (don't use any alias fields). + */ + // aliasFields: ["browser"], + }, + reporterOptions: { + dot: { + /* pattern of modules that can be consolidated in the detailed + graphical dependency graph. The default pattern in this configuration + collapses everything in node_modules to one folder deep so you see + the external modules, but not the innards your app depends upon. + */ + collapsePattern: "node_modules/(?:@[^/]+/[^/]+|[^/]+)", + + /* Options to tweak the appearance of your graph.See + https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions + for details and some examples. If you don't specify a theme + don't worry - dependency-cruiser will fall back to the default one. + */ + // theme: { + // graph: { + // /* splines: "ortho" will give you straight lines at the expense of + // being slow to render on big graphs + // splines: "true" will give you bezier curves which are faster + // but might not look as nice + // */ + // splines: "true" + // }, + // } + }, + archi: { + /* pattern of modules that can be consolidated in the high level + graphical dependency graph. If you use the high level graphical + dependency graph reporter (`archi`) you probably want to tweak + this collapsePattern to your situation. + */ + collapsePattern: + "^(?:packages|src|lib(s?)|app(s?)|bin|test(s?)|spec(s?))/[^/]+|node_modules/(?:@[^/]+/[^/]+|[^/]+)", + + /* Options to tweak the appearance of your graph.See + https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions + for details and some examples. If you don't specify a theme + for 'archi' dependency-cruiser will use the one specified in the + dot section above and otherwise use the default one. + */ + // theme: { + // }, + }, + text: { + highlightFocused: true, + }, + }, + }, }; // generated: dependency-cruiser@16.3.1 on 2024-04-16T10:36:05.632Z diff --git a/biome.json b/biome.json index feb188d8..109ea45b 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json", + "$schema": "https://biomejs.dev/schemas/1.8.1/schema.json", "organizeImports": { "enabled": true }, diff --git a/bun.lockb b/bun.lockb index 090cc14e..b130ac7a 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 613ee4c4..da5061b0 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig tsconfig.json --watch", - "lint": "npx @biomejs/biome check --apply ./src", + "lint": "npx @biomejs/biome check --write ./src", "lint:deps": "npx depcruise apps" }, "type": "module", @@ -38,7 +38,7 @@ "@twurple/auth": "7.1.0", "@twurple/easy-bot": "7.1.0", "@twurple/pubsub": "7.1.0", - "hono": "4.4.4", + "hono": "4.4.5", "howler": "2.2.4", "jsonwebtoken": "9.0.2", "pixi.js": "8.1.6", @@ -46,22 +46,22 @@ "react-dom": "18.3.1" }, "devDependencies": { - "@biomejs/biome": "1.8.0", + "@biomejs/biome": "1.8.1", "@sveltejs/kit": "2.5.10", "@sveltejs/vite-plugin-svelte": "3.1.1", - "@tailwindcss/vite": "4.0.0-alpha.15", + "@tailwindcss/vite": "4.0.0-alpha.16", "@types/bun": "1.1.3", "@types/howler": "2.2.11", "@types/jsonwebtoken": "9.0.6", "@types/react": "18.3.3", "@types/react-dom": "18.3.0", - "@vitejs/plugin-react": "4.3.0", - "dependency-cruiser": "16.3.2", + "@vitejs/plugin-react": "4.3.1", + "dependency-cruiser": "16.3.3", "prisma": "5.15.0", "svelte": "4.2.18", "svelte-adapter-bun": "0.5.2", "svelte-check": "3.8.0", - "tailwindcss": "4.0.0-alpha.15", + "tailwindcss": "4.0.0-alpha.16", "tslib": "2.6.3", "typescript": "5.4.5", "vite": "5.2.13" diff --git a/src/app.d.ts b/src/app.d.ts index 0c354550..7149e89e 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -1,6 +1,6 @@ // See https://kit.svelte.dev/docs/types#app // for information about these interfaces -import type { IProfile } from "$lib/types"; +import type { IProfile } from "$lib/types" declare global { namespace App { @@ -14,5 +14,3 @@ declare global { // interface Platform {} } } - -export type {} diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 540f2665..ffd80996 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -1,34 +1,34 @@ -import { env as privateEnv } from "$env/dynamic/private"; -import { env as publicEnv } from "$env/dynamic/public"; -import { type Handle, error } from "@sveltejs/kit"; -import jwt from "jsonwebtoken"; -import type { IProfile } from "$lib/types"; +import { env as privateEnv } from "$env/dynamic/private" +import { env as publicEnv } from "$env/dynamic/public" +import type { IProfile } from "$lib/types" +import { type Handle, error } from "@sveltejs/kit" +import jwt from "jsonwebtoken" export const handle: Handle = async ({ event, resolve }) => { const cookieKey = publicEnv.PUBLIC_COOKIE_KEY const jwtSecret = privateEnv.PRIVATE_JWT_SECRET_KEY if (jwtSecret && cookieKey && event.cookies.get(cookieKey)) { - const token = event.cookies.get(cookieKey); + const token = event.cookies.get(cookieKey) if (!token) { - event.locals.profile = null; - return resolve(event); + event.locals.profile = null + return resolve(event) } try { - const payload = jwt.verify(token, jwtSecret); + const payload = jwt.verify(token, jwtSecret) if (typeof payload === "string") { - error(400, "Something went wrong"); + error(400, "Something went wrong") } if (!payload.profile) { - error(400, "Token is not valid"); + error(400, "Token is not valid") } const profile = payload.profile as IProfile event.locals.profile = { - ...profile - }; + ...profile, + } } catch (error) { if (error instanceof jwt.TokenExpiredError) { event.cookies.delete(cookieKey, { path: "/" }) @@ -36,5 +36,5 @@ export const handle: Handle = async ({ event, resolve }) => { } } - return resolve(event); -}; \ No newline at end of file + return resolve(event) +} diff --git a/src/lib/components/Footer.svelte b/src/lib/components/Footer.svelte index 4ef2a308..e9362af4 100644 --- a/src/lib/components/Footer.svelte +++ b/src/lib/components/Footer.svelte @@ -1,5 +1,10 @@