@haltcase/style 8.0.0-canary.9 → 8.0.1-canary.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 +21 -0
- package/README.md +235 -0
- package/dist/.editorconfig +15 -0
- package/dist/editorconfig/index.d.ts +6 -0
- package/dist/editorconfig/index.js +8 -0
- package/dist/oxfmt/index.d.ts +8 -0
- package/dist/oxfmt/index.js +57 -0
- package/dist/oxlint/configs/base.d.ts +190 -0
- package/dist/oxlint/configs/base.js +39 -0
- package/dist/oxlint/configs/next.d.ts +25 -0
- package/dist/oxlint/configs/next.js +38 -0
- package/dist/oxlint/configs/node.d.ts +16 -0
- package/dist/oxlint/configs/node.js +11 -0
- package/dist/oxlint/configs/react.d.ts +7 -0
- package/dist/oxlint/configs/react.js +27 -0
- package/dist/oxlint/configs/tanstack-router.d.ts +22 -0
- package/dist/oxlint/configs/tanstack-router.js +22 -0
- package/dist/oxlint/configs/tanstack-start.d.ts +23 -0
- package/dist/oxlint/configs/tanstack-start.js +22 -0
- package/dist/oxlint/configs/testing.d.ts +16 -0
- package/dist/oxlint/configs/testing.js +11 -0
- package/dist/oxlint/configs/typescript.d.ts +77 -0
- package/dist/oxlint/configs/typescript.js +18 -0
- package/dist/oxlint/constants.d.ts +26 -0
- package/dist/oxlint/constants.js +37 -0
- package/dist/oxlint/index.d.ts +34 -0
- package/dist/oxlint/index.js +51 -0
- package/dist/oxlint/rules/best-practice.d.ts +181 -0
- package/dist/oxlint/rules/best-practice.js +177 -0
- package/dist/oxlint/rules/imports.d.ts +67 -0
- package/dist/oxlint/rules/imports.js +67 -0
- package/dist/oxlint/rules/jsx-a11y.d.ts +8 -0
- package/dist/oxlint/rules/jsx-a11y.js +6 -0
- package/dist/oxlint/rules/playwright-test.d.ts +25 -0
- package/dist/oxlint/rules/playwright-test.js +26 -0
- package/dist/oxlint/rules/possible-errors.d.ts +28 -0
- package/dist/oxlint/rules/possible-errors.js +29 -0
- package/dist/oxlint/rules/react-x.d.ts +38 -0
- package/dist/oxlint/rules/react-x.js +38 -0
- package/dist/oxlint/rules/react.d.ts +28 -0
- package/dist/oxlint/rules/react.js +20 -0
- package/dist/oxlint/rules/restriction.d.ts +22 -0
- package/dist/oxlint/rules/restriction.js +22 -0
- package/dist/oxlint/rules/stylistic-jsx.d.ts +15 -0
- package/dist/oxlint/rules/stylistic-jsx.js +15 -0
- package/dist/oxlint/rules/stylistic.d.ts +88 -0
- package/dist/oxlint/rules/stylistic.js +74 -0
- package/dist/oxlint/rules/typescript/declaration-files.d.ts +8 -0
- package/dist/oxlint/rules/typescript/declaration-files.js +6 -0
- package/dist/oxlint/rules/typescript/index.d.ts +107 -0
- package/dist/oxlint/rules/typescript/index.js +103 -0
- package/dist/oxlint/rules/variables.d.ts +25 -0
- package/dist/oxlint/rules/variables.js +26 -0
- package/dist/oxlint/utils/eslint-compat.d.ts +9 -0
- package/dist/oxlint/utils/eslint-compat.js +35 -0
- package/dist/stylelint/_base.d.ts +6 -0
- package/dist/stylelint/_base.js +40 -0
- package/dist/stylelint/index.d.ts +6 -0
- package/{stylelint → dist/stylelint}/index.js +8 -10
- package/dist/stylelint/modules.d.ts +6 -0
- package/dist/stylelint/modules.js +19 -0
- package/dist/stylelint/standard.d.ts +4 -0
- package/dist/stylelint/standard.js +5 -0
- package/dist/stylelint/tailwind.d.ts +6 -0
- package/dist/stylelint/tailwind.js +11 -0
- package/{typescript → dist/typescript}/tsconfig.next.json +1 -1
- package/{typescript → dist/typescript}/tsconfig.node22.json +2 -1
- package/{typescript → dist/typescript}/tsconfig.node24.json +3 -8
- package/{typescript/tsconfig.node20.json → dist/typescript/tsconfig.node26.json} +4 -4
- package/dist/vite-plus/index.d.ts +11 -0
- package/dist/vite-plus/index.js +16 -0
- package/package.json +151 -174
- package/LICENSE.md +0 -382
- package/dist/types/eslint/configs/browser.d.ts +0 -8
- package/dist/types/eslint/configs/cjs.d.ts +0 -4
- package/dist/types/eslint/configs/internal/base.d.ts +0 -76
- package/dist/types/eslint/configs/internal/commonjs.d.ts +0 -4
- package/dist/types/eslint/configs/internal/es2015.d.ts +0 -4
- package/dist/types/eslint/configs/internal/simple-import-sort.d.ts +0 -4
- package/dist/types/eslint/configs/internal/tsdoc.d.ts +0 -4
- package/dist/types/eslint/configs/internal/unicorn.d.ts +0 -4
- package/dist/types/eslint/configs/internal/utils/typescript.d.ts +0 -6
- package/dist/types/eslint/configs/next.d.ts +0 -8
- package/dist/types/eslint/configs/node.d.ts +0 -8
- package/dist/types/eslint/configs/playwright-test.d.ts +0 -4
- package/dist/types/eslint/configs/react.d.ts +0 -8
- package/dist/types/eslint/configs/typescript.d.ts +0 -10
- package/dist/types/eslint/constants.d.ts +0 -14
- package/dist/types/eslint/index.d.ts +0 -12
- package/dist/types/eslint/rules/best-practice.d.ts +0 -5
- package/dist/types/eslint/rules/imports.d.ts +0 -5
- package/dist/types/eslint/rules/jsx-a11y.d.ts +0 -5
- package/dist/types/eslint/rules/playwright-test.d.ts +0 -8
- package/dist/types/eslint/rules/possible-errors.d.ts +0 -8
- package/dist/types/eslint/rules/react-x.d.ts +0 -8
- package/dist/types/eslint/rules/react.d.ts +0 -11
- package/dist/types/eslint/rules/stylistic-jsx.d.ts +0 -8
- package/dist/types/eslint/rules/stylistic.d.ts +0 -8
- package/dist/types/eslint/rules/typescript/extension.d.ts +0 -5
- package/dist/types/eslint/rules/typescript/import.d.ts +0 -5
- package/dist/types/eslint/rules/typescript/index.d.ts +0 -8
- package/dist/types/eslint/rules/typescript/naming-convention.d.ts +0 -5
- package/dist/types/eslint/rules/variables.d.ts +0 -8
- package/dist/types/eslint/withFiles.d.ts +0 -2
- package/dist/types/prettier/index.d.ts +0 -12
- package/dist/types/stylelint/_base.d.ts +0 -1
- package/dist/types/stylelint/index.d.ts +0 -2
- package/dist/types/stylelint/modules.d.ts +0 -2
- package/dist/types/stylelint/standard.d.ts +0 -1
- package/dist/types/stylelint/tailwind.d.ts +0 -2
- package/eslint/configs/browser.js +0 -27
- package/eslint/configs/cjs.js +0 -13
- package/eslint/configs/internal/base.js +0 -205
- package/eslint/configs/internal/commonjs.js +0 -22
- package/eslint/configs/internal/es2015.js +0 -72
- package/eslint/configs/internal/simple-import-sort.js +0 -27
- package/eslint/configs/internal/tsdoc.js +0 -20
- package/eslint/configs/internal/unicorn.js +0 -750
- package/eslint/configs/internal/utils/typescript.js +0 -53
- package/eslint/configs/next.js +0 -54
- package/eslint/configs/node.js +0 -27
- package/eslint/configs/playwright-test.js +0 -21
- package/eslint/configs/react.js +0 -114
- package/eslint/configs/typescript.js +0 -125
- package/eslint/constants.js +0 -27
- package/eslint/index.js +0 -33
- package/eslint/rules/best-practice.js +0 -256
- package/eslint/rules/imports.js +0 -94
- package/eslint/rules/jsx-a11y.js +0 -21
- package/eslint/rules/playwright-test.js +0 -27
- package/eslint/rules/possible-errors.js +0 -40
- package/eslint/rules/react-x.js +0 -78
- package/eslint/rules/react.js +0 -24
- package/eslint/rules/stylistic-jsx.js +0 -17
- package/eslint/rules/stylistic.js +0 -85
- package/eslint/rules/typescript/extension.js +0 -74
- package/eslint/rules/typescript/import.js +0 -23
- package/eslint/rules/typescript/index.js +0 -114
- package/eslint/rules/typescript/naming-convention.js +0 -121
- package/eslint/rules/variables.js +0 -36
- package/eslint/withFiles.js +0 -15
- package/prettier/index.js +0 -39
- package/readme.md +0 -415
- package/stylelint/_base.js +0 -45
- package/stylelint/modules.js +0 -32
- package/stylelint/standard.js +0 -4
- package/stylelint/tailwind.js +0 -16
- package/typescript/tsconfig.node18.json +0 -10
- /package/{typescript → dist/typescript}/tsconfig.base.json +0 -0
- /package/{typescript → dist/typescript}/tsconfig.bundler.json +0 -0
- /package/{typescript → dist/typescript}/tsconfig.node-ts.json +0 -0
- /package/{typescript → dist/typescript}/tsconfig.node.json +0 -0
- /package/{typescript → dist/typescript}/tsconfig.web.json +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Bo Lingen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# `@haltcase/style` · [](https://npmx.dev/package/@haltcase/style) [](https://npmx.dev/package/@haltcase/style) [](https://haltcase.dev/style)
|
|
2
|
+
|
|
3
|
+
> Style guide and configurations for tools in the web ecosystem.
|
|
4
|
+
|
|
5
|
+
- [Oxlint](#oxlint)
|
|
6
|
+
- [Oxfmt](#oxfmt)
|
|
7
|
+
- [TypeScript](#typescript)
|
|
8
|
+
- [Stylelint](#stylelint)
|
|
9
|
+
- [Vite+](#vite)
|
|
10
|
+
|
|
11
|
+
> [!NOTE]
|
|
12
|
+
>
|
|
13
|
+
> This package only provides configurations. To use them, you must also install relevant tools like
|
|
14
|
+
> Oxlint and Oxfmt (or Vite+ which includes both).
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Install `@haltcase/style` with your preferred package manager:
|
|
19
|
+
|
|
20
|
+
```shell
|
|
21
|
+
pnpm add --save-dev @haltcase/style
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This package enables rules that require Oxlint v1.73.0+. If you're using Vite+, you may need to add
|
|
25
|
+
an override to ensure the correct version of Oxlint is used. For example, with pnpm, add the
|
|
26
|
+
following to your `pnpm-workspace.yaml`:
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
overrides:
|
|
30
|
+
"vite-plus>oxlint": "^1.73.0"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Additionally, it uses ESLint `jsPlugins` that require TypeScript 6. If you otherwise use TypeScript
|
|
34
|
+
7, you'll need to configure package aliases to install
|
|
35
|
+
[TypeScript 7 and TypeScript 6 side by side](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0-rc/#running-side-by-side-with-typescript-6.0):
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"typescript": "npm:@typescript/typescript6@^6.0.0",
|
|
41
|
+
"typescript-7": "npm:typescript@rc"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
### Oxlint
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
// oxlint.config.ts
|
|
52
|
+
import createOxlintConfig from "@haltcase/style/oxlint";
|
|
53
|
+
|
|
54
|
+
export default createOxlintConfig({
|
|
55
|
+
node: true
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Then, run `pnpm oxlint`.
|
|
60
|
+
|
|
61
|
+
### Oxfmt
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
// oxfmt.config.ts
|
|
65
|
+
import createOxfmtConfig from "@haltcase/style/oxfmt";
|
|
66
|
+
|
|
67
|
+
export default createOxfmtConfig();
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Then, run `pnpm oxfmt`.
|
|
71
|
+
|
|
72
|
+
### Vite+
|
|
73
|
+
|
|
74
|
+
If you use Vite+, configure both Oxlint and Oxfmt in `vite.config.ts`:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
// vite.config.ts
|
|
78
|
+
import { defineConfig } from "vite-plus";
|
|
79
|
+
import { createOxfmtConfig, createOxlintConfig } from "@haltcase/style";
|
|
80
|
+
|
|
81
|
+
export default defineConfig({
|
|
82
|
+
fmt: createOxfmtConfig(),
|
|
83
|
+
lint: createOxlintConfig({
|
|
84
|
+
node: true,
|
|
85
|
+
react: true
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Then, run `vp check`.
|
|
91
|
+
|
|
92
|
+
### TypeScript
|
|
93
|
+
|
|
94
|
+
Several Typescript configs are available to cover various scenarios:
|
|
95
|
+
|
|
96
|
+
| Name | Description |
|
|
97
|
+
| ------------------------------------ | -------------------------------------------------------------------------------------------------------- |
|
|
98
|
+
| `@haltcase/style/typescript/base` | Baseline config, intended to be extended from. |
|
|
99
|
+
| `@haltcase/style/typescript/bundler` | For use in bundled projects, most commonly [Vite](https://vitejs.dev/) + [React](https://react.dev). |
|
|
100
|
+
| `@haltcase/style/typescript/next` | For use in [Next.js](https://nextjs.org/) projects. See the [Next.js](#nextjs) section for more details. |
|
|
101
|
+
| `@haltcase/style/typescript/node` | Default Node config, currently targeting Node 24. |
|
|
102
|
+
| `@haltcase/style/typescript/node-ts` | Addon for other Node configs for use with Node's built-in TypeScript support. |
|
|
103
|
+
| `@haltcase/style/typescript/node22` | For projects targeting Node 22. |
|
|
104
|
+
| `@haltcase/style/typescript/node24` | For projects targeting Node 24. |
|
|
105
|
+
| `@haltcase/style/typescript/web` | For use in web projects. |
|
|
106
|
+
|
|
107
|
+
Typically, you'll only need to extend from one of these:
|
|
108
|
+
|
|
109
|
+
```jsonc
|
|
110
|
+
// tsconfig.json
|
|
111
|
+
{
|
|
112
|
+
"extends": "@haltcase/style/typescript/node"
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
You can also combine them with an `extends` array:
|
|
117
|
+
|
|
118
|
+
```jsonc
|
|
119
|
+
// tsconfig.json
|
|
120
|
+
{
|
|
121
|
+
"extends": ["@haltcase/style/typescript/node", "@haltcase/style/typescript/web"]
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
> [!TIP]
|
|
126
|
+
>
|
|
127
|
+
> Run `tsc --showConfig` to see the result of the combined configs.
|
|
128
|
+
|
|
129
|
+
### Stylelint
|
|
130
|
+
|
|
131
|
+
To format and check CSS with Stylelint, install the `stylelint` package and set your configuration
|
|
132
|
+
to extend from `@haltcase/style/stylelint`.
|
|
133
|
+
|
|
134
|
+
> [!NOTE]
|
|
135
|
+
>
|
|
136
|
+
> Stylelint is a peer dependency you'll need to install at the root of your project.
|
|
137
|
+
>
|
|
138
|
+
> See: https://stylelint.io/user-guide/get-started
|
|
139
|
+
|
|
140
|
+
Add the following in `package.json`:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"stylelint": {
|
|
145
|
+
"extends": "@haltcase/style/stylelint"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
> [!TIP]
|
|
151
|
+
>
|
|
152
|
+
> See the [Stylelint documentation](https://stylelint.io/user-guide/configure) for other
|
|
153
|
+
> configuration options.
|
|
154
|
+
|
|
155
|
+
#### Stylelint configs
|
|
156
|
+
|
|
157
|
+
There are several configs you can extend from. The default config does not enforce a specific naming
|
|
158
|
+
convention for classes, IDs, etc. This is intended to allow flexibility between conventional CSS,
|
|
159
|
+
where `kebab-case` is standard, and CSS Modules or CSS-in-JS, where `camelCase` is more common.
|
|
160
|
+
|
|
161
|
+
There are alternate entry points if you would like to enforce a specific naming convention:
|
|
162
|
+
`standard` for kebab case and `modules` for camel case.
|
|
163
|
+
|
|
164
|
+
| Name | Description |
|
|
165
|
+
| ------------------------------------ | --------------------------------------------------- |
|
|
166
|
+
| `@haltcase/style/stylelint` | Do not enforce a naming convention for identifiers. |
|
|
167
|
+
| `@haltcase/style/stylelint/modules` | Enforce `camelCase` identifiers. |
|
|
168
|
+
| `@haltcase/style/stylelint/standard` | Enforce conventional `kebab-case` identifiers. |
|
|
169
|
+
|
|
170
|
+
##### Tailwind
|
|
171
|
+
|
|
172
|
+
If you use Tailwind, you can additionally extend from `@haltcase/style/stylelint/tailwind`:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"stylelint": {
|
|
177
|
+
"extends": ["@haltcase/style/stylelint", "@haltcase/style/stylelint/tailwind"]
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Specific workloads
|
|
183
|
+
|
|
184
|
+
#### Next.js
|
|
185
|
+
|
|
186
|
+
For Next.js projects, the `next` option defaults to `true` when the `next` package is detected.
|
|
187
|
+
However, you can set it manually:
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
// oxlint.config.ts
|
|
191
|
+
import createOxlintConfig from "@haltcase/style/oxlint";
|
|
192
|
+
|
|
193
|
+
export default createOxlintConfig({
|
|
194
|
+
next: true
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
See the [Oxlint section](#oxlint) for more details.
|
|
199
|
+
|
|
200
|
+
If you're using TypeScript, you can extend from the Next.js-specific config:
|
|
201
|
+
|
|
202
|
+
```jsonc
|
|
203
|
+
// tsconfig.json
|
|
204
|
+
{
|
|
205
|
+
"extends": "@haltcase/style/typescript/next"
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### TanStack Start and Router
|
|
210
|
+
|
|
211
|
+
For TanStack Start and Router projects, the `tanstackStart` and `tanstackRouter` options default to
|
|
212
|
+
`true` when the necessary packages are detected. However, you can set them manually:
|
|
213
|
+
|
|
214
|
+
```ts
|
|
215
|
+
// oxlint.config.ts
|
|
216
|
+
import createOxlintConfig from "@haltcase/style/oxlint";
|
|
217
|
+
|
|
218
|
+
export default createOxlintConfig({
|
|
219
|
+
// Defaults to true if `@tanstack/react-router` and `@tanstack/eslint-plugin-router` are installed.
|
|
220
|
+
tanstackRouter: true,
|
|
221
|
+
// Defaults to true if `tanstackRouter` packages and `@tanstack/react-start` are installed.
|
|
222
|
+
tanstackStart: true
|
|
223
|
+
});
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
See the [Oxlint section](#oxlint) for more details.
|
|
227
|
+
|
|
228
|
+
If you're using TypeScript, you can extend from the standard bundler config:
|
|
229
|
+
|
|
230
|
+
```jsonc
|
|
231
|
+
// tsconfig.json
|
|
232
|
+
{
|
|
233
|
+
"extends": "@haltcase/style/typescript/bundler"
|
|
234
|
+
}
|
|
235
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
charset = utf-8
|
|
5
|
+
end_of_line = lf
|
|
6
|
+
indent_style = tab
|
|
7
|
+
insert_final_newline = true
|
|
8
|
+
trim_trailing_whitespace = true
|
|
9
|
+
|
|
10
|
+
[*.md]
|
|
11
|
+
trim_trailing_whitespace = false
|
|
12
|
+
|
|
13
|
+
[*.{yaml,yml}]
|
|
14
|
+
indent_size = 2
|
|
15
|
+
indent_style = space
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
//#region src/editorconfig/index.ts
|
|
6
|
+
const getEditorconfig = () => readFileSync(new URL("../.editorconfig", import.meta.url), "utf8");
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getEditorconfig };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OxfmtConfig } from "oxfmt";
|
|
4
|
+
//#region src/oxfmt/index.d.ts
|
|
5
|
+
type OxfmtInputConfig = OxfmtConfig | ((defaults: OxfmtConfig) => OxfmtConfig);
|
|
6
|
+
declare const createOxfmtConfig: (options?: OxfmtInputConfig) => OxfmtConfig;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { OxfmtInputConfig, createOxfmtConfig };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { toMerged } from "es-toolkit";
|
|
5
|
+
import { isPackageExists } from "local-pkg";
|
|
6
|
+
//#region src/oxfmt/index.ts
|
|
7
|
+
const defaults = {
|
|
8
|
+
arrowParens: "always",
|
|
9
|
+
bracketSameLine: true,
|
|
10
|
+
bracketSpacing: true,
|
|
11
|
+
embeddedLanguageFormatting: "auto",
|
|
12
|
+
endOfLine: "lf",
|
|
13
|
+
htmlWhitespaceSensitivity: "css",
|
|
14
|
+
ignorePatterns: [
|
|
15
|
+
".agent/skills",
|
|
16
|
+
".changeset",
|
|
17
|
+
"pnpm-lock.yaml",
|
|
18
|
+
"yarn.lock",
|
|
19
|
+
"package-lock.json"
|
|
20
|
+
],
|
|
21
|
+
insertFinalNewline: true,
|
|
22
|
+
jsdoc: false,
|
|
23
|
+
jsxSingleQuote: false,
|
|
24
|
+
objectWrap: "preserve",
|
|
25
|
+
overrides: [],
|
|
26
|
+
printWidth: 100,
|
|
27
|
+
proseWrap: "always",
|
|
28
|
+
quoteProps: "as-needed",
|
|
29
|
+
semi: true,
|
|
30
|
+
singleAttributePerLine: false,
|
|
31
|
+
singleQuote: false,
|
|
32
|
+
sortImports: {},
|
|
33
|
+
sortPackageJson: { sortScripts: true },
|
|
34
|
+
sortTailwindcss: {
|
|
35
|
+
attributes: ["classNames"],
|
|
36
|
+
functions: [
|
|
37
|
+
"clsx",
|
|
38
|
+
"cn",
|
|
39
|
+
"cx",
|
|
40
|
+
"twMerge"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
svelte: false,
|
|
44
|
+
tabWidth: 2,
|
|
45
|
+
trailingComma: "none",
|
|
46
|
+
useTabs: true,
|
|
47
|
+
vueIndentScriptAndStyle: false
|
|
48
|
+
};
|
|
49
|
+
const createOxfmtConfig = (options = {}) => {
|
|
50
|
+
const defaultOptions = structuredClone(defaults);
|
|
51
|
+
if (isPackageExists("svelte")) defaultOptions.svelte = {};
|
|
52
|
+
if (isPackageExists("@tanstack/react-router")) defaultOptions.ignorePatterns.push("**/routeTree.gen.ts");
|
|
53
|
+
if (typeof options === "function") return options(defaultOptions);
|
|
54
|
+
return toMerged(defaultOptions, options);
|
|
55
|
+
};
|
|
56
|
+
//#endregion
|
|
57
|
+
export { createOxfmtConfig };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/oxlint/configs/base.d.ts
|
|
4
|
+
declare const baseConfig: {
|
|
5
|
+
categories: {
|
|
6
|
+
correctness: "error";
|
|
7
|
+
suspicious: "error";
|
|
8
|
+
pedantic: "error";
|
|
9
|
+
perf: "error";
|
|
10
|
+
restriction: "error";
|
|
11
|
+
style: "error";
|
|
12
|
+
};
|
|
13
|
+
overrides: ({
|
|
14
|
+
files: string[];
|
|
15
|
+
rules: {
|
|
16
|
+
"import/no-default-export": "off";
|
|
17
|
+
"unicorn/no-process-exit"?: undefined;
|
|
18
|
+
};
|
|
19
|
+
} | {
|
|
20
|
+
files: string[];
|
|
21
|
+
rules: {
|
|
22
|
+
"unicorn/no-process-exit": "off";
|
|
23
|
+
"import/no-default-export"?: undefined;
|
|
24
|
+
};
|
|
25
|
+
})[];
|
|
26
|
+
plugins: ("eslint" | "unicorn" | "oxc" | "import" | "jsdoc" | "promise")[];
|
|
27
|
+
rules: {
|
|
28
|
+
"no-label-var": "error";
|
|
29
|
+
"no-unused-vars": ["error", {
|
|
30
|
+
args: "after-used";
|
|
31
|
+
argsIgnorePattern: string;
|
|
32
|
+
ignoreRestSiblings: true;
|
|
33
|
+
vars: "all";
|
|
34
|
+
varsIgnorePattern: string;
|
|
35
|
+
}];
|
|
36
|
+
"node/no-process-env": "off";
|
|
37
|
+
"oxc/no-async-await": "off";
|
|
38
|
+
"oxc/no-rest-spread-properties": "off";
|
|
39
|
+
"oxc/no-optional-chaining": "off";
|
|
40
|
+
complexity: ["error", {
|
|
41
|
+
max: number;
|
|
42
|
+
variant: "modified";
|
|
43
|
+
}];
|
|
44
|
+
"no-await-in-loop": "off";
|
|
45
|
+
"no-continue": "off";
|
|
46
|
+
"no-eq-null": "off";
|
|
47
|
+
"no-plusplus": "off";
|
|
48
|
+
"no-ternary": "off";
|
|
49
|
+
"no-undefined": "off";
|
|
50
|
+
"no-void": "off";
|
|
51
|
+
"func-names": ["error", "as-needed"];
|
|
52
|
+
"id-length": ["error", {
|
|
53
|
+
min: number;
|
|
54
|
+
properties: "never";
|
|
55
|
+
exceptions: string[];
|
|
56
|
+
}];
|
|
57
|
+
"max-depth": ["error", {
|
|
58
|
+
max: number;
|
|
59
|
+
}];
|
|
60
|
+
"max-lines": ["error", {
|
|
61
|
+
max: number;
|
|
62
|
+
}];
|
|
63
|
+
"max-lines-per-function": ["error", {
|
|
64
|
+
max: number;
|
|
65
|
+
skipComments: true;
|
|
66
|
+
skipBlankLines: true;
|
|
67
|
+
}];
|
|
68
|
+
"max-params": ["error", {
|
|
69
|
+
countThis: "never";
|
|
70
|
+
max: number;
|
|
71
|
+
}];
|
|
72
|
+
"max-statements": ["error", {
|
|
73
|
+
max: number;
|
|
74
|
+
}];
|
|
75
|
+
"new-cap": ["error", {
|
|
76
|
+
capIsNew: false;
|
|
77
|
+
}];
|
|
78
|
+
"no-array-constructor": "error";
|
|
79
|
+
"no-bitwise": "error";
|
|
80
|
+
"no-duplicate-imports": ["error", {
|
|
81
|
+
allowSeparateTypeImports: true;
|
|
82
|
+
}];
|
|
83
|
+
"no-lonely-if": "error";
|
|
84
|
+
"no-multi-assign": ["error"];
|
|
85
|
+
"no-unneeded-ternary": "error";
|
|
86
|
+
"prefer-arrow-callback": ["error", {
|
|
87
|
+
allowNamedFunctions: true;
|
|
88
|
+
}];
|
|
89
|
+
"prefer-object-spread": "error";
|
|
90
|
+
"unicorn/max-nested-calls": ["error", {
|
|
91
|
+
max: number;
|
|
92
|
+
}];
|
|
93
|
+
"unicorn/no-nested-ternary": "error";
|
|
94
|
+
"capitalized-comments": "off";
|
|
95
|
+
"init-declarations": "off";
|
|
96
|
+
"no-inline-comments": "off";
|
|
97
|
+
"no-magic-numbers": "off";
|
|
98
|
+
"no-nested-ternary": "off";
|
|
99
|
+
"sort-imports": "off";
|
|
100
|
+
"sort-keys": "off";
|
|
101
|
+
"sort-vars": "off";
|
|
102
|
+
"promise/prefer-await-to-callbacks": "off";
|
|
103
|
+
"unicorn/import-style": "off";
|
|
104
|
+
"unicorn/no-null": "off";
|
|
105
|
+
"no-console": "error";
|
|
106
|
+
"no-constant-binary-expression": "error";
|
|
107
|
+
"no-promise-executor-return": "error";
|
|
108
|
+
"no-template-curly-in-string": "error";
|
|
109
|
+
"no-unreachable-loop": "error";
|
|
110
|
+
"import/first": "error";
|
|
111
|
+
"import/max-dependencies": ["error", {
|
|
112
|
+
ignoreTypeImports: true;
|
|
113
|
+
max: number;
|
|
114
|
+
}];
|
|
115
|
+
"import/newline-after-import": ["error", {
|
|
116
|
+
considerComments: true;
|
|
117
|
+
count: number;
|
|
118
|
+
exactCount: true;
|
|
119
|
+
}];
|
|
120
|
+
"import/no-absolute-path": "error";
|
|
121
|
+
"import/no-cycle": "error";
|
|
122
|
+
"import/no-default-export": "error";
|
|
123
|
+
"import/no-duplicates": ["error", {
|
|
124
|
+
considerQueryString: true;
|
|
125
|
+
}];
|
|
126
|
+
"import/no-mutable-exports": "error";
|
|
127
|
+
"import/no-unassigned-import": ["error", {
|
|
128
|
+
allow: string[];
|
|
129
|
+
}];
|
|
130
|
+
"import/no-self-import": "error";
|
|
131
|
+
"import/group-exports": "off";
|
|
132
|
+
"import/exports-last": "off";
|
|
133
|
+
"import/no-anonymous-default-export": "off";
|
|
134
|
+
"import/no-named-export": "off";
|
|
135
|
+
"import/no-nodejs-modules": "off";
|
|
136
|
+
"import/no-relative-parent-imports": "off";
|
|
137
|
+
"import/prefer-default-export": "off";
|
|
138
|
+
"array-callback-return": ["error", {
|
|
139
|
+
allowImplicit: true;
|
|
140
|
+
}];
|
|
141
|
+
"block-scoped-var": "error";
|
|
142
|
+
curly: ["error", "multi-line"];
|
|
143
|
+
"default-case-last": "error";
|
|
144
|
+
"default-param-last": "error";
|
|
145
|
+
eqeqeq: ["error", "always", {
|
|
146
|
+
null: "ignore";
|
|
147
|
+
}];
|
|
148
|
+
"grouped-accessor-pairs": "error";
|
|
149
|
+
"no-alert": "error";
|
|
150
|
+
"no-caller": "error";
|
|
151
|
+
"no-constructor-return": "error";
|
|
152
|
+
"no-else-return": "error";
|
|
153
|
+
"no-eval": "error";
|
|
154
|
+
"no-extend-native": "error";
|
|
155
|
+
"no-extra-bind": "error";
|
|
156
|
+
"no-extra-label": "error";
|
|
157
|
+
"no-implicit-coercion": "error";
|
|
158
|
+
"no-implied-eval": "error";
|
|
159
|
+
"no-iterator": "error";
|
|
160
|
+
"no-labels": "error";
|
|
161
|
+
"no-lone-blocks": "error";
|
|
162
|
+
"no-loop-func": "error";
|
|
163
|
+
"no-new": "error";
|
|
164
|
+
"no-new-func": "error";
|
|
165
|
+
"no-new-wrappers": "error";
|
|
166
|
+
"no-param-reassign": "error";
|
|
167
|
+
"no-proto": "error";
|
|
168
|
+
"no-return-assign": "error";
|
|
169
|
+
"no-script-url": "error";
|
|
170
|
+
"no-self-compare": "error";
|
|
171
|
+
"no-sequences": "error";
|
|
172
|
+
"no-shadow": "error";
|
|
173
|
+
"no-useless-call": "error";
|
|
174
|
+
"no-useless-concat": "error";
|
|
175
|
+
"no-useless-constructor": "error";
|
|
176
|
+
"no-useless-return": "error";
|
|
177
|
+
"node/no-sync": ["error", {
|
|
178
|
+
ignores: string[];
|
|
179
|
+
}];
|
|
180
|
+
"prefer-named-capture-group": "error";
|
|
181
|
+
"prefer-promise-reject-errors": ["error", {
|
|
182
|
+
allowEmptyReject: true;
|
|
183
|
+
}];
|
|
184
|
+
"prefer-regex-literals": "error";
|
|
185
|
+
yoda: "error";
|
|
186
|
+
"require-unicode-regexp": "off";
|
|
187
|
+
};
|
|
188
|
+
}[];
|
|
189
|
+
//#endregion
|
|
190
|
+
export { baseConfig };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { configFiles, scriptFiles, sharedCategoryConfig } from "../constants.js";
|
|
5
|
+
import { bestPracticeRules } from "../rules/best-practice.js";
|
|
6
|
+
import { importRules } from "../rules/imports.js";
|
|
7
|
+
import { possibleErrorsRules } from "../rules/possible-errors.js";
|
|
8
|
+
import { restrictionRules } from "../rules/restriction.js";
|
|
9
|
+
import { stylisticRules } from "../rules/stylistic.js";
|
|
10
|
+
import { variablesRules } from "../rules/variables.js";
|
|
11
|
+
//#region src/oxlint/configs/base.ts
|
|
12
|
+
const baseConfig = [{
|
|
13
|
+
categories: { ...sharedCategoryConfig },
|
|
14
|
+
overrides: [{
|
|
15
|
+
files: configFiles,
|
|
16
|
+
rules: { "import/no-default-export": "off" }
|
|
17
|
+
}, {
|
|
18
|
+
files: scriptFiles,
|
|
19
|
+
rules: { "unicorn/no-process-exit": "off" }
|
|
20
|
+
}],
|
|
21
|
+
plugins: [
|
|
22
|
+
"eslint",
|
|
23
|
+
"oxc",
|
|
24
|
+
"import",
|
|
25
|
+
"jsdoc",
|
|
26
|
+
"promise",
|
|
27
|
+
"unicorn"
|
|
28
|
+
],
|
|
29
|
+
rules: {
|
|
30
|
+
...bestPracticeRules,
|
|
31
|
+
...importRules,
|
|
32
|
+
...possibleErrorsRules,
|
|
33
|
+
...stylisticRules,
|
|
34
|
+
...restrictionRules,
|
|
35
|
+
...variablesRules
|
|
36
|
+
}
|
|
37
|
+
}];
|
|
38
|
+
//#endregion
|
|
39
|
+
export { baseConfig };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/oxlint/configs/next.d.ts
|
|
4
|
+
declare const nextConfig: {
|
|
5
|
+
plugins: "nextjs"[];
|
|
6
|
+
categories: {
|
|
7
|
+
correctness: "error";
|
|
8
|
+
suspicious: "error";
|
|
9
|
+
pedantic: "error";
|
|
10
|
+
perf: "error";
|
|
11
|
+
restriction: "error";
|
|
12
|
+
style: "error";
|
|
13
|
+
};
|
|
14
|
+
overrides: {
|
|
15
|
+
files: string[];
|
|
16
|
+
rules: {
|
|
17
|
+
"import-x/no-default-export": "off";
|
|
18
|
+
"react/only-export-components": ["error", {
|
|
19
|
+
allowExportNames: string[];
|
|
20
|
+
}];
|
|
21
|
+
};
|
|
22
|
+
}[];
|
|
23
|
+
}[];
|
|
24
|
+
//#endregion
|
|
25
|
+
export { nextConfig };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { nextJsApiRouteFiles, nextJsMetadataFiles, nextJsPageFiles, sharedCategoryConfig } from "../constants.js";
|
|
5
|
+
//#region src/oxlint/configs/next.ts
|
|
6
|
+
const nextConfig = [{
|
|
7
|
+
plugins: ["nextjs"],
|
|
8
|
+
categories: { ...sharedCategoryConfig },
|
|
9
|
+
overrides: [{
|
|
10
|
+
files: [
|
|
11
|
+
...nextJsApiRouteFiles,
|
|
12
|
+
...nextJsMetadataFiles,
|
|
13
|
+
...nextJsPageFiles
|
|
14
|
+
],
|
|
15
|
+
rules: {
|
|
16
|
+
"import-x/no-default-export": "off",
|
|
17
|
+
"react/only-export-components": ["error", { allowExportNames: [
|
|
18
|
+
"experimental_ppr",
|
|
19
|
+
"dynamic",
|
|
20
|
+
"dynamicParams",
|
|
21
|
+
"revalidate",
|
|
22
|
+
"fetchCache",
|
|
23
|
+
"runtime",
|
|
24
|
+
"preferredRegion",
|
|
25
|
+
"maxDuration",
|
|
26
|
+
"metadata",
|
|
27
|
+
"generateMetadata",
|
|
28
|
+
"viewport",
|
|
29
|
+
"generateViewport",
|
|
30
|
+
"generateImageMetadata",
|
|
31
|
+
"generateSitemaps",
|
|
32
|
+
"generateStaticParams"
|
|
33
|
+
] }]
|
|
34
|
+
}
|
|
35
|
+
}]
|
|
36
|
+
}];
|
|
37
|
+
//#endregion
|
|
38
|
+
export { nextConfig };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/oxlint/configs/node.d.ts
|
|
4
|
+
declare const nodeConfig: {
|
|
5
|
+
plugins: "node"[];
|
|
6
|
+
categories: {
|
|
7
|
+
correctness: "error";
|
|
8
|
+
suspicious: "error";
|
|
9
|
+
pedantic: "error";
|
|
10
|
+
perf: "error";
|
|
11
|
+
restriction: "error";
|
|
12
|
+
style: "error";
|
|
13
|
+
};
|
|
14
|
+
}[];
|
|
15
|
+
//#endregion
|
|
16
|
+
export { nodeConfig };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { sharedCategoryConfig } from "../constants.js";
|
|
5
|
+
//#region src/oxlint/configs/node.ts
|
|
6
|
+
const nodeConfig = [{
|
|
7
|
+
plugins: ["node"],
|
|
8
|
+
categories: { ...sharedCategoryConfig }
|
|
9
|
+
}];
|
|
10
|
+
//#endregion
|
|
11
|
+
export { nodeConfig };
|