{"slug": "monoswan-a-pleasant-ts-monorepo-linter", "title": "Monoswan – a pleasant TS monorepo linter", "summary": "Monoswan, a TypeScript monorepo linter from developer pelicanonical, launched to keep package.json, tsconfig.json, and other standard files consistent across monorepo packages by defining shared package shapes once and checking them with built-in or custom rules. The tool discovers packages from pnpm, npm, Yarn, and Bun workspace declarations, requires Node.js 22.13 or newer, and installs as a development dependency at the workspace root via pnpm, npm, Yarn, or Bun. It ships four commands — lint (with --fix), init, print-config, and create-package — and documentation at monoswan.com/docs, with bugs reported through the project's GitHub issues.", "body_md": "**pleasant monorepos**\n\nmonoswan keeps package configuration consistent across a monorepo. Define shared package shapes once, check them with rules, and use the same definitions to create new packages. It discovers packages from pnpm, npm, Yarn, and Bun workspace declarations.\n\n- **Centrally managed configuration:** Share`package.json` , TypeScript, JSON, and text\nconfiguration through composable variants.\n- **Rules and consistency:** Check packages with built-in or custom rules, with autofix\nsupport.\n- **Package templates:** Create packages from variant defaults and initialization content.\n\nCopy this prompt into your coding agent:\n\n```\nmonoswan is a monorepo management tool to help keep your package.json, tsconfig.json, and other standard files consistent across packages in a monorepo. Set up monoswan in this monorepo, you can view the full documentation at monoswan.com/llms.txt. Inspect the workspace first so you can preserve its package manager, structure, and existing conventions. Install monoswan as a development dependency at the workspace root, run its init command, then review the workspace packages and define practical variants in monoswan.config.ts for their shared package.json, TypeScript, JSON, and text-file configuration. Assign the appropriate variant or variants to each package, run the monoswan linter, fix any issues it reports without changing unrelated behavior, and summarize the configuration and files you changed.\n```\n\n- Node.js 22.13 or newer\n- A `pnpm-workspace.yaml` or a`workspaces` declaration in the root`package.json`\n\nInstall monoswan at the workspace root.\n\n```\n# pnpm\npnpm add -D -w monoswan\n\n# npm\nnpm install -D monoswan\n\n# yarn\nyarn add -D -W monoswan\n\n# bun\nbun add -D monoswan\n```\n\nInitialize a configuration:\n\n```\npnpm exec monoswan init\n```\n\nUse `npx monoswan`, `yarn monoswan`, or `bunx monoswan` in the commands below when using a\ndifferent package manager.\n\nWorkspace discovery supports pnpm workspace files, npm and Bun workspace arrays, and both Yarn workspace forms, including modern Yarn Plug'n'Play installations. monoswan reads workspace declarations directly and does not invoke the package manager during discovery.\n\nThen describe a shared package shape in `monoswan.config.ts`:\n\n``` js\nimport { defineConfig, enforceVariants, sortPackageJson } from \"monoswan\";\n\nexport default defineConfig({\n  variants: {\n    \"my-library\": {\n      packageJson: { type: \"module\" },\n      tsConfig: { compilerOptions: { strict: true } },\n    },\n  },\n  rules: [enforceVariants(), sortPackageJson()],\n});\n```\n\nAssign the variant to a workspace package:\n\n```\n{\n  \"name\": \"@myrepo/example\",\n  \"monoswan\": {\n    \"variants\": [\"my-library\"]\n  }\n}\n```\n\nCheck the workspace:\n\n```\npnpm exec monoswan lint .\n```\n\n| Command | Purpose | \n|---|---|\n| `monoswan lint [path]` | Check workspace packages and optionally apply fixes with `--fix` . | \n| `monoswan init [path]` | Create an initial `monoswan.config.ts` . | \n| `monoswan print-config [path]` | Print the resolved configuration for a package. | \n| `monoswan create-package <path> <name> <variants...>` | Generate a package from variant templates. | \n\nRun `pnpm exec monoswan <command> --help` for complete command syntax.\n\nFull documentation is available at [monoswan.com/docs](https://monoswan.com/docs/).\nReport bugs and request features through the project's\n[GitHub issues](https://github.com/pelicanonical/monoswan/issues).\n\nThis repository uses pnpm and pins the contributor runtime in `package.json`.\n\n```\npnpm install\npnpm lint\npnpm check\npnpm test\npnpm build\n```\n\n", "url": "https://wpnews.pro/news/monoswan-a-pleasant-ts-monorepo-linter", "canonical_source": "https://github.com/pelicanonical/monoswan", "published_at": "2026-10-04 20:13:00+00:00", "updated_at": "2026-10-04 20:41:21.510850+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Monoswan", "pelicanonical", "pnpm", "npm", "Yarn", "Bun", "Node.js", "GitHub"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/monoswan-a-pleasant-ts-monorepo-linter", "markdown": "https://wpnews.pro/news/monoswan-a-pleasant-ts-monorepo-linter.md", "text": "https://wpnews.pro/news/monoswan-a-pleasant-ts-monorepo-linter.txt", "jsonld": "https://wpnews.pro/news/monoswan-a-pleasant-ts-monorepo-linter.jsonld"}}