@activatus/code-standards 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -13
- package/docs/Guides/_category_.json +2 -2
- package/docs/Guides/migrating.md +33 -16
- package/docs/Guides/setup.md +46 -18
- package/docs/Standards/_category_.json +2 -2
- package/docs/Standards/agent-skills.md +29 -29
- package/docs/Standards/agent-specs.md +17 -32
- package/docs/Standards/direnv.mdx +8 -8
- package/docs/Standards/documentation.md +5 -2
- package/docs/Standards/editorconfig.md +23 -21
- package/docs/Standards/eslint.md +593 -402
- package/docs/Standards/human-readable-names.md +61 -21
- package/docs/Standards/lint-errors.md +37 -5
- package/docs/Standards/prettier.md +35 -26
- package/docs/Standards/readable-code.md +30 -0
- package/docs/Standards/stylelint.md +26 -11
- package/docs/Standards/styling.md +9 -3
- package/docs/Standards/tech-stack.md +3 -1
- package/docs/Structure/_category_.json +2 -2
- package/docs/Structure/component-organization.md +9 -2
- package/docs/Structure/folder-structure.md +26 -13
- package/docs/Structure/naming-conventions.md +0 -2
- package/docs/intro.md +1 -3
- package/docs/ontology.md +21 -26
- package/docs/templates.mdx +15 -38
- package/docs/version-history.md +133 -6
- package/package.json +6 -2
- package/scripts/renameSymbol.mjs +188 -0
- package/static/templates/.editorconfig +8 -11
- package/static/templates/AGENTS.md +16 -13
- package/static/templates/docs/development/coding-standards.md +4 -0
- package/static/templates/docsSite/docusaurus.config.mjs +144 -0
- package/static/templates/docsSite/sidebars.mjs +7 -0
- package/static/templates/docsSite/src/css/custom.css +6 -0
- package/static/templates/docsSite/tsconfig.json +5 -5
- package/static/templates/eslint/base/eslint.config.mjs +95 -70
- package/static/templates/eslint/nextjs/eslint.config.mjs +170 -126
- package/static/templates/eslint/react/eslint.config.mjs +160 -125
- package/static/templates/eslint/typescript/eslint.config.mjs +143 -115
- package/static/templates/globals.css +9 -9
- package/static/templates/next.config.mjs +13 -10
- package/static/templates/prettier.config.mjs +26 -0
- package/static/templates/stylelint/css/stylelint.config.mjs +37 -25
- package/static/templates/stylelint/scss/stylelint.config.mjs +10 -7
- package/docs/Standards/branch-naming.md +0 -66
- package/docs/Standards/conventional-commits.md +0 -189
- package/static/templates/.commitlintrc.json +0 -3
- package/static/templates/docsSite/docusaurus.config.ts +0 -119
- package/static/templates/docsSite/sidebars.ts +0 -8
- package/static/templates/husky/commit-msg +0 -1
- package/static/templates/prettier.config.js +0 -17
|
@@ -8,119 +8,147 @@ import globals from "globals";
|
|
|
8
8
|
import { configs as typescript } from "typescript-eslint";
|
|
9
9
|
|
|
10
10
|
export default [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
11
|
+
{ ignores: ["dist/", "build/", "coverage/", "**/vendor/**"] },
|
|
12
|
+
js.configs.recommended,
|
|
13
|
+
comments.recommended,
|
|
14
|
+
importX.recommended,
|
|
15
|
+
importX.typescript,
|
|
16
|
+
unicorn.configs.recommended,
|
|
17
|
+
...typescript.recommended,
|
|
18
|
+
{
|
|
19
|
+
languageOptions: { globals: { ...globals.node } },
|
|
20
|
+
settings: {
|
|
21
|
+
"import-x/resolver-next": [createTypeScriptImportResolver()],
|
|
22
|
+
},
|
|
23
|
+
rules: {
|
|
24
|
+
"@eslint-community/eslint-comments/require-description":
|
|
25
|
+
"error",
|
|
26
|
+
"func-style": ["error", "expression"],
|
|
27
|
+
"max-depth": ["error", 3],
|
|
28
|
+
"max-lines": [
|
|
29
|
+
"error",
|
|
30
|
+
{ max: 300, skipBlankLines: true, skipComments: true },
|
|
31
|
+
],
|
|
32
|
+
"no-nested-ternary": "error",
|
|
33
|
+
"no-var": "error",
|
|
34
|
+
"prefer-arrow-callback": "error",
|
|
35
|
+
"prefer-const": "error",
|
|
36
|
+
"no-magic-numbers": [
|
|
37
|
+
"error",
|
|
38
|
+
{
|
|
39
|
+
ignore: [-1, 0, 1],
|
|
40
|
+
ignoreArrayIndexes: true,
|
|
41
|
+
ignoreDefaultValues: true,
|
|
42
|
+
enforceConst: true,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
"no-restricted-syntax": [
|
|
46
|
+
"error",
|
|
47
|
+
{
|
|
48
|
+
selector: "ClassDeclaration",
|
|
49
|
+
message: "Use functions, not classes.",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
selector: "ClassExpression",
|
|
53
|
+
message: "Use functions, not classes.",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
selector: "VariableDeclarator > FunctionExpression",
|
|
57
|
+
message: "Use an arrow function.",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
selector: "VariableDeclaration[kind='let']",
|
|
61
|
+
message:
|
|
62
|
+
"Use const. If this value really must be reassigned, disable this rule on this line with a comment saying why.",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
selector: "FunctionDeclaration[params.length>1]",
|
|
66
|
+
message:
|
|
67
|
+
"Use a single object parameter when a function needs more than one value.",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
selector:
|
|
71
|
+
"VariableDeclarator > :matches(ArrowFunctionExpression, FunctionExpression)[params.length>1]",
|
|
72
|
+
message:
|
|
73
|
+
"Use a single object parameter when a function needs more than one value.",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
"import-x/no-cycle": "error",
|
|
77
|
+
"import-x/no-default-export": "error",
|
|
78
|
+
"no-use-before-define": "error",
|
|
79
|
+
"unicorn/default-export-style": "off",
|
|
80
|
+
"unicorn/filename-case": [
|
|
81
|
+
"error",
|
|
82
|
+
{ cases: { camelCase: true, pascalCase: true } },
|
|
83
|
+
],
|
|
84
|
+
"unicorn/name-replacements": [
|
|
85
|
+
"error",
|
|
86
|
+
{
|
|
87
|
+
// Dictionary words: see "Dictionary" in the Human-Readable Names standard.
|
|
88
|
+
replacements: {
|
|
89
|
+
docs: false,
|
|
90
|
+
lib: false,
|
|
91
|
+
props: false,
|
|
92
|
+
ref: false,
|
|
93
|
+
repo: false,
|
|
94
|
+
utils: false,
|
|
95
|
+
},
|
|
96
|
+
// Third-party names, allowed only exactly as they are.
|
|
97
|
+
allowList: { params: true, searchParams: true },
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
files: ["**/*.{ts,tsx}"],
|
|
104
|
+
rules: {
|
|
105
|
+
"no-undef": "off",
|
|
106
|
+
"no-magic-numbers": "off",
|
|
107
|
+
"no-use-before-define": "off",
|
|
108
|
+
"@typescript-eslint/consistent-type-assertions": [
|
|
109
|
+
"error",
|
|
110
|
+
{ assertionStyle: "never" },
|
|
111
|
+
],
|
|
112
|
+
"@typescript-eslint/consistent-type-imports": "error",
|
|
113
|
+
"@typescript-eslint/naming-convention": [
|
|
114
|
+
"error",
|
|
115
|
+
{
|
|
116
|
+
selector: ["typeAlias", "interface"],
|
|
117
|
+
format: ["PascalCase"],
|
|
118
|
+
custom: { regex: "(Props|Type)$", match: true },
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
122
|
+
"@typescript-eslint/no-magic-numbers": [
|
|
123
|
+
"error",
|
|
124
|
+
{
|
|
125
|
+
ignore: [-1, 0, 1],
|
|
126
|
+
ignoreArrayIndexes: true,
|
|
127
|
+
ignoreDefaultValues: true,
|
|
128
|
+
enforceConst: true,
|
|
129
|
+
ignoreEnums: true,
|
|
130
|
+
ignoreNumericLiteralTypes: true,
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
"@typescript-eslint/no-non-null-assertion": "error",
|
|
134
|
+
"@typescript-eslint/no-use-before-define": "error",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
files: ["**/*.test.{ts,tsx}"],
|
|
139
|
+
rules: {
|
|
140
|
+
"max-lines": "off",
|
|
141
|
+
"no-magic-numbers": "off",
|
|
142
|
+
"@typescript-eslint/no-magic-numbers": "off",
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
files: ["**/*.config.{js,mjs,ts}", "**/*.stories.tsx"],
|
|
147
|
+
rules: { "import-x/no-default-export": "off" },
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
files: ["**/*.config.{js,mjs,ts}"],
|
|
151
|
+
rules: { "unicorn/no-top-level-side-effects": "off" },
|
|
152
|
+
},
|
|
153
|
+
prettier,
|
|
126
154
|
];
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
@import "tailwindcss";
|
|
2
2
|
|
|
3
3
|
@theme {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
--color-brand-primary: #3b82f6;
|
|
5
|
+
--color-brand-primary-hover: #2563eb;
|
|
6
|
+
--color-brand-secondary: #64748b;
|
|
7
|
+
--color-surface: #fff;
|
|
8
|
+
--color-text: #0f172a;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
[data-theme="dark"] {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
--color-brand-primary: #60a5fa;
|
|
13
|
+
--color-brand-primary-hover: #93c5fd;
|
|
14
|
+
--color-surface: #0f172a;
|
|
15
|
+
--color-text: #f8fafc;
|
|
16
16
|
}
|
|
@@ -2,17 +2,20 @@ const DOCS_URL = process.env.DOCS_URL;
|
|
|
2
2
|
|
|
3
3
|
/** @type {import("next").NextConfig} */
|
|
4
4
|
const nextConfig = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
async rewrites() {
|
|
6
|
+
// The docs are only served when DOCS_URL is set. It is never set in production.
|
|
7
|
+
if (!DOCS_URL) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
return [
|
|
12
|
+
{ source: "/docs", destination: `${DOCS_URL}/docs/` },
|
|
13
|
+
{
|
|
14
|
+
source: "/docs/:path*",
|
|
15
|
+
destination: `${DOCS_URL}/docs/:path*`,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
},
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
export default nextConfig;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @type {import("prettier").Config & import("prettier-plugin-tailwindcss").PluginOptions} */
|
|
2
|
+
const config = {
|
|
3
|
+
// Short lines, so code reads well on a phone.
|
|
4
|
+
printWidth: 70,
|
|
5
|
+
// Tabs indent. A tab counts as 2 characters towards the line width.
|
|
6
|
+
useTabs: true,
|
|
7
|
+
tabWidth: 2,
|
|
8
|
+
singleQuote: false,
|
|
9
|
+
trailingComma: "all",
|
|
10
|
+
bracketSpacing: true,
|
|
11
|
+
bracketSameLine: false,
|
|
12
|
+
arrowParens: "always",
|
|
13
|
+
semi: true,
|
|
14
|
+
endOfLine: "lf",
|
|
15
|
+
plugins: ["prettier-plugin-tailwindcss"],
|
|
16
|
+
tailwindStylesheet: "./app/globals.css",
|
|
17
|
+
overrides: [
|
|
18
|
+
{
|
|
19
|
+
// YAML does not allow tabs, and Markdown reads a tab as four spaces.
|
|
20
|
+
files: ["*.md", "*.mdx", "*.yml", "*.yaml"],
|
|
21
|
+
options: { useTabs: false },
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default config;
|
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
/** @type {import("stylelint").Config} */
|
|
2
2
|
export default {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
3
|
+
ignoreFiles: ["**/vendor/**"],
|
|
4
|
+
extends: [
|
|
5
|
+
"stylelint-config-standard",
|
|
6
|
+
"stylelint-config-recess-order",
|
|
7
|
+
],
|
|
8
|
+
rules: {
|
|
9
|
+
"selector-max-id": 0,
|
|
10
|
+
"property-no-vendor-prefix": true,
|
|
11
|
+
"color-function-notation": "modern",
|
|
12
|
+
"import-notation": "string",
|
|
13
|
+
"at-rule-no-unknown": [
|
|
14
|
+
true,
|
|
15
|
+
{
|
|
16
|
+
ignoreAtRules: [
|
|
17
|
+
"theme",
|
|
18
|
+
"utility",
|
|
19
|
+
"variant",
|
|
20
|
+
"custom-variant",
|
|
21
|
+
"source",
|
|
22
|
+
"plugin",
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
overrides: [
|
|
28
|
+
{
|
|
29
|
+
files: ["**/*.module.css"],
|
|
30
|
+
rules: {
|
|
31
|
+
"color-named": "never",
|
|
32
|
+
"color-no-hex": true,
|
|
33
|
+
"selector-class-pattern": [
|
|
34
|
+
"^[a-z][a-zA-Z0-9]*$",
|
|
35
|
+
{ message: "Expected class selector to be camelCase" },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
28
40
|
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/** @type {import("stylelint").Config} */
|
|
2
2
|
export default {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
ignoreFiles: ["**/vendor/**"],
|
|
4
|
+
extends: [
|
|
5
|
+
"stylelint-config-standard-scss",
|
|
6
|
+
"stylelint-config-recess-order",
|
|
7
|
+
],
|
|
8
|
+
rules: {
|
|
9
|
+
"selector-max-id": 0,
|
|
10
|
+
"property-no-vendor-prefix": true,
|
|
11
|
+
"color-function-notation": "modern",
|
|
12
|
+
},
|
|
10
13
|
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
sidebar_position: 6.5
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Branch Naming
|
|
6
|
-
|
|
7
|
-
Every branch name says what kind of work it holds and what the work is.
|
|
8
|
-
|
|
9
|
-
## Format
|
|
10
|
-
|
|
11
|
-
```text
|
|
12
|
-
<type>/<short-description>
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
```text
|
|
16
|
-
feat/invoice-export
|
|
17
|
-
fix/login-redirect-loop
|
|
18
|
-
docs/update-readme
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Rules
|
|
22
|
-
|
|
23
|
-
- **Start with a type**, followed by a slash. The types are the same as [Conventional Commits](/Standards/conventional-commits#type-reference).
|
|
24
|
-
- **Describe the work in two to five words**, in lower-case kebab-case. Branch names are kebab-case, like route folders, documentation files and CSS variables — it is the Git convention, and it is safe on every operating system.
|
|
25
|
-
- **Use full English words**, the same as in code: `fix/button-alignment`, not `fix/btn-align`.
|
|
26
|
-
- **One piece of work per branch.** If the description needs the word "and", it is two branches.
|
|
27
|
-
- **Never work directly on `main`.**
|
|
28
|
-
|
|
29
|
-
## Types
|
|
30
|
-
|
|
31
|
-
| Type | Use for | Example |
|
|
32
|
-
| ---------- | -------------------------------------- | ----------------------------- |
|
|
33
|
-
| `feat` | A new feature | `feat/invoice-export` |
|
|
34
|
-
| `fix` | A bug fix | `fix/login-redirect-loop` |
|
|
35
|
-
| `docs` | Documentation only | `docs/update-readme` |
|
|
36
|
-
| `refactor` | Restructuring with no behaviour change | `refactor/split-user-service` |
|
|
37
|
-
| `test` | Adding or correcting tests | `test/invoice-total-rounding` |
|
|
38
|
-
| `chore` | Maintenance, dependencies, tooling | `chore/upgrade-next` |
|
|
39
|
-
|
|
40
|
-
## Examples
|
|
41
|
-
|
|
42
|
-
```text
|
|
43
|
-
✅ Good
|
|
44
|
-
feat/hero-question-rail
|
|
45
|
-
fix/checkout-total-rounding
|
|
46
|
-
chore/upgrade-tailwind
|
|
47
|
-
|
|
48
|
-
❌ Bad
|
|
49
|
-
hero # No type, and too vague
|
|
50
|
-
feature/HeroQuestionRail # Not a standard type, and not kebab-case
|
|
51
|
-
fix/btn # Shorthand
|
|
52
|
-
toms-branch # Says nothing about the work
|
|
53
|
-
feat/invoices-and-login-fix # Two pieces of work
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Ticket numbers
|
|
57
|
-
|
|
58
|
-
When the work has a ticket, put the ticket number after the type:
|
|
59
|
-
|
|
60
|
-
```text
|
|
61
|
-
feat/ACT-142-invoice-export
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## AI agents
|
|
65
|
-
|
|
66
|
-
AI agents **never commit code**, so they do not create branches to commit to either. A person creates the branch, reviews the agent's changes, and commits them. See [AGENTS.md](/Standards/agent-specs#agents-never-commit-code).
|