@the-ruby-group/rgts
@the-ruby-group/rgts is an opinionated, zero-config setup for TypeScript projects. It bundles strict type checking, modern ESLint 9 (Flat Config) rules, and Prettier formatting into a single, easy-to-use package.
We built this to eliminate the debate around tooling setup. Just install it, extend it, and get back to building.
What's Inside?
- Modern ESLint 9: Fully embraces the new Flat Config (
eslint.config.js). It's type-safe, incredibly strict, and separates Node.js backend rules from React frontend rules so you only get what you need. - Prettier Integrated: Formatting is run as an ESLint rule, meaning you get formatting feedback directly in your editor's linter pass without needing a separate step.
- Ruthless Type Safety: Our TypeScript configs go far beyond
strict: true, turning on features likeexactOptionalPropertyTypesandnoUncheckedIndexedAccessto catch bugs before they ever hit runtime.
Installation
Install @the-ruby-group/rgts along with its peer dependencies (if your package manager doesn't do it automatically):
# npm
npm install --save-dev @the-ruby-group/rgts eslint prettier typescript
# yarn
yarn add --dev @the-ruby-group/rgts eslint prettier typescript
# pnpm
pnpm add -D @the-ruby-group/rgts eslint prettier typescript
# bun
bun add -d @the-ruby-group/rgts eslint prettier typescript
Usage
Depending on what you are building, pick the setup that matches your project below.
Option A: Base Setup (Node.js / Pure TypeScript)
If you are building a backend API, a CLI, or a standard TypeScript utility library, use the base configurations.
1. ESLint: Create a file named eslint.config.js (or .mjs) at the root of your project:
import rgtsBase from '@the-ruby-group/rgts/eslint.config.js';
export default rgtsBase;
(Need to add custom rules? You can wrap the export in ESLint's defineConfig or spread the array.)
2. TypeScript: Create a file named tsconfig.json at the root of your project:
{
"extends": "@the-ruby-group/rgts/tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/**/*"]
}
(Note: We intentionally don't set outDir, rootDir, or include in our shared tsconfigs because those are always project-specific.)
3. Prettier: Create a file named prettier.config.js (or .mjs) at the root of your project:
export { default } from '@the-ruby-group/rgts/prettier.config.js';
Option B: React Setup (Next.js / Vite / RSC)
If you are building a frontend application, use the React configurations. This layer automatically includes the base rules, plus all the necessary React AST parsers and Hooks rules.
1. ESLint: Create a file named eslint.config.js (or .mjs) at the root of your project:
import rgtsReact from '@the-ruby-group/rgts/eslint.config.react.js';
export default rgtsReact;
2. TypeScript: Create a file named tsconfig.json at the root of your project:
{
"extends": "@the-ruby-group/rgts/tsconfig.react.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/**/*"]
}
(Note: We intentionally don't set outDir, rootDir, or include in our shared tsconfigs because those are always project-specific.)
3. Prettier: Create a file named prettier.config.js (or .mjs) at the root of your project:
export { default } from '@the-ruby-group/rgts/prettier.config.js';
Recommended: Pre-commit Hooks
We strongly recommend using husky and lint-staged to enforce these rules before any bad code makes it into your repository. As a bonus, we suggest throwing in sort-package-json to keep your dependencies automatically organized!
- Install the tools:
npm install --save-dev husky lint-staged sort-package-json
- Initialize Husky:
npx husky init
- Configure lint-staged in your
package.json:
{
"lint-staged": {
"*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}": "eslint --fix",
"*.{json,md,yaml,yml,html,css}": "prettier --write",
"package.json": "sort-package-json"
}
}
- Update your
.husky/pre-commitfile: Ensure your.husky/pre-commitfile contains the following command to run your linting process before committing:
npx lint-staged
Now, every time you commit, your code will be automatically linted, formatted, and your package.json will be perfectly sorted. No more messy diffs!