-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathrstack.config.ts
More file actions
128 lines (124 loc) · 3.85 KB
/
Copy pathrstack.config.ts
File metadata and controls
128 lines (124 loc) · 3.85 KB
1
2
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
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
126
127
128
import { define } from 'rstack'
define.lint(({ globalIgnores, globals, js, ts }) => [
globalIgnores([
'**/*.vue',
'**/.rslib/**',
'**/compiled/**',
'**/coverage/**',
'**/dist/**',
'**/storybook-static/**',
]),
js.configs.recommended,
ts.configs.recommendedTypeChecked,
{
languageOptions: {
// Type-aware rules and `--type-check` apply to the files included by these
// tsconfigs. Files outside them (per-package build-config.ts / rstack.config.ts
// and root rstack.config.ts) only get rules that need no type information.
parserOptions: {
project: [
'./packages/*/tsconfig.json',
'./sandboxes/*/tsconfig.json',
'./sandboxes/*/*/tsconfig.json',
'./website/tsconfig.json',
'./tests/tsconfig.json',
'./e2e/tsconfig.json',
'./scripts/tsconfig.json',
],
},
globals: {
...globals.browser,
...globals.node,
...globals.rstest,
},
},
rules: {
'@typescript-eslint/no-require-imports': 'off',
'no-cond-assign': 'off',
'no-undef-init': 'warn',
'no-useless-assignment': 'off',
'no-unused-vars': [
'warn',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
ignoreRestSiblings: true,
varsIgnorePattern: '^_',
},
],
'dot-notation': 'warn',
// Presets, loaders, and test doubles implement async signatures without
// awaiting. Kept in this block because the rule also reports `.js` files.
'@typescript-eslint/require-await': 'off',
},
},
{
files: ['**/*.{ts,tsx,mts,cts}'],
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
ignoreRestSiblings: true,
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-dynamic-delete': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-invalid-void-type': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/prefer-optional-chain': 'off',
// `any` is allowed (no-explicit-any is off), so the rules that flag values
// flowing out of `any` are off as well.
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
},
},
])
define.test({
projects: [
'./packages/*/rstest.config.ts',
'./sandboxes/*/rstest.config.ts',
'./tests/rstest.config.ts',
],
})
define.staged({
'*.{json,css,less,scss}': 'rstack fmt --no-cache',
'*.{js,jsx,ts,tsx,mjs,cjs}': 'rstack fmt --no-cache',
})
// TODO: `--no-cache` on the format script in package.json and define.staged() entries above works around a
// Prettier idempotency regression fixed by prettier/prettier#19725 but not yet released as of
// Prettier 3.9.6. Once a release containing the fix ships and Prettier is bumped, drop the flag.
define.fmt({
semi: false,
singleQuote: true,
plugins: ['prettier-plugin-organize-imports'],
sortPackageJson: true,
// organize-imports wraps Prettier's parsers, not Rstack's default Yuku parsers.
overrides: [
{
files: '*.{js,jsx,mjs,cjs}',
options: { parser: 'babel' },
},
{
files: '*.{ts,tsx,mts,cts}',
options: { parser: 'typescript' },
},
],
ignorePatterns: [
'**/*.vue',
'**/.rslib/**',
'**/__snapshots__/**',
'.codex/environments/environment.toml',
],
})