create-creact 0.0.0-stage → 0.1.1
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/LICENSE +12 -0
- package/README.md +17 -2
- package/dist/create.js +263 -0
- package/dist/layer.js +633 -0
- package/dist/main.js +63 -0
- package/dist/options.js +262 -0
- package/dist/shell.js +128 -0
- package/dist/stacks.js +42 -0
- package/dist/ui.js +507 -0
- package/dist/version.js +7 -0
- package/layer/base/all/.oxfmtrc.json.layer +65 -0
- package/layer/base/all/AGENTS.md.layer +22 -0
- package/layer/base/all/CLAUDE.md.layer +1 -0
- package/layer/base/all/apps/web/src/styles/tokens.css.layer +15 -0
- package/layer/base/all/commitlint.config.ts.layer +12 -0
- package/layer/base/all/oxlint.config.ts.layer +556 -0
- package/layer/base/next/AGENTS.md.layer +4 -0
- package/layer/base/next/apps/web/CLAUDE.md.layer +1 -0
- package/layer/base/react-router/AGENTS.md.layer +3 -0
- package/layer/standalone/all/.husky/commit-msg.layer +2 -0
- package/layer/standalone/all/.husky/pre-commit.layer +2 -0
- package/layer/standalone/all/.lintstagedrc.json.layer +4 -0
- package/layer/standalone/all/AGENTS.md.layer +9 -0
- package/layer/standalone/all/vitest.config.ts.layer +14 -0
- package/layer/stylex/all/AGENTS.md.layer +4 -0
- package/layer/stylex/all/apps/web/src/styles/tokens.stylex.ts.layer +15 -0
- package/layer/stylex/all/apps/web/src/styles/tokens.test.ts.layer +32 -0
- package/layer/stylex/all/oxlint.styling.ts.layer +20 -0
- package/layer/stylex/all/vitest.styling.ts.layer +18 -0
- package/layer/stylex/next/apps/web/babel.config.js.layer +25 -0
- package/layer/stylex/next/apps/web/postcss.config.js.layer +16 -0
- package/layer/stylex/next/apps/web/src/app/layout.tsx.layer +20 -0
- package/layer/stylex/next/apps/web/src/app/page.tsx.layer +48 -0
- package/layer/stylex/next/apps/web/src/index.css.layer +45 -0
- package/layer/stylex/react-router/apps/web/src/index.css.layer +27 -0
- package/layer/stylex/react-router/apps/web/src/root.tsx.layer +94 -0
- package/layer/stylex/react-router/apps/web/src/routes/_index.tsx.layer +56 -0
- package/layer/stylex/react-router/apps/web/vite.config.ts.layer +22 -0
- package/layer/tailwind/all/AGENTS.md.layer +4 -0
- package/layer/tailwind/all/apps/web/src/index.css.layer +3 -0
- package/layer/tailwind/all/apps/web/src/styles/tokens.tailwind.css.layer +7 -0
- package/layer/tailwind/all/apps/web/src/styles/tokens.test.ts.layer +35 -0
- package/layer/tailwind/all/oxlint.styling.ts.layer +69 -0
- package/layer/tailwind/all/vitest.styling.ts.layer +5 -0
- package/layer/vite-plus/all/.vite-hooks/commit-msg.layer +2 -0
- package/layer/vite-plus/all/.vite-hooks/pre-commit.layer +2 -0
- package/layer/vite-plus/all/AGENTS.md.layer +11 -0
- package/layer/vite-plus/all/vite.config.ts.layer +25 -0
- package/package.json +37 -4
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
import type { OxlintConfig } from "{{oxlint}}";
|
|
2
|
+
import eslintReact from "@eslint-react/eslint-plugin";
|
|
3
|
+
import jsdoc from "eslint-plugin-jsdoc";
|
|
4
|
+
import reactYouMightNotNeedAnEffect from "eslint-plugin-react-you-might-not-need-an-effect";
|
|
5
|
+
import sonarjs from "eslint-plugin-sonarjs";
|
|
6
|
+
|
|
7
|
+
import { styling } from "./oxlint.styling.ts";
|
|
8
|
+
|
|
9
|
+
type Rules = NonNullable<OxlintConfig["rules"]>;
|
|
10
|
+
|
|
11
|
+
const errors = (names: string[]): Rules =>
|
|
12
|
+
Object.fromEntries(names.map((name) => [name, "error"]));
|
|
13
|
+
|
|
14
|
+
const alias = (rules: object, from: string, to: string): Rules =>
|
|
15
|
+
Object.fromEntries(
|
|
16
|
+
Object.entries(rules).map(([name, value]) => [
|
|
17
|
+
name.replace(`${from}/`, `${to}/`),
|
|
18
|
+
value,
|
|
19
|
+
])
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const sonarjsRecommended = sonarjs.configs?.recommended as { rules: Rules };
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
categories: { correctness: "off" },
|
|
26
|
+
options: {
|
|
27
|
+
typeAware: true,
|
|
28
|
+
reportUnusedDisableDirectives: "error",
|
|
29
|
+
},
|
|
30
|
+
env: { builtin: true, browser: true, node: true, es2024: true },
|
|
31
|
+
|
|
32
|
+
plugins: [
|
|
33
|
+
"typescript",
|
|
34
|
+
"react",
|
|
35
|
+
"jsx-a11y",
|
|
36
|
+
"promise",
|
|
37
|
+
"unicorn",
|
|
38
|
+
"vitest",
|
|
39
|
+
"node",
|
|
40
|
+
],
|
|
41
|
+
// Native plugin names are reserved, so eslint-plugin-jsdoc loads as jsdoc-js.
|
|
42
|
+
jsPlugins: [
|
|
43
|
+
"@eslint-community/eslint-plugin-eslint-comments",
|
|
44
|
+
"@eslint-react/eslint-plugin",
|
|
45
|
+
"eslint-plugin-react-you-might-not-need-an-effect",
|
|
46
|
+
"eslint-plugin-sonarjs",
|
|
47
|
+
"eslint-plugin-security",
|
|
48
|
+
"eslint-plugin-depend",
|
|
49
|
+
"eslint-plugin-perfectionist",
|
|
50
|
+
"eslint-plugin-barrel-files",
|
|
51
|
+
"eslint-plugin-check-file",
|
|
52
|
+
{ name: "jsdoc-js", specifier: "eslint-plugin-jsdoc" },
|
|
53
|
+
],
|
|
54
|
+
|
|
55
|
+
settings: {
|
|
56
|
+
...eslintReact.configs["strict-typescript"].settings,
|
|
57
|
+
...styling.settings,
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
rules: {
|
|
61
|
+
...errors([
|
|
62
|
+
"for-direction",
|
|
63
|
+
"no-async-promise-executor",
|
|
64
|
+
"no-case-declarations",
|
|
65
|
+
"no-compare-neg-zero",
|
|
66
|
+
"no-cond-assign",
|
|
67
|
+
"no-constant-binary-expression",
|
|
68
|
+
"no-constant-condition",
|
|
69
|
+
"no-control-regex",
|
|
70
|
+
"no-debugger",
|
|
71
|
+
"no-delete-var",
|
|
72
|
+
"no-dupe-else-if",
|
|
73
|
+
"no-duplicate-case",
|
|
74
|
+
"no-empty",
|
|
75
|
+
"no-empty-character-class",
|
|
76
|
+
"no-empty-pattern",
|
|
77
|
+
"no-empty-static-block",
|
|
78
|
+
"no-ex-assign",
|
|
79
|
+
"no-extra-boolean-cast",
|
|
80
|
+
"no-fallthrough",
|
|
81
|
+
"no-global-assign",
|
|
82
|
+
"no-invalid-regexp",
|
|
83
|
+
"no-irregular-whitespace",
|
|
84
|
+
"no-loss-of-precision",
|
|
85
|
+
"no-misleading-character-class",
|
|
86
|
+
"no-nonoctal-decimal-escape",
|
|
87
|
+
"no-prototype-builtins",
|
|
88
|
+
"no-regex-spaces",
|
|
89
|
+
"no-self-assign",
|
|
90
|
+
"no-shadow-restricted-names",
|
|
91
|
+
"no-sparse-arrays",
|
|
92
|
+
"no-unassigned-vars",
|
|
93
|
+
"no-unexpected-multiline",
|
|
94
|
+
"no-unsafe-finally",
|
|
95
|
+
"no-unsafe-optional-chaining",
|
|
96
|
+
"no-unused-labels",
|
|
97
|
+
"no-unused-private-class-members",
|
|
98
|
+
"no-useless-assignment",
|
|
99
|
+
"no-useless-backreference",
|
|
100
|
+
"no-useless-catch",
|
|
101
|
+
"no-useless-escape",
|
|
102
|
+
"preserve-caught-error",
|
|
103
|
+
"require-yield",
|
|
104
|
+
"use-isnan",
|
|
105
|
+
"valid-typeof",
|
|
106
|
+
"no-array-constructor",
|
|
107
|
+
"no-empty-function",
|
|
108
|
+
"no-unused-expressions",
|
|
109
|
+
"no-useless-constructor",
|
|
110
|
+
"no-var",
|
|
111
|
+
"prefer-const",
|
|
112
|
+
"prefer-rest-params",
|
|
113
|
+
"prefer-spread",
|
|
114
|
+
"array-callback-return",
|
|
115
|
+
]),
|
|
116
|
+
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
|
117
|
+
|
|
118
|
+
...errors([
|
|
119
|
+
"@eslint-community/eslint-comments/no-aggregating-enable",
|
|
120
|
+
"@eslint-community/eslint-comments/no-duplicate-disable",
|
|
121
|
+
"@eslint-community/eslint-comments/no-unlimited-disable",
|
|
122
|
+
"@eslint-community/eslint-comments/no-unused-enable",
|
|
123
|
+
]),
|
|
124
|
+
"@eslint-community/eslint-comments/disable-enable-pair": [
|
|
125
|
+
"error",
|
|
126
|
+
{ allowWholeFile: true },
|
|
127
|
+
],
|
|
128
|
+
"@eslint-community/eslint-comments/require-description": [
|
|
129
|
+
"warn",
|
|
130
|
+
{
|
|
131
|
+
additionalDirectives: [
|
|
132
|
+
"oxlint-disable",
|
|
133
|
+
"oxlint-disable-line",
|
|
134
|
+
"oxlint-disable-next-line",
|
|
135
|
+
"oxlint-enable",
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
|
|
140
|
+
...errors([
|
|
141
|
+
"typescript/adjacent-overload-signatures",
|
|
142
|
+
"typescript/array-type",
|
|
143
|
+
"typescript/await-thenable",
|
|
144
|
+
"typescript/ban-tslint-comment",
|
|
145
|
+
"typescript/class-literal-property-style",
|
|
146
|
+
"typescript/consistent-generic-constructors",
|
|
147
|
+
"typescript/consistent-indexed-object-style",
|
|
148
|
+
"typescript/consistent-type-assertions",
|
|
149
|
+
"typescript/consistent-type-definitions",
|
|
150
|
+
"typescript/consistent-type-exports",
|
|
151
|
+
"typescript/consistent-type-imports",
|
|
152
|
+
"typescript/dot-notation",
|
|
153
|
+
"typescript/no-array-delete",
|
|
154
|
+
"typescript/no-base-to-string",
|
|
155
|
+
"typescript/no-confusing-non-null-assertion",
|
|
156
|
+
"typescript/no-deprecated",
|
|
157
|
+
"typescript/no-duplicate-enum-values",
|
|
158
|
+
"typescript/no-duplicate-type-constituents",
|
|
159
|
+
"typescript/no-dynamic-delete",
|
|
160
|
+
"typescript/no-empty-object-type",
|
|
161
|
+
"typescript/no-explicit-any",
|
|
162
|
+
"typescript/no-extra-non-null-assertion",
|
|
163
|
+
"typescript/no-extraneous-class",
|
|
164
|
+
"typescript/no-floating-promises",
|
|
165
|
+
"typescript/no-for-in-array",
|
|
166
|
+
"typescript/no-implied-eval",
|
|
167
|
+
"typescript/no-inferrable-types",
|
|
168
|
+
"typescript/no-invalid-void-type",
|
|
169
|
+
"typescript/no-meaningless-void-operator",
|
|
170
|
+
"typescript/no-misused-new",
|
|
171
|
+
"typescript/no-misused-promises",
|
|
172
|
+
"typescript/no-misused-spread",
|
|
173
|
+
"typescript/no-mixed-enums",
|
|
174
|
+
"typescript/no-namespace",
|
|
175
|
+
"typescript/no-non-null-asserted-nullish-coalescing",
|
|
176
|
+
"typescript/no-non-null-asserted-optional-chain",
|
|
177
|
+
"typescript/no-non-null-assertion",
|
|
178
|
+
"typescript/no-redundant-type-constituents",
|
|
179
|
+
"typescript/no-require-imports",
|
|
180
|
+
"typescript/no-this-alias",
|
|
181
|
+
"typescript/no-unnecessary-boolean-literal-compare",
|
|
182
|
+
"typescript/no-unnecessary-condition",
|
|
183
|
+
"typescript/no-unnecessary-template-expression",
|
|
184
|
+
"typescript/no-unnecessary-type-arguments",
|
|
185
|
+
"typescript/no-unnecessary-type-assertion",
|
|
186
|
+
"typescript/no-unnecessary-type-constraint",
|
|
187
|
+
"typescript/no-unnecessary-type-conversion",
|
|
188
|
+
"typescript/no-unnecessary-type-parameters",
|
|
189
|
+
"typescript/no-unsafe-argument",
|
|
190
|
+
"typescript/no-unsafe-assignment",
|
|
191
|
+
"typescript/no-unsafe-call",
|
|
192
|
+
"typescript/no-unsafe-declaration-merging",
|
|
193
|
+
"typescript/no-unsafe-enum-comparison",
|
|
194
|
+
"typescript/no-unsafe-function-type",
|
|
195
|
+
"typescript/no-unsafe-member-access",
|
|
196
|
+
"typescript/no-unsafe-return",
|
|
197
|
+
"typescript/no-unsafe-unary-minus",
|
|
198
|
+
"typescript/no-useless-default-assignment",
|
|
199
|
+
"typescript/no-wrapper-object-types",
|
|
200
|
+
"typescript/non-nullable-type-assertion-style",
|
|
201
|
+
"typescript/only-throw-error",
|
|
202
|
+
"typescript/prefer-as-const",
|
|
203
|
+
"typescript/prefer-find",
|
|
204
|
+
"typescript/prefer-for-of",
|
|
205
|
+
"typescript/prefer-function-type",
|
|
206
|
+
"typescript/prefer-includes",
|
|
207
|
+
"typescript/prefer-literal-enum-member",
|
|
208
|
+
"typescript/prefer-namespace-keyword",
|
|
209
|
+
"typescript/prefer-nullish-coalescing",
|
|
210
|
+
"typescript/prefer-optional-chain",
|
|
211
|
+
"typescript/prefer-promise-reject-errors",
|
|
212
|
+
"typescript/prefer-reduce-type-parameter",
|
|
213
|
+
"typescript/prefer-regexp-exec",
|
|
214
|
+
"typescript/prefer-return-this-type",
|
|
215
|
+
"typescript/prefer-string-starts-ends-with",
|
|
216
|
+
"typescript/related-getter-setter-pairs",
|
|
217
|
+
"typescript/require-await",
|
|
218
|
+
"typescript/triple-slash-reference",
|
|
219
|
+
"typescript/unbound-method",
|
|
220
|
+
"typescript/unified-signatures",
|
|
221
|
+
"typescript/use-unknown-in-catch-callback-variable",
|
|
222
|
+
"typescript/require-array-sort-compare",
|
|
223
|
+
]),
|
|
224
|
+
"typescript/ban-ts-comment": ["error", { minimumDescriptionLength: 10 }],
|
|
225
|
+
"typescript/no-confusing-void-expression": [
|
|
226
|
+
"error",
|
|
227
|
+
{ ignoreArrowShorthand: true },
|
|
228
|
+
],
|
|
229
|
+
"typescript/restrict-plus-operands": [
|
|
230
|
+
"error",
|
|
231
|
+
{
|
|
232
|
+
allowAny: false,
|
|
233
|
+
allowBoolean: false,
|
|
234
|
+
allowNullish: false,
|
|
235
|
+
allowNumberAndString: false,
|
|
236
|
+
allowRegExp: false,
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
"typescript/restrict-template-expressions": [
|
|
240
|
+
"error",
|
|
241
|
+
{ allowNumber: true },
|
|
242
|
+
],
|
|
243
|
+
"typescript/return-await": ["error", "error-handling-correctness-only"],
|
|
244
|
+
"typescript/strict-boolean-expressions": [
|
|
245
|
+
"error",
|
|
246
|
+
{
|
|
247
|
+
allowString: false,
|
|
248
|
+
allowNumber: false,
|
|
249
|
+
allowNullableObject: true,
|
|
250
|
+
allowNullableBoolean: true,
|
|
251
|
+
allowNullableString: true,
|
|
252
|
+
allowNullableNumber: false,
|
|
253
|
+
allowNullableEnum: false,
|
|
254
|
+
allowAny: false,
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
|
|
258
|
+
...eslintReact.configs["strict-typescript"].rules,
|
|
259
|
+
...errors([
|
|
260
|
+
"react/error-boundaries",
|
|
261
|
+
"react/globals",
|
|
262
|
+
"react/immutability",
|
|
263
|
+
"react/purity",
|
|
264
|
+
"react/refs",
|
|
265
|
+
"react/rules-of-hooks",
|
|
266
|
+
"react/set-state-in-effect",
|
|
267
|
+
"react/set-state-in-render",
|
|
268
|
+
"react/static-components",
|
|
269
|
+
"react/use-memo",
|
|
270
|
+
"react/preserve-manual-memoization",
|
|
271
|
+
]),
|
|
272
|
+
"react/exhaustive-deps": "warn",
|
|
273
|
+
"react/incompatible-library": "warn",
|
|
274
|
+
"react/unsupported-syntax": "warn",
|
|
275
|
+
...reactYouMightNotNeedAnEffect.configs.recommended.rules,
|
|
276
|
+
|
|
277
|
+
...errors([
|
|
278
|
+
"jsx-a11y/alt-text",
|
|
279
|
+
"jsx-a11y/anchor-has-content",
|
|
280
|
+
"jsx-a11y/anchor-is-valid",
|
|
281
|
+
"jsx-a11y/aria-activedescendant-has-tabindex",
|
|
282
|
+
"jsx-a11y/aria-props",
|
|
283
|
+
"jsx-a11y/aria-proptypes",
|
|
284
|
+
"jsx-a11y/aria-role",
|
|
285
|
+
"jsx-a11y/aria-unsupported-elements",
|
|
286
|
+
"jsx-a11y/autocomplete-valid",
|
|
287
|
+
"jsx-a11y/click-events-have-key-events",
|
|
288
|
+
"jsx-a11y/html-has-lang",
|
|
289
|
+
"jsx-a11y/iframe-has-title",
|
|
290
|
+
"jsx-a11y/img-redundant-alt",
|
|
291
|
+
"jsx-a11y/label-has-associated-control",
|
|
292
|
+
"jsx-a11y/media-has-caption",
|
|
293
|
+
"jsx-a11y/mouse-events-have-key-events",
|
|
294
|
+
"jsx-a11y/no-access-key",
|
|
295
|
+
"jsx-a11y/no-autofocus",
|
|
296
|
+
"jsx-a11y/no-distracting-elements",
|
|
297
|
+
"jsx-a11y/no-redundant-roles",
|
|
298
|
+
"jsx-a11y/role-has-required-aria-props",
|
|
299
|
+
"jsx-a11y/role-supports-aria-props",
|
|
300
|
+
"jsx-a11y/scope",
|
|
301
|
+
"jsx-a11y/tabindex-no-positive",
|
|
302
|
+
]),
|
|
303
|
+
"jsx-a11y/interactive-supports-focus": [
|
|
304
|
+
"error",
|
|
305
|
+
{
|
|
306
|
+
tabbable: [
|
|
307
|
+
"button",
|
|
308
|
+
"checkbox",
|
|
309
|
+
"link",
|
|
310
|
+
"searchbox",
|
|
311
|
+
"spinbutton",
|
|
312
|
+
"switch",
|
|
313
|
+
"textbox",
|
|
314
|
+
],
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
"jsx-a11y/no-interactive-element-to-noninteractive-role": [
|
|
318
|
+
"error",
|
|
319
|
+
{ tr: ["none", "presentation"], canvas: ["img"] },
|
|
320
|
+
],
|
|
321
|
+
"jsx-a11y/no-noninteractive-element-interactions": [
|
|
322
|
+
"error",
|
|
323
|
+
{
|
|
324
|
+
handlers: [
|
|
325
|
+
"onClick",
|
|
326
|
+
"onError",
|
|
327
|
+
"onLoad",
|
|
328
|
+
"onMouseDown",
|
|
329
|
+
"onMouseUp",
|
|
330
|
+
"onKeyPress",
|
|
331
|
+
"onKeyDown",
|
|
332
|
+
"onKeyUp",
|
|
333
|
+
],
|
|
334
|
+
alert: ["onKeyUp", "onKeyDown", "onKeyPress"],
|
|
335
|
+
body: ["onError", "onLoad"],
|
|
336
|
+
dialog: ["onKeyUp", "onKeyDown", "onKeyPress"],
|
|
337
|
+
iframe: ["onError", "onLoad"],
|
|
338
|
+
img: ["onError", "onLoad"],
|
|
339
|
+
},
|
|
340
|
+
],
|
|
341
|
+
"jsx-a11y/no-noninteractive-element-to-interactive-role": [
|
|
342
|
+
"error",
|
|
343
|
+
{
|
|
344
|
+
ul: [
|
|
345
|
+
"listbox",
|
|
346
|
+
"menu",
|
|
347
|
+
"menubar",
|
|
348
|
+
"radiogroup",
|
|
349
|
+
"tablist",
|
|
350
|
+
"tree",
|
|
351
|
+
"treegrid",
|
|
352
|
+
],
|
|
353
|
+
ol: [
|
|
354
|
+
"listbox",
|
|
355
|
+
"menu",
|
|
356
|
+
"menubar",
|
|
357
|
+
"radiogroup",
|
|
358
|
+
"tablist",
|
|
359
|
+
"tree",
|
|
360
|
+
"treegrid",
|
|
361
|
+
],
|
|
362
|
+
li: [
|
|
363
|
+
"menuitem",
|
|
364
|
+
"menuitemradio",
|
|
365
|
+
"menuitemcheckbox",
|
|
366
|
+
"option",
|
|
367
|
+
"row",
|
|
368
|
+
"tab",
|
|
369
|
+
"treeitem",
|
|
370
|
+
],
|
|
371
|
+
table: ["grid"],
|
|
372
|
+
td: ["gridcell"],
|
|
373
|
+
fieldset: ["radiogroup", "presentation"],
|
|
374
|
+
},
|
|
375
|
+
],
|
|
376
|
+
"jsx-a11y/no-noninteractive-tabindex": [
|
|
377
|
+
"error",
|
|
378
|
+
{ tags: [], roles: ["tabpanel"], allowExpressionValues: true },
|
|
379
|
+
],
|
|
380
|
+
"jsx-a11y/no-static-element-interactions": [
|
|
381
|
+
"error",
|
|
382
|
+
{
|
|
383
|
+
allowExpressionValues: true,
|
|
384
|
+
handlers: [
|
|
385
|
+
"onClick",
|
|
386
|
+
"onMouseDown",
|
|
387
|
+
"onMouseUp",
|
|
388
|
+
"onKeyPress",
|
|
389
|
+
"onKeyDown",
|
|
390
|
+
"onKeyUp",
|
|
391
|
+
],
|
|
392
|
+
},
|
|
393
|
+
],
|
|
394
|
+
|
|
395
|
+
...errors([
|
|
396
|
+
"promise/always-return",
|
|
397
|
+
"promise/catch-or-return",
|
|
398
|
+
"promise/no-new-statics",
|
|
399
|
+
"promise/no-return-wrap",
|
|
400
|
+
"promise/param-names",
|
|
401
|
+
]),
|
|
402
|
+
"promise/no-callback-in-promise": "warn",
|
|
403
|
+
"promise/no-nesting": "warn",
|
|
404
|
+
"promise/no-promise-in-callback": "warn",
|
|
405
|
+
"promise/no-return-in-finally": "warn",
|
|
406
|
+
"promise/valid-params": "warn",
|
|
407
|
+
|
|
408
|
+
...sonarjsRecommended.rules,
|
|
409
|
+
"sonarjs/cognitive-complexity": ["error", 20],
|
|
410
|
+
"sonarjs/todo-tag": "off",
|
|
411
|
+
"sonarjs/no-hardcoded-passwords": "off",
|
|
412
|
+
"sonarjs/prefer-read-only-props": "off",
|
|
413
|
+
"sonarjs/deprecation": "off",
|
|
414
|
+
|
|
415
|
+
"security/detect-bidi-characters": "warn",
|
|
416
|
+
"security/detect-buffer-noassert": "warn",
|
|
417
|
+
"security/detect-child-process": "warn",
|
|
418
|
+
"security/detect-disable-mustache-escape": "warn",
|
|
419
|
+
"security/detect-eval-with-expression": "warn",
|
|
420
|
+
"security/detect-invisible-characters": "warn",
|
|
421
|
+
"security/detect-new-buffer": "warn",
|
|
422
|
+
"security/detect-no-csrf-before-method-override": "warn",
|
|
423
|
+
"security/detect-non-literal-fs-filename": "warn",
|
|
424
|
+
"security/detect-non-literal-regexp": "warn",
|
|
425
|
+
"security/detect-non-literal-require": "warn",
|
|
426
|
+
"security/detect-possible-timing-attacks": "warn",
|
|
427
|
+
"security/detect-pseudoRandomBytes": "warn",
|
|
428
|
+
"security/detect-unsafe-regex": "warn",
|
|
429
|
+
|
|
430
|
+
"depend/ban-dependencies": "error",
|
|
431
|
+
|
|
432
|
+
"perfectionist/sort-named-exports": ["error", { type: "natural" }],
|
|
433
|
+
"perfectionist/sort-named-imports": ["error", { type: "natural" }],
|
|
434
|
+
|
|
435
|
+
...alias(
|
|
436
|
+
jsdoc.configs["flat/recommended-typescript-flavor"].rules ?? {},
|
|
437
|
+
"jsdoc",
|
|
438
|
+
"jsdoc-js"
|
|
439
|
+
),
|
|
440
|
+
"jsdoc-js/require-returns-type": "off",
|
|
441
|
+
"jsdoc-js/require-param-type": "off",
|
|
442
|
+
"jsdoc-js/require-jsdoc": "off",
|
|
443
|
+
"jsdoc-js/ts-ban-ts-comment": "off",
|
|
444
|
+
|
|
445
|
+
...errors([
|
|
446
|
+
"unicorn/catch-error-name",
|
|
447
|
+
"unicorn/consistent-function-scoping",
|
|
448
|
+
"unicorn/error-message",
|
|
449
|
+
"unicorn/no-array-for-each",
|
|
450
|
+
"unicorn/no-array-reduce",
|
|
451
|
+
"unicorn/prefer-array-find",
|
|
452
|
+
"unicorn/prefer-array-flat-map",
|
|
453
|
+
"unicorn/prefer-array-some",
|
|
454
|
+
"unicorn/prefer-at",
|
|
455
|
+
"unicorn/prefer-includes",
|
|
456
|
+
"unicorn/prefer-modern-math-apis",
|
|
457
|
+
"unicorn/prefer-negative-index",
|
|
458
|
+
"unicorn/prefer-number-properties",
|
|
459
|
+
"unicorn/prefer-optional-catch-binding",
|
|
460
|
+
"unicorn/prefer-string-replace-all",
|
|
461
|
+
"unicorn/prefer-ternary",
|
|
462
|
+
"unicorn/throw-new-error",
|
|
463
|
+
"unicorn/no-typeof-undefined",
|
|
464
|
+
"unicorn/no-unnecessary-await",
|
|
465
|
+
"unicorn/prefer-date-now",
|
|
466
|
+
"unicorn/prefer-default-parameters",
|
|
467
|
+
"unicorn/prefer-logical-operator-over-ternary",
|
|
468
|
+
"unicorn/prefer-math-min-max",
|
|
469
|
+
"unicorn/prefer-native-coercion-functions",
|
|
470
|
+
"unicorn/prefer-regexp-test",
|
|
471
|
+
"unicorn/prefer-set-has",
|
|
472
|
+
"unicorn/prefer-spread",
|
|
473
|
+
"unicorn/prefer-string-slice",
|
|
474
|
+
"unicorn/prefer-structured-clone",
|
|
475
|
+
"unicorn/require-number-to-fixed-digits-argument",
|
|
476
|
+
"unicorn/no-empty-file",
|
|
477
|
+
"unicorn/no-instanceof-builtins",
|
|
478
|
+
"unicorn/no-static-only-class",
|
|
479
|
+
"unicorn/no-lonely-if",
|
|
480
|
+
"unicorn/no-negated-condition",
|
|
481
|
+
"unicorn/no-nested-ternary",
|
|
482
|
+
"unicorn/no-array-reverse",
|
|
483
|
+
]),
|
|
484
|
+
"unicorn/no-useless-undefined": ["error", { checkArguments: false }],
|
|
485
|
+
|
|
486
|
+
"barrel-files/avoid-re-export-all": "error",
|
|
487
|
+
},
|
|
488
|
+
|
|
489
|
+
overrides: [
|
|
490
|
+
...styling.overrides,
|
|
491
|
+
|
|
492
|
+
{
|
|
493
|
+
files: ["**/*.{ts,tsx}"],
|
|
494
|
+
rules: {
|
|
495
|
+
"check-file/filename-naming-convention": [
|
|
496
|
+
"error",
|
|
497
|
+
{ "**/*.{ts,tsx}": "KEBAB_CASE" },
|
|
498
|
+
{ ignoreMiddleExtensions: true },
|
|
499
|
+
],
|
|
500
|
+
},
|
|
501
|
+
},
|
|
502
|
+
|
|
503
|
+
{
|
|
504
|
+
files: ["**/*.test.{ts,tsx}", "**/*.spec.{ts,tsx}"],
|
|
505
|
+
rules: {
|
|
506
|
+
...errors([
|
|
507
|
+
"vitest/expect-expect",
|
|
508
|
+
"vitest/no-commented-out-tests",
|
|
509
|
+
"vitest/no-conditional-expect",
|
|
510
|
+
"vitest/no-disabled-tests",
|
|
511
|
+
"vitest/no-duplicate-hooks",
|
|
512
|
+
"vitest/no-focused-tests",
|
|
513
|
+
"vitest/no-identical-title",
|
|
514
|
+
"vitest/no-import-node-test",
|
|
515
|
+
"vitest/no-interpolation-in-snapshots",
|
|
516
|
+
"vitest/no-mocks-import",
|
|
517
|
+
"vitest/no-standalone-expect",
|
|
518
|
+
"vitest/no-unneeded-async-expect-function",
|
|
519
|
+
"vitest/prefer-called-exactly-once-with",
|
|
520
|
+
"vitest/prefer-to-be",
|
|
521
|
+
"vitest/prefer-to-have-length",
|
|
522
|
+
"vitest/require-local-test-context-for-concurrent-snapshots",
|
|
523
|
+
"vitest/require-top-level-describe",
|
|
524
|
+
"vitest/valid-describe-callback",
|
|
525
|
+
"vitest/valid-expect",
|
|
526
|
+
"vitest/valid-expect-in-promise",
|
|
527
|
+
"vitest/valid-title",
|
|
528
|
+
]),
|
|
529
|
+
"vitest/consistent-test-it": ["error", { fn: "it" }],
|
|
530
|
+
"vitest/prefer-lowercase-title": [
|
|
531
|
+
"error",
|
|
532
|
+
{ ignoreTopLevelDescribe: true },
|
|
533
|
+
],
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
|
|
537
|
+
{
|
|
538
|
+
files: ["apps/*/src/routes/**"],
|
|
539
|
+
rules: { "check-file/filename-naming-convention": "off" },
|
|
540
|
+
},
|
|
541
|
+
|
|
542
|
+
{
|
|
543
|
+
files: ["**/*.server.ts", "**/server/**/*.ts"],
|
|
544
|
+
rules: { "node/no-exports-assign": "error" },
|
|
545
|
+
},
|
|
546
|
+
],
|
|
547
|
+
|
|
548
|
+
ignorePatterns: [
|
|
549
|
+
"dist",
|
|
550
|
+
"build",
|
|
551
|
+
"coverage",
|
|
552
|
+
"**/*.d.ts",
|
|
553
|
+
".agents/**",
|
|
554
|
+
".claude/**",
|
|
555
|
+
],
|
|
556
|
+
} satisfies OxlintConfig;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
## Next
|
|
2
|
+
|
|
3
|
+
- The app is Next with the App Router in `apps/web/src/app`. `next typegen` writes the route types, and `lint` and `check-types` run it first.
|
|
4
|
+
- `apps/web/AGENTS.md` is Next's own guidance for the app, and `next dev` writes it back when it's missing. `apps/web/CLAUDE.md` imports it for Claude Code.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
## React Router
|
|
2
|
+
|
|
3
|
+
- The app is React Router v8 in framework mode, built with Vite. A route is a file under `apps/web/src/routes`, named by the flat-routes convention that `apps/web/src/routes.ts` sets with `flatRoutes()`, and `apps/web/src/root.tsx` is the document. `react-router typegen` writes the route types, and `lint` and `check-types` run it first.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
## Tests
|
|
2
|
+
|
|
3
|
+
- Tests are Vitest files named `*.test.ts` or `*.test.tsx` next to the code they test, under `apps/*/src` or `packages/*/src`. Run them with `pnpm test`.
|
|
4
|
+
|
|
5
|
+
## Lint and format
|
|
6
|
+
|
|
7
|
+
- `pnpm lint` runs oxlint with type-aware rules from the root, and `pnpm lint --fix` applies its fixes. `pnpm format` runs oxfmt, and `pnpm format:check` checks without writing.
|
|
8
|
+
- `pnpm typecheck` runs each package's `check-types`, then `tsc` at the root for the config files.
|
|
9
|
+
- The pre-commit hook runs lint-staged on the staged files, and the commit-msg hook runs commitlint.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
|
|
3
|
+
import { styling } from "./vitest.styling.ts";
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: styling.plugins,
|
|
7
|
+
resolve: { tsconfigPaths: true },
|
|
8
|
+
test: {
|
|
9
|
+
include: ["{apps,packages}/*/src/**/*.test.{ts,tsx}"],
|
|
10
|
+
passWithNoTests: true,
|
|
11
|
+
clearMocks: true,
|
|
12
|
+
restoreMocks: true,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
## Styling
|
|
2
|
+
|
|
3
|
+
- StyleX. `apps/web/src/styles/tokens.stylex.ts` binds the tokens with `stylex.defineConsts`, so `colors.accent` compiles to `var(--color-accent)`. Style a component with `stylex.create` and spread `stylex.props(...)` onto the element. There is no Tailwind and no `className` string to write.
|
|
4
|
+
- Vitest runs the StyleX compiler through `vitest.styling.ts`, so a test can render a StyleX component, with `react-dom/server` or a DOM library you add. `tokens.test.ts` reads the token files as text, as it checks names, not styles.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as stylex from "@stylexjs/stylex";
|
|
2
|
+
|
|
3
|
+
export const colors = stylex.defineConsts({
|
|
4
|
+
page: "var(--color-page)",
|
|
5
|
+
ink: "var(--color-ink)",
|
|
6
|
+
accent: "var(--color-accent)",
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const spacing = stylex.defineConsts({
|
|
10
|
+
gutter: "var(--spacing-gutter)",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const radii = stylex.defineConsts({
|
|
14
|
+
card: "var(--radius-card)",
|
|
15
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
import { describe, expect, it } from "{{vitest}}";
|
|
5
|
+
|
|
6
|
+
const here = import.meta.dirname;
|
|
7
|
+
|
|
8
|
+
function declared(block: string): string[] {
|
|
9
|
+
return block.match(/--[a-z][\w-]*(?=:)/g) ?? [];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
describe("tokens", () => {
|
|
13
|
+
const css = readFileSync(path.join(here, "tokens.css"), "utf8");
|
|
14
|
+
const [light = "", ...modes] = css.match(/\{[^{}]*\}/g) ?? [];
|
|
15
|
+
const defined = new Set(declared(light));
|
|
16
|
+
|
|
17
|
+
it("defines every token in the first block, and a later block only overrides them", () => {
|
|
18
|
+
expect(defined.size).toBeGreaterThan(0);
|
|
19
|
+
for (const mode of modes) {
|
|
20
|
+
expect(declared(mode).filter((name) => !defined.has(name))).toStrictEqual(
|
|
21
|
+
[]
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("binds only tokens that tokens.css defines", () => {
|
|
27
|
+
const binding = readFileSync(path.join(here, "tokens.stylex.ts"), "utf8");
|
|
28
|
+
const bound = binding.match(/(?<=var\()--[\w-]+/g) ?? [];
|
|
29
|
+
expect(bound).not.toHaveLength(0);
|
|
30
|
+
expect(bound.filter((name) => !defined.has(name))).toStrictEqual([]);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { OxlintConfig } from "{{oxlint}}";
|
|
2
|
+
|
|
3
|
+
export const styling = {
|
|
4
|
+
settings: {},
|
|
5
|
+
overrides: [
|
|
6
|
+
{
|
|
7
|
+
files: ["**/*.{ts,tsx}"],
|
|
8
|
+
jsPlugins: ["@stylexjs/eslint-plugin"],
|
|
9
|
+
rules: {
|
|
10
|
+
"@stylexjs/valid-shorthands": "error",
|
|
11
|
+
"@stylexjs/no-unused": "error",
|
|
12
|
+
"@stylexjs/no-conflicting-props": "error",
|
|
13
|
+
"@stylexjs/no-legacy-contextual-styles": "error",
|
|
14
|
+
"@stylexjs/enforce-extension": "error",
|
|
15
|
+
"@stylexjs/no-lookahead-selectors": "error",
|
|
16
|
+
"@stylexjs/no-nonstandard-styles": "error",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
} satisfies Pick<OxlintConfig, "settings" | "overrides">;
|