@timobechtel/style 2.0.1 → 2.1.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 +201 -100
- package/oxfmt/index.json +19 -0
- package/oxlint/core.jsonc +212 -0
- package/oxlint/react.jsonc +46 -0
- package/package.json +11 -4
package/README.md
CHANGED
|
@@ -2,66 +2,127 @@
|
|
|
2
2
|
|
|
3
3
|
> Roll in style.
|
|
4
4
|
|
|
5
|
-
Highly opinionated configuration files for typescript projects.
|
|
5
|
+
Highly opinionated configuration files for typescript projects.
|
|
6
6
|
|
|
7
|
-
> [!
|
|
8
|
-
>
|
|
7
|
+
> [!TIP]
|
|
8
|
+
> Let your agent set this up for you:
|
|
9
|
+
>
|
|
10
|
+
> ```
|
|
11
|
+
> Read https://raw.githubusercontent.com/TimoBechtel/style/main/skills/setup-style/SKILL.md and configure.
|
|
12
|
+
> ```
|
|
9
13
|
|
|
10
14
|
## Usage
|
|
11
15
|
|
|
16
|
+
> Make sure to first commit your code before running the following commands. This allows you to revert changes easily.
|
|
17
|
+
|
|
12
18
|
```bash
|
|
13
|
-
npm i -D @timobechtel/style
|
|
19
|
+
npm i -D @timobechtel/style typescript
|
|
14
20
|
```
|
|
15
21
|
|
|
16
|
-
|
|
22
|
+
Install gh-get to make it easier to download the template files:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
gh extension install timobechtel/gh-get
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### [Oxfmt](https://oxc.rs/docs/guide/usage/formatter.html)
|
|
29
|
+
|
|
30
|
+
> Code formatter, replaces Prettier.
|
|
17
31
|
|
|
18
32
|
```bash
|
|
19
|
-
|
|
33
|
+
npm i -D oxfmt
|
|
20
34
|
```
|
|
21
35
|
|
|
36
|
+
```bash
|
|
37
|
+
gh get timobechtel/style templates/.oxfmtrc.json
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- [oxfmt template](https://github.com/TimoBechtel/style/blob/main/templates/.oxfmtrc.json)
|
|
41
|
+
|
|
42
|
+
### [Oxlint](https://oxc.rs/docs/guide/usage/linter.html)
|
|
43
|
+
|
|
44
|
+
> Faster ESLint alternative. 5x faster in personal testing.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm i -D oxlint
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Core:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
gh get timobechtel/style templates/.oxlintrc.jsonc
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- [oxlint core template](https://github.com/TimoBechtel/style/blob/main/templates/.oxlintrc.jsonc)
|
|
57
|
+
|
|
58
|
+
React:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
gh get timobechtel/style templates/react/.oxlintrc.jsonc
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- [oxlint react template](https://github.com/TimoBechtel/style/blob/main/templates/react/.oxlintrc.jsonc)
|
|
65
|
+
|
|
22
66
|
<details>
|
|
23
|
-
<summary>
|
|
67
|
+
<summary>Migrating to Oxlint? - `File '@timobechtel/style/tsconfig/core' not found.`</summary>
|
|
24
68
|
|
|
25
|
-
|
|
69
|
+
When migrating from ESLint to Oxlint, you might need to update the `tsconfig.json` file:
|
|
26
70
|
|
|
27
|
-
```
|
|
28
|
-
|
|
71
|
+
```diff
|
|
72
|
+
- "extends": ["@timobechtel/style/tsconfig/core"]
|
|
73
|
+
+ "extends": ["@timobechtel/style/tsconfig/core.json"]
|
|
29
74
|
```
|
|
30
75
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
import config from '@timobechtel/style/prettier/index.mjs';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @type {import("prettier").Config}
|
|
38
|
-
*/
|
|
39
|
-
export default {
|
|
40
|
-
...config,
|
|
41
|
-
// your config
|
|
42
|
-
}
|
|
76
|
+
```diff
|
|
77
|
+
- "extends": ["@timobechtel/style/tsconfig/react"]
|
|
78
|
+
+ "extends": ["@timobechtel/style/tsconfig/react.json"]
|
|
43
79
|
```
|
|
44
|
-
|
|
80
|
+
|
|
81
|
+
> tsgolint requires a file extension to resolve the config file.
|
|
82
|
+
|
|
45
83
|
</details>
|
|
46
84
|
|
|
47
85
|
### Typescript
|
|
48
86
|
|
|
87
|
+
> Pre-configured tsconfig files.
|
|
88
|
+
|
|
49
89
|
#### Existing tsconfig
|
|
50
90
|
|
|
51
91
|
For existing projects or templates, I recomment leaving the config as-is and adding this preset to the extends array.
|
|
52
92
|
|
|
53
93
|
```json
|
|
54
94
|
{
|
|
55
|
-
"extends": ["@timobechtel/style/tsconfig/core"]
|
|
95
|
+
"extends": ["@timobechtel/style/tsconfig/core.json"]
|
|
56
96
|
}
|
|
57
97
|
```
|
|
58
98
|
|
|
59
99
|
#### New tsconfig
|
|
60
100
|
|
|
61
101
|
```bash
|
|
62
|
-
|
|
102
|
+
gh get timobechtel/style templates/tsconfig.json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- [tsconfig core template](https://github.com/TimoBechtel/style/blob/main/templates/tsconfig.json)
|
|
106
|
+
|
|
107
|
+
#### Or with React
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
gh get timobechtel/style templates/react/tsconfig.json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
<details>
|
|
114
|
+
<summary>Or manually</summary>
|
|
115
|
+
|
|
116
|
+
Copy to `tsconfig.json`:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"extends": "@timobechtel/style/tsconfig/react.json"
|
|
121
|
+
}
|
|
63
122
|
```
|
|
64
123
|
|
|
124
|
+
</details>
|
|
125
|
+
|
|
65
126
|
#### Expo
|
|
66
127
|
|
|
67
128
|
With expo make sure to add `"moduleResolution": "bundler"` to the `compilerOptions`, otherwise certain routing types might break.
|
|
@@ -69,120 +130,150 @@ With expo make sure to add `"moduleResolution": "bundler"` to the `compilerOptio
|
|
|
69
130
|
<details>
|
|
70
131
|
<summary>Example</summary>
|
|
71
132
|
|
|
72
|
-
|
|
133
|
+
Copy to `tsconfig.json`:
|
|
73
134
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"**/*.ts",
|
|
88
|
-
"**/*.tsx",
|
|
89
|
-
".expo/types/**/*.ts",
|
|
90
|
-
"expo-env.d.ts"
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
```
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"extends": ["expo/tsconfig.base", "@timobechtel/style/tsconfig/core.json"],
|
|
138
|
+
"compilerOptions": {
|
|
139
|
+
"moduleResolution": "bundler", // <-- this is important
|
|
140
|
+
"strict": true,
|
|
141
|
+
"paths": {
|
|
142
|
+
"@/*": ["./*"]
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"]
|
|
146
|
+
}
|
|
147
|
+
```
|
|
94
148
|
|
|
95
149
|
</details>
|
|
96
150
|
|
|
97
|
-
|
|
151
|
+
### Prettier
|
|
152
|
+
|
|
153
|
+
> Prettier config will not be updated anymore. I recommend using [Oxfmt](#oxfmt) instead.
|
|
154
|
+
> oxfmt has been configured to match prettier rules, however this might drift in future versions.
|
|
155
|
+
|
|
156
|
+
<details>
|
|
157
|
+
<summary>Setup prettier anyways</summary>
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
npm i -D prettier
|
|
161
|
+
```
|
|
98
162
|
|
|
99
163
|
```bash
|
|
100
|
-
|
|
164
|
+
gh get timobechtel/style templates/.prettierrc
|
|
101
165
|
```
|
|
102
166
|
|
|
167
|
+
- [prettier template](https://github.com/TimoBechtel/style/blob/main/templates/.prettierrc)
|
|
168
|
+
|
|
103
169
|
<details>
|
|
104
|
-
<summary>
|
|
170
|
+
<summary>Extend / customize config</summary>
|
|
105
171
|
|
|
106
|
-
|
|
172
|
+
Need to extend the config, e.g. adding plugins?
|
|
107
173
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
```
|
|
174
|
+
```bash
|
|
175
|
+
gh get timobechtel/style templates/.prettierrc.mjs
|
|
176
|
+
```
|
|
113
177
|
|
|
114
|
-
|
|
178
|
+
Create a .prettierrc.mjs file and import the config, like this:
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
import config from '@timobechtel/style/prettier/index.mjs';
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @type {import("prettier").Config}
|
|
185
|
+
*/
|
|
186
|
+
export default {
|
|
187
|
+
...config,
|
|
188
|
+
// your config
|
|
189
|
+
};
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
</details>
|
|
193
|
+
</details>
|
|
115
194
|
|
|
116
195
|
### Eslint
|
|
117
196
|
|
|
197
|
+
> Eslint config will be removed in a future version. Use [Oxlint](#oxlint) instead.
|
|
198
|
+
> oxlint has been configured to match existing eslint rules, however this might drift in future versions.
|
|
199
|
+
|
|
200
|
+
<details>
|
|
201
|
+
<summary>Setup eslint anyways</summary>
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
npm i -D eslint
|
|
205
|
+
```
|
|
206
|
+
|
|
118
207
|
```bash
|
|
119
|
-
|
|
208
|
+
gh get timobechtel/style templates/eslint.config.js
|
|
120
209
|
```
|
|
121
210
|
|
|
211
|
+
- [eslint core template](https://github.com/TimoBechtel/style/blob/main/templates/eslint.config.js)
|
|
212
|
+
|
|
122
213
|
Note: If your project is not ESM (no `"type": "module"` in `package.json`), rename the file to `eslint.config.mjs`.
|
|
123
214
|
|
|
124
215
|
<details>
|
|
125
216
|
<summary>Or manually</summary>
|
|
126
217
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
settings: {
|
|
148
|
-
'import-x/resolver-next': [
|
|
149
|
-
createTypeScriptImportResolver({
|
|
150
|
-
project: path.resolve(__dirname, 'tsconfig.json'),
|
|
151
|
-
}),
|
|
152
|
-
createNodeResolver(),
|
|
153
|
-
],
|
|
218
|
+
Copy the following to an `eslint.config.js`:
|
|
219
|
+
|
|
220
|
+
```js
|
|
221
|
+
import path from 'node:path';
|
|
222
|
+
import { fileURLToPath } from 'node:url';
|
|
223
|
+
import { defineConfig } from 'eslint/config';
|
|
224
|
+
import styleCore from '@timobechtel/style/eslint/core.js';
|
|
225
|
+
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
|
|
226
|
+
import { createNodeResolver } from 'eslint-plugin-import-x';
|
|
227
|
+
|
|
228
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
229
|
+
|
|
230
|
+
export default defineConfig([
|
|
231
|
+
...styleCore,
|
|
232
|
+
{
|
|
233
|
+
languageOptions: {
|
|
234
|
+
parserOptions: {
|
|
235
|
+
tsconfigRootDir: __dirname,
|
|
154
236
|
},
|
|
155
237
|
},
|
|
156
|
-
|
|
157
|
-
|
|
238
|
+
settings: {
|
|
239
|
+
'import-x/resolver-next': [
|
|
240
|
+
createTypeScriptImportResolver({
|
|
241
|
+
project: path.resolve(__dirname, 'tsconfig.json'),
|
|
242
|
+
}),
|
|
243
|
+
createNodeResolver(),
|
|
244
|
+
],
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
]);
|
|
248
|
+
```
|
|
158
249
|
|
|
159
250
|
</details>
|
|
160
251
|
|
|
161
252
|
#### React
|
|
162
253
|
|
|
163
254
|
```bash
|
|
164
|
-
|
|
255
|
+
gh get timobechtel/style templates/react/eslint.config.js
|
|
165
256
|
```
|
|
166
257
|
|
|
258
|
+
- [eslint react template](https://github.com/TimoBechtel/style/blob/main/templates/react/eslint.config.js)
|
|
259
|
+
|
|
167
260
|
<details>
|
|
168
261
|
<summary>Or manually</summary>
|
|
169
262
|
|
|
170
263
|
Also spread `styleReact` from `@timobechtel/style/eslint/react.js`:
|
|
171
264
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
265
|
+
```js
|
|
266
|
+
import styleCore from '@timobechtel/style/eslint/core.js';
|
|
267
|
+
import styleReact from '@timobechtel/style/eslint/react.js';
|
|
268
|
+
import { defineConfig } from 'eslint/config';
|
|
176
269
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
270
|
+
export default defineConfig([
|
|
271
|
+
...styleCore,
|
|
272
|
+
...styleReact,
|
|
273
|
+
// ... your config
|
|
274
|
+
]);
|
|
275
|
+
```
|
|
183
276
|
|
|
184
|
-
Example config:
|
|
185
|
-
<https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/eslint/react/eslint.config.js>
|
|
186
277
|
</details>
|
|
187
278
|
|
|
188
279
|
#### Migration from v1.x
|
|
@@ -209,6 +300,8 @@ Add the following to your VSCode config, e.g. `.vscode/settings.json`
|
|
|
209
300
|
}
|
|
210
301
|
```
|
|
211
302
|
|
|
303
|
+
</details>
|
|
304
|
+
|
|
212
305
|
### semantic-release
|
|
213
306
|
|
|
214
307
|
This repo also contains a [semantic-release](https://github.com/semantic-release/semantic-release) configuration.
|
|
@@ -218,5 +311,13 @@ npm i -D semantic-release @semantic-release/changelog @semantic-release/git
|
|
|
218
311
|
```
|
|
219
312
|
|
|
220
313
|
```bash
|
|
221
|
-
|
|
314
|
+
gh get timobechtel/style templates/.releaserc.json
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
- [semantic-release template](https://github.com/TimoBechtel/style/blob/main/templates/.releaserc.json)
|
|
318
|
+
|
|
319
|
+
### Agent Skills
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
npx skills add timobechtel/style@setup-style
|
|
222
323
|
```
|
package/oxfmt/index.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"endOfLine": "lf",
|
|
3
|
+
"tabWidth": 2,
|
|
4
|
+
"printWidth": 80,
|
|
5
|
+
"useTabs": false,
|
|
6
|
+
"singleQuote": true,
|
|
7
|
+
"sortImports": {
|
|
8
|
+
"groups": [
|
|
9
|
+
"builtin",
|
|
10
|
+
"external",
|
|
11
|
+
"internal",
|
|
12
|
+
"parent",
|
|
13
|
+
"sibling",
|
|
14
|
+
"index",
|
|
15
|
+
"unknown"
|
|
16
|
+
],
|
|
17
|
+
"newlinesBetween": true
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": [
|
|
4
|
+
"unicorn",
|
|
5
|
+
"typescript",
|
|
6
|
+
"oxc",
|
|
7
|
+
"import"
|
|
8
|
+
],
|
|
9
|
+
"categories": {
|
|
10
|
+
"correctness": "error",
|
|
11
|
+
"suspicious": "error",
|
|
12
|
+
"pedantic": "error",
|
|
13
|
+
"nursery": "error"
|
|
14
|
+
},
|
|
15
|
+
"rules": {
|
|
16
|
+
// ---- style rules ----
|
|
17
|
+
"curly": [
|
|
18
|
+
"warn",
|
|
19
|
+
"multi-line"
|
|
20
|
+
],
|
|
21
|
+
"default-case-last": "error",
|
|
22
|
+
"default-param-last": "error",
|
|
23
|
+
"import/first": "error",
|
|
24
|
+
"import/no-duplicates": "warn",
|
|
25
|
+
"new-cap": [
|
|
26
|
+
"error",
|
|
27
|
+
{
|
|
28
|
+
"capIsNew": false
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"no-label-var": "error",
|
|
32
|
+
"prefer-const": "warn",
|
|
33
|
+
"prefer-object-spread": "warn",
|
|
34
|
+
"prefer-rest-params": "error",
|
|
35
|
+
"prefer-spread": "error",
|
|
36
|
+
"prefer-template": "warn",
|
|
37
|
+
"typescript/adjacent-overload-signatures": "error",
|
|
38
|
+
"typescript/array-type": "error",
|
|
39
|
+
"typescript/ban-tslint-comment": "error",
|
|
40
|
+
"typescript/class-literal-property-style": "error",
|
|
41
|
+
"typescript/consistent-generic-constructors": "error",
|
|
42
|
+
"typescript/consistent-type-assertions": "error",
|
|
43
|
+
"typescript/consistent-type-imports": [
|
|
44
|
+
"error",
|
|
45
|
+
{
|
|
46
|
+
"prefer": "type-imports",
|
|
47
|
+
"fixStyle": "inline-type-imports"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"typescript/no-inferrable-types": "error",
|
|
51
|
+
"typescript/prefer-for-of": "error",
|
|
52
|
+
"typescript/prefer-function-type": "error",
|
|
53
|
+
"typescript/prefer-reduce-type-parameter": "error",
|
|
54
|
+
"typescript/prefer-return-this-type": "error",
|
|
55
|
+
"typescript/unified-signatures": "error",
|
|
56
|
+
"unicorn/error-message": "error",
|
|
57
|
+
"unicorn/no-zero-fractions": "warn",
|
|
58
|
+
"unicorn/numeric-separators-style": "error",
|
|
59
|
+
"unicorn/prefer-array-index-of": "error",
|
|
60
|
+
"unicorn/prefer-default-parameters": "warn",
|
|
61
|
+
"unicorn/prefer-includes": "error",
|
|
62
|
+
"unicorn/prefer-keyboard-event-key": "error",
|
|
63
|
+
"unicorn/prefer-logical-operator-over-ternary": "error",
|
|
64
|
+
"unicorn/prefer-modern-dom-apis": "error",
|
|
65
|
+
"unicorn/prefer-negative-index": "error",
|
|
66
|
+
"unicorn/prefer-object-from-entries": "error",
|
|
67
|
+
"unicorn/prefer-reflect-apply": "error",
|
|
68
|
+
"unicorn/prefer-spread": "error",
|
|
69
|
+
"unicorn/prefer-ternary": [
|
|
70
|
+
"warn",
|
|
71
|
+
"only-single-line"
|
|
72
|
+
],
|
|
73
|
+
"unicorn/require-array-join-separator": "error",
|
|
74
|
+
"unicorn/switch-case-braces": "error",
|
|
75
|
+
|
|
76
|
+
// ---- correctness rules ----
|
|
77
|
+
"import/default": "off",
|
|
78
|
+
"import/namespace": "off",
|
|
79
|
+
"no-unused-vars": [
|
|
80
|
+
"error",
|
|
81
|
+
{
|
|
82
|
+
"args": "after-used",
|
|
83
|
+
"argsIgnorePattern": "^_",
|
|
84
|
+
"ignoreRestSiblings": false,
|
|
85
|
+
"vars": "all",
|
|
86
|
+
"varsIgnorePattern": "^_"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"no-useless-rename": "warn",
|
|
90
|
+
"typescript/require-array-sort-compare": [
|
|
91
|
+
"error",
|
|
92
|
+
{
|
|
93
|
+
"ignoreStringArrays": true
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"unicorn/no-useless-fallback-in-spread": "warn",
|
|
97
|
+
"unicorn/no-useless-length-check": "warn",
|
|
98
|
+
|
|
99
|
+
// ---- suspicious rules ----
|
|
100
|
+
"import/no-named-as-default": "warn",
|
|
101
|
+
"import/no-named-as-default-member": "warn",
|
|
102
|
+
"unicorn/consistent-function-scoping": [
|
|
103
|
+
"warn",
|
|
104
|
+
{
|
|
105
|
+
"checkArrowFunctions": false
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
|
|
109
|
+
// ---- pedantic rules ----
|
|
110
|
+
"max-depth": [
|
|
111
|
+
"warn",
|
|
112
|
+
4
|
|
113
|
+
],
|
|
114
|
+
"no-lonely-if": "warn",
|
|
115
|
+
"typescript/no-misused-promises": [
|
|
116
|
+
"error",
|
|
117
|
+
{
|
|
118
|
+
"checksVoidReturn": false
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"unicorn/escape-case": "warn",
|
|
122
|
+
"unicorn/no-unreadable-iife": "warn",
|
|
123
|
+
"unicorn/prefer-event-target": "warn",
|
|
124
|
+
|
|
125
|
+
// ---- restriction rules ----
|
|
126
|
+
"no-alert": "error",
|
|
127
|
+
"no-console": [
|
|
128
|
+
"error",
|
|
129
|
+
{
|
|
130
|
+
"allow": [
|
|
131
|
+
"warn",
|
|
132
|
+
"error",
|
|
133
|
+
"clear",
|
|
134
|
+
"info"
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"no-restricted-globals": [
|
|
139
|
+
"error",
|
|
140
|
+
"event",
|
|
141
|
+
"name"
|
|
142
|
+
],
|
|
143
|
+
"no-var": "error",
|
|
144
|
+
"typescript/no-dynamic-delete": "error",
|
|
145
|
+
"typescript/no-empty-object-type": "error",
|
|
146
|
+
"typescript/no-explicit-any": "error",
|
|
147
|
+
"typescript/no-import-type-side-effects": "error",
|
|
148
|
+
"typescript/no-invalid-void-type": "error",
|
|
149
|
+
"typescript/no-namespace": "error",
|
|
150
|
+
"typescript/no-non-null-asserted-nullish-coalescing": "error",
|
|
151
|
+
"typescript/no-non-null-assertion": "error",
|
|
152
|
+
"typescript/no-require-imports": "error",
|
|
153
|
+
"typescript/non-nullable-type-assertion-style": "error",
|
|
154
|
+
"typescript/prefer-literal-enum-member": "error",
|
|
155
|
+
"typescript/use-unknown-in-catch-callback-variable": "error",
|
|
156
|
+
"unicorn/prefer-modern-math-apis": "error",
|
|
157
|
+
"unicorn/prefer-node-protocol": "error",
|
|
158
|
+
"unicorn/prefer-number-properties": [
|
|
159
|
+
"error",
|
|
160
|
+
{
|
|
161
|
+
"checkInfinity": false
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
|
|
165
|
+
// ---- perf rules ----
|
|
166
|
+
"unicorn/prefer-array-find": "error",
|
|
167
|
+
"unicorn/prefer-array-flat-map": "error",
|
|
168
|
+
"unicorn/prefer-set-has": "error",
|
|
169
|
+
|
|
170
|
+
// ---- nursery rules ----
|
|
171
|
+
"typescript/consistent-type-exports": [
|
|
172
|
+
"error",
|
|
173
|
+
{
|
|
174
|
+
"fixMixedExportsWithInlineTypeSpecifier": true
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"typescript/prefer-regexp-exec": "warn",
|
|
178
|
+
|
|
179
|
+
// these are mostly handled by typescript compiler
|
|
180
|
+
"getter-return": "off",
|
|
181
|
+
"no-undef": "off",
|
|
182
|
+
"no-unreachable": "off",
|
|
183
|
+
"import/named": "off",
|
|
184
|
+
"import/export": "off",
|
|
185
|
+
|
|
186
|
+
// new oxlint rules in nursery below that were not configured in eslint configs before
|
|
187
|
+
|
|
188
|
+
// report duplicate code in branches
|
|
189
|
+
"oxc/branches-sharing-code": "warn",
|
|
190
|
+
// prevent mixing value and non-value returns in functions
|
|
191
|
+
"typescript/consistent-return": "warn",
|
|
192
|
+
"typescript/no-unnecessary-qualifier": "warn",
|
|
193
|
+
"typescript/prefer-readonly": "warn",
|
|
194
|
+
// this is nice, but adds a lot of noise to existing codebases
|
|
195
|
+
"typescript/prefer-readonly-parameter-types": "off",
|
|
196
|
+
"typescript/strict-void-return": "off"
|
|
197
|
+
|
|
198
|
+
},
|
|
199
|
+
"overrides": [
|
|
200
|
+
{
|
|
201
|
+
"files": [
|
|
202
|
+
"**/*.test.ts",
|
|
203
|
+
"**/*.test.tsx",
|
|
204
|
+
"**/*.spec.ts",
|
|
205
|
+
"**/*.spec.tsx"
|
|
206
|
+
],
|
|
207
|
+
"rules": {
|
|
208
|
+
"typescript/ban-ts-comment": "off"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"extends": [
|
|
4
|
+
"./core.jsonc"
|
|
5
|
+
],
|
|
6
|
+
"plugins": [
|
|
7
|
+
"unicorn",
|
|
8
|
+
"typescript",
|
|
9
|
+
"oxc",
|
|
10
|
+
"import",
|
|
11
|
+
"react"
|
|
12
|
+
],
|
|
13
|
+
"rules": {
|
|
14
|
+
// ---- style rules ----
|
|
15
|
+
"react/jsx-boolean-value": "warn",
|
|
16
|
+
"react/jsx-curly-brace-presence": [
|
|
17
|
+
"warn",
|
|
18
|
+
{
|
|
19
|
+
"props": "never",
|
|
20
|
+
"children": "ignore",
|
|
21
|
+
"propElementValues": "always"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"react/jsx-fragments": "warn",
|
|
25
|
+
"react/jsx-pascal-case": "warn",
|
|
26
|
+
"react/self-closing-comp": "warn",
|
|
27
|
+
|
|
28
|
+
// ---- pedantic rules ----
|
|
29
|
+
"react/jsx-no-target-blank": [
|
|
30
|
+
"error",
|
|
31
|
+
{
|
|
32
|
+
"allowReferrer": true
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"react/jsx-no-useless-fragment": [
|
|
36
|
+
"warn",
|
|
37
|
+
{
|
|
38
|
+
"allowExpressions": true
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
|
|
42
|
+
// ---- restriction rules ----
|
|
43
|
+
"react/no-unknown-property": "error",
|
|
44
|
+
"react/button-has-type": "error"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timobechtel/style",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,20 +11,26 @@
|
|
|
11
11
|
"eslint",
|
|
12
12
|
"prettier",
|
|
13
13
|
"semantic-release",
|
|
14
|
-
"tsconfig"
|
|
14
|
+
"tsconfig",
|
|
15
|
+
"oxlint",
|
|
16
|
+
"oxfmt"
|
|
15
17
|
],
|
|
16
18
|
"devDependencies": {
|
|
17
19
|
"@semantic-release/npm": "^13.1.4",
|
|
18
20
|
"eslint": "^9.39.3",
|
|
19
21
|
"prettier": "^3.8.1",
|
|
20
22
|
"semantic-release": "^25.0.3",
|
|
21
|
-
"typescript": "^5.9.3"
|
|
23
|
+
"typescript": "^5.9.3",
|
|
24
|
+
"oxlint": "^1.55.0",
|
|
25
|
+
"oxfmt": "^0.40.0"
|
|
22
26
|
},
|
|
23
27
|
"peerDependencies": {
|
|
24
28
|
"eslint": "^9.39.3",
|
|
25
29
|
"prettier": "^3.8.1",
|
|
26
30
|
"semantic-release": "^25.0.3",
|
|
27
|
-
"typescript": "^5.9.3"
|
|
31
|
+
"typescript": "^5.9.3",
|
|
32
|
+
"oxlint": "^1.55.0",
|
|
33
|
+
"oxfmt": "^0.40.0"
|
|
28
34
|
},
|
|
29
35
|
"dependencies": {
|
|
30
36
|
"@eslint/js": "^9.39.3",
|
|
@@ -38,6 +44,7 @@
|
|
|
38
44
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
39
45
|
"eslint-plugin-unicorn": "^63.0.0",
|
|
40
46
|
"globals": "^17.3.0",
|
|
47
|
+
"oxlint-tsgolint": "^0.16.0",
|
|
41
48
|
"typescript-eslint": "^8.56.0"
|
|
42
49
|
}
|
|
43
50
|
}
|