Rules
Oxcruise has 17 built-in rules. Each rule is in one category. A category switches all its rules on or off together. See Rules and categories.
| Rule | Category | Default |
|---|---|---|
circular-dependencies | correctness | error |
cross-package-relative-dependencies | correctness | error |
dependencies-on-tests | correctness | error |
deprecated-dependencies | suspicious | warn |
dev-dependencies-in-production | correctness | error |
duplicate-packages | suspicious | warn |
folder-structure | nursery | off |
layers | restriction | off |
optional-dependencies | restriction | off |
orphan-modules | suspicious | warn |
peer-dependencies | restriction | off |
undeclared-packages | correctness | error |
unresolved-dependencies | correctness | error |
unused-exports | nursery | off |
unused-modules | nursery | off |
unused-packages | nursery | off |
visibility | restriction | off |
Correctness
Default level: error.
circular-dependencies: Reports dependencies that are part of a circular chain of imports.cross-package-relative-dependencies: Reports relative imports that reach into another workspace package, for example../other-package/src/x.dependencies-on-tests: Reports a non-test module that imports a test file or a test directory.dev-dependencies-in-production: Reports a production module that imports a package fromdevDependenciesonly.undeclared-packages: Reports imports of installed npm packages that nopackage.jsonsection declares.unresolved-dependencies: Reports an import that oxcruise cannot resolve to a file or a package.
Suspicious
Default level: warn.
deprecated-dependencies: Reports imports of deprecated Node.js built-in modules and deprecated npm packages.duplicate-packages: Reports a package that more than onepackage.jsonsection declares, for example bothdependenciesanddevDependencies.orphan-modules: Reports modules that no other module imports and that import no module.
Restriction
Default level: off.
layers: Enforces a layered architecture: a layer can import only the layers thatallowlists for it.optional-dependencies: Reports use of optional dependencies.peer-dependencies: Reports use of peer dependencies.visibility: Restricts what a folder shows to the code outside it.
Nursery
Default level: off.
folder-structure: Checks the shape of the file tree: the files that a folder must have, the names that it can have, and the case of its names.unused-exports: Reports exports that no other module imports.unused-modules: Reports source modules that no path from an entry point reaches.unused-packages: Reports a package that apackage.jsondeclares and that none of its modules imports.
Conventions
A convention tells the unused-* rules what a tool loads by itself.
A convention is active in a package.json that declares one of its packages.
When a convention lists no packages, it is always active.
- The entry points are globs relative to that
package.json. They are files that the tool loads. - The
unused-packagesrule counts the packages of a convention as used. - Use the
conventionsoption of the rules to switch conventions off or to select some of them.
| Convention | Active when it declares | Entry points | Packages used |
|---|---|---|---|
| vitest | vitest | **/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}**/__tests__/**vitest.config.*vitest.workspace.*vitest.setup.* | @vitest/*jsdomhappy-dom |
| jest | jest | **/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}**/__tests__/****/__mocks__/**jest.config.*jest.setup.* | @jest/*@types/jestbabel-jestts-jestjest-* |
| mocha | mocha | test/**tests/****/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts} | @types/mocha |
| ava | ava | test/**tests/****/*.test.{js,jsx,ts,tsx,mjs,cjs,mts,cts}ava.config.* | @ava/* |
| node-test | – | **/*.test.{js,jsx,ts,tsx,mjs,cjs,mts,cts} | – |
| playwright | @playwright/testplaywright | playwright.config.*e2e/**tests/****/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts} | @playwright/* |
| cypress | cypress | cypress.config.*cypress/** | @cypress/* |
| storybook | storybook@storybook/react@storybook/vue3@storybook/svelte@storybook/angular@storybook/nextjs@storybook/react-vite@storybook/web-components@storybook/html | **/*.stories.{js,jsx,ts,tsx,mjs,cjs,mts,cts,svelte,vue}**/*.mdx.storybook/** | @storybook/*storybook |
| next | next | app/**/{page,layout,loading,error,global-error,not-found,template,default,route,opengraph-image,twitter-image,icon,apple-icon,sitemap,robots,manifest}.*src/app/**/{page,layout,loading,error,global-error,not-found,template,default,route,opengraph-image,twitter-image,icon,apple-icon,sitemap,robots,manifest}.*pages/**src/pages/**{src/,}middleware.*{src/,}instrumentation.*next.config.* | @next/*eslint-config-next |
| remix | @remix-run/dev@remix-run/react | app/routes/**app/root.*app/entry.client.*app/entry.server.*remix.config.* | @remix-run/* |
| react-router | @react-router/dev | app/routes/**app/routes.*app/root.*app/entry.client.*app/entry.server.*react-router.config.* | @react-router/* |
| astro | astro | src/pages/**src/content/**src/content.config.*src/middleware.*src/actions/**astro.config.* | @astrojs/* |
| sveltekit | @sveltejs/kit | src/routes/**src/hooks.*src/hooks.*.*src/params/**svelte.config.*vite.config.* | @sveltejs/* |
| nuxt | nuxt | pages/**layouts/**middleware/**plugins/**server/**components/**composables/**utils/**stores/**app.vueerror.vuenuxt.config.* | @nuxt/* |
| vite | vite | vite.config.* | @vitejs/* |
| webpack | webpack | webpack.config.*webpack.*.config.* | *-loaderwebpack-cliwebpack-dev-server |
| rollup | rollup | rollup.config.* | @rollup/* |
| rolldown | rolldown | rolldown.config.* | – |
| tsup | tsup | tsup.config.* | – |
| tsdown | tsdown | tsdown.config.* | – |
| eslint | eslint | eslint.config.* | @eslint/*@typescript-eslint/*typescript-eslinteslint-* |
| prettier | prettier | prettier.config.* | @prettier/*prettier-plugin-* |
| oxlint | oxlint | oxlint.config.* | – |
| postcss | postcsstailwindcss | postcss.config.*tailwind.config.* | autoprefixercssnanopostcss-*@tailwindcss/* |
| babel | @babel/core | babel.config.* | @babel/*babel-* |
| docusaurus | @docusaurus/core | docusaurus.config.*sidebars.*src/pages/**src/theme/** | @docusaurus/* |
| vitepress | vitepress | .vitepress/config.*.vitepress/theme/**docs/.vitepress/config.*docs/.vitepress/theme/** | – |
| expo | expo | app/**app.config.*metro.config.* | expo-*@expo/* |

