Profiles & stacks
A rule written for React is wrong on a NestJS service. A profile is the set of rule sets that fit one kind of repository, so each repository only gets rules that apply to it.
Why profiles exist
React's rules about effects and rendering make no sense on a backend service. Fire them there and every finding is noise, and people learn to skip findings. The problem is that both a React component and a NestJS controller are .tsx or .ts files, so a file pattern alone cannot tell them apart.
Redline makes that choice once per repository instead of once per file. The repository picks a profile, and only that profile's rules are installed.
Stacks and profiles
| Term | What it is | Example |
|---|---|---|
| Stack | One rule set for a language, framework or platform. Each says which files it applies to with a glob. Redline has 20. | react, applies to **/*.tsx and **/*.jsx, among others |
| Profile | A named list of stacks that belong together for one kind of repository. | web-react = javascript · typescript · react |
The core standard applies to every profile and is not listed. Within one repository the installed stacks never contradict each other, so a plain glob is enough to say which rules apply to which file.
The profiles
| Profile | Stacks |
|---|---|
javascript-typescript | javascript · typescript (no framework: CLIs, libraries, scripts) |
web-react | javascript · typescript · react |
web-nextjs | javascript · typescript · react · nextjs (Next.js App Router) |
web-angular | javascript · typescript · angular |
web-vue | javascript · typescript · vue |
web-svelte | javascript · typescript · svelte (Svelte and SvelteKit) |
javascript-typescript-browser | javascript · typescript · dom (browser code with no framework) |
mobile-react-native | javascript · typescript · react · react-native |
mobile-android | kotlin |
mobile-ios | swift |
service-java | microservices · java (Spring Boot) |
service-go | microservices · go |
service-node | javascript · typescript · microservices · nodejs (NestJS) |
service-express | javascript · typescript · microservices · express |
service-python | microservices · python |
service-dotnet | microservices · csharp |
infra-terraform | terraform (Terraform / HCL) |
fullstack-react-node | javascript · typescript · react · microservices · nodejs |
typescript-effect | effect (added on top of another profile) |
mobile-react-native installs both React and React Native on purpose: the React Native rules extend the React ones, and each file says so.
How a profile is chosen
pnpm redline init proposes a profile from the files and dependencies in the checkout, and you can accept it or name another. Detection tries the more specific frameworks first:
- Next.js before React. Every Next.js app also depends on React, so checking React first would review a Next.js codebase with nothing covering Server Actions, the client boundary or
NEXT_PUBLIC_. - Express after every web framework. Many front-end repositories list Express as a dev dependency for a dev server or mock API. A React app with an Express dev server is still a React app. A NestJS service stays
service-node, because the Express rules say they do not apply to Nest. - Effect is added, not chosen. A repository that depends on
effectgetstypescript-effecton top of whatever else it is. javascript-typescript-browseris never proposed. Plain browser JavaScript looks the same as a build script from the outside, and guessing wrong would install DOM rules where there is no DOM. Choose it yourself.
Choosing or combining profiles
Name a profile to override detection. A repository that is two kinds of code at once names several, separated by commas, and gets every stack from each:
$ pnpm redline init --profile javascript-typescript-browser # a React app with its own Terraform beside it $ pnpm redline init --profile web-react,infra-terraform
$ npx redlinegate init --profile javascript-typescript-browser # a React app with its own Terraform beside it $ npx redlinegate init --profile web-react,infra-terraform
$ yarn redline init --profile javascript-typescript-browser # a React app with its own Terraform beside it $ yarn redline init --profile web-react,infra-terraform
$ bun run redline init --profile javascript-typescript-browser # a React app with its own Terraform beside it $ bun run redline init --profile web-react,infra-terraform
The choice is recorded in .redline.json and kept on every later init. The list is stored sorted, so the order you type it in never changes the result.
Names and aliases
Profiles are named <kind>-<technology> in full words: web-react, service-go, infra-terraform. With no framework, the name lists the languages and platform the rules cover: javascript-typescript, javascript-typescript-browser.
Short and older names such as web, node, infra and tooling still work anywhere a profile is named. They resolve to the full name, and the repository is recorded under that name on its next init or sync. The full list is profileAliases in standards/manifest.json.
Files no stack covers
Shell scripts, Dockerfiles and Gherkin have no stack on purpose: a linter serves them better than a model review. When a change touches a file no installed stack matches, local review says so and applies only the core rules to it:
$ pnpm redline review --staged warn no stack covers 1 changed file(s), so only the core rules applied to them: run.sh
$ npx redlinegate review --staged warn no stack covers 1 changed file(s), so only the core rules applied to them: run.sh
$ yarn redline review --staged warn no stack covers 1 changed file(s), so only the core rules applied to them: run.sh
$ bun run redline review --staged warn no stack covers 1 changed file(s), so only the core rules applied to them: run.sh
Learn step 02 runs a review bounded to your profile.
Related
- Standards: every stack and its rules.
- Onboarding: where the profile is chosen.
- What changed: the rename that introduced most aliases.