You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/standards/_index.md
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: "Standards"
3
3
linkTitle: "Standards"
4
4
weight: 20
5
-
description: "Per-language tooling standards for Python, Bash, Terraform, Ansible, Ruby, Go, and universal security tools."
5
+
description: "Per-language tooling standards for Python, Bash, Terraform, Ansible, Ruby, Go, JavaScript/TypeScript, and universal security tools."
6
6
---
7
7
8
8
DevRail defines opinionated tooling standards for each supported language ecosystem. Every tool is pre-installed in the dev-toolchain container and invoked through consistent Makefile targets.
@@ -11,15 +11,15 @@ DevRail defines opinionated tooling standards for each supported language ecosys
11
11
12
12
The following table shows the default tool for each concern per language. These tools are pre-installed in the `dev-toolchain` container.
JavaScript and TypeScript projects use ESLint for linting, Prettier for formatting, npm audit for security scanning, Vitest for testing, and tsc for type checking. A single `javascript` entry in `.devrail.yml` covers both languages.
ESLint v9 uses flat config (`eslint.config.js`), not the legacy `.eslintrc` format. The `@eslint/js` and `typescript-eslint` packages are installed globally in the container so flat config imports resolve without project-local `node_modules`.
57
+
58
+
### Prettier
59
+
60
+
Config file: `.prettierrc` at repository root.
61
+
62
+
```json
63
+
{
64
+
"semi": true,
65
+
"singleQuote": false,
66
+
"trailingComma": "es5",
67
+
"printWidth": 80,
68
+
"tabWidth": 2
69
+
}
70
+
```
71
+
72
+
A `.prettierignore` file is required to exclude generated files:
73
+
74
+
```
75
+
node_modules/
76
+
dist/
77
+
build/
78
+
coverage/
79
+
```
80
+
81
+
Prettier formats JS, TS, JSON, CSS, and Markdown files. The `.prettierignore` controls scope.
82
+
83
+
### TypeScript
84
+
85
+
Config file: `tsconfig.json` at repository root. When present, `tsc --noEmit` runs as part of `make lint`.
86
+
87
+
```json
88
+
{
89
+
"compilerOptions": {
90
+
"target": "ES2022",
91
+
"module": "ESNext",
92
+
"moduleResolution": "bundler",
93
+
"strict": true,
94
+
"noEmit": true,
95
+
"esModuleInterop": true,
96
+
"skipLibCheck": true,
97
+
"forceConsistentCasingInFileNames": true,
98
+
"resolveJsonModule": true,
99
+
"isolatedModules": true
100
+
},
101
+
"include": ["src"],
102
+
"exclude": ["node_modules", "dist", "build"]
103
+
}
104
+
```
105
+
106
+
### Vitest
107
+
108
+
Config file: `vitest.config.ts` (or `vitest.config.js`) at repository root.
109
+
110
+
```ts
111
+
import { defineConfig } from"vitest/config";
112
+
113
+
exportdefaultdefineConfig({
114
+
test: {
115
+
globals: true,
116
+
environment: "node",
117
+
coverage: {
118
+
reporter: ["text", "json", "html"],
119
+
},
120
+
},
121
+
});
122
+
```
123
+
124
+
## Makefile Targets
125
+
126
+
| Target | Command | Description |
127
+
|---|---|---|
128
+
|`make lint`|`eslint .`| Lint all JS/TS files |
129
+
|`make lint`|`tsc --noEmit`| Type check (if `tsconfig.json` exists) |
- **Single `javascript` entry covers both JS and TS.** Do not add a separate `typescript` entry to `.devrail.yml`. TypeScript support auto-activates when `tsconfig.json` is present.
167
+
- **ESLint v9 uses flat config.** The config file is `eslint.config.js` (not `.eslintrc`). The `@eslint/js` and `typescript-eslint` packages provide rule configurations for the flat config format.
168
+
- **tsc runs under `make lint`, not a separate target.** Type checking is static analysis (like mypy for Python). It is gated on `tsconfig.json` presence.
169
+
- **Prettier formats more than JS/TS.** Prettier handles JSON, CSS, Markdown, and other file types. Projects must use `.prettierignore` to exclude generated files.
170
+
- **npm audit gates on `package-lock.json`.** If no `package-lock.json` exists, npm audit is skipped because there are no locked dependencies to scan.
171
+
- **Vitest gates on test file presence.** If no `*.test.*` or `*.spec.*` files exist, vitest is skipped.
172
+
- **All tools are pre-installed in the dev-toolchain container.** Do not install them on the host.
0 commit comments