@haltcase/style 8.0.0-canary.8 → 8.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/LICENSE +21 -0
- package/README.md +235 -0
- package/package.json +151 -172
- 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/index.js +0 -20
- package/stylelint/modules.js +0 -32
- package/stylelint/standard.js +0 -4
- package/stylelint/tailwind.js +0 -16
- package/typescript/tsconfig.base.json +0 -14
- package/typescript/tsconfig.bundler.json +0 -17
- package/typescript/tsconfig.next.json +0 -36
- package/typescript/tsconfig.node-ts.json +0 -10
- package/typescript/tsconfig.node.json +0 -4
- package/typescript/tsconfig.node18.json +0 -10
- package/typescript/tsconfig.node20.json +0 -11
- package/typescript/tsconfig.node22.json +0 -11
- package/typescript/tsconfig.node24.json +0 -17
- package/typescript/tsconfig.web.json +0 -8
package/readme.md
DELETED
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
# `@haltcase/style` · [](https://www.npmjs.com/package/@haltcase/style) [](https://www.npmjs.com/package/@haltcase/style) [](https://haltcase.dev/style)
|
|
2
|
-
|
|
3
|
-
> Style guide and configurations for tools in the web ecosystem.
|
|
4
|
-
|
|
5
|
-
- [Prettier](#prettier)
|
|
6
|
-
- [ESLint](#eslint)
|
|
7
|
-
- [TypeScript](#typescript)
|
|
8
|
-
- [Stylelint](#stylelint)
|
|
9
|
-
|
|
10
|
-
> This package originated from [Vercel's style guide](https://github.com/vercel/style-guide),
|
|
11
|
-
> but has since diverged in both architecture and rules.
|
|
12
|
-
|
|
13
|
-
## installation
|
|
14
|
-
|
|
15
|
-
Install `@haltcase/style` with your preferred package manager:
|
|
16
|
-
|
|
17
|
-
```sh
|
|
18
|
-
# pnpm
|
|
19
|
-
pnpm add --save-dev @haltcase/style
|
|
20
|
-
|
|
21
|
-
# npm
|
|
22
|
-
npm i --save-dev @haltcase/style
|
|
23
|
-
|
|
24
|
-
# yarn
|
|
25
|
-
yarn add --dev @haltcase/style
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
> [!NOTE]
|
|
29
|
-
> Some scenarios require additional peer dependencies.
|
|
30
|
-
> See the [Prettier](#prettier), [ESLint](#eslint), and [Stylelint](#stylelint) sections.
|
|
31
|
-
|
|
32
|
-
## usage
|
|
33
|
-
|
|
34
|
-
### Prettier
|
|
35
|
-
|
|
36
|
-
> [!NOTE]
|
|
37
|
-
> Prettier is a peer dependency you'll need to install
|
|
38
|
-
> at the root of your project.
|
|
39
|
-
>
|
|
40
|
-
> See: https://prettier.io/docs/en/install.html
|
|
41
|
-
|
|
42
|
-
Add the following in `package.json`:
|
|
43
|
-
|
|
44
|
-
```json
|
|
45
|
-
{
|
|
46
|
-
"prettier": "@haltcase/style/prettier"
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### ESLint
|
|
51
|
-
|
|
52
|
-
> [!NOTE]
|
|
53
|
-
> ESLint is a peer dependency you'll need to install
|
|
54
|
-
> at the root of your project.
|
|
55
|
-
>
|
|
56
|
-
> See: https://eslint.org/docs/user-guide/getting-started#installation-and-usage
|
|
57
|
-
|
|
58
|
-
> [!IMPORTANT]
|
|
59
|
-
> This config requires ESLint 9+ and the use of
|
|
60
|
-
> [flat config](https://eslint.org/docs/latest/extend/plugin-migration-flat-config).
|
|
61
|
-
|
|
62
|
-
At its simplest, your config might look like this for a general purpose
|
|
63
|
-
project:
|
|
64
|
-
|
|
65
|
-
```js
|
|
66
|
-
// eslint.config.js
|
|
67
|
-
import { getEslintConfig } from "@haltcase/style/eslint";
|
|
68
|
-
|
|
69
|
-
export default getEslintConfig();
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
TypeScript support is enabled by default by applying TypeScript-specific
|
|
73
|
-
configurations to files with TypeScript file extensions
|
|
74
|
-
(`ts`, `tsx`, `mts`, and `mtsx`). You may need to apply your own project-specific
|
|
75
|
-
configurations — see [Configuring ESLint for TypeScript](#configuring-eslint-for-typescript)
|
|
76
|
-
for details on how to do so.
|
|
77
|
-
|
|
78
|
-
#### ESLint customization
|
|
79
|
-
|
|
80
|
-
You can enable more rules for your project with configuration options:
|
|
81
|
-
|
|
82
|
-
```js
|
|
83
|
-
// eslint.config.js
|
|
84
|
-
import { getEslintConfig } from "@haltcase/style/eslint";
|
|
85
|
-
|
|
86
|
-
export default getEslintConfig({
|
|
87
|
-
// for browser environments
|
|
88
|
-
browser: true,
|
|
89
|
-
|
|
90
|
-
// treat *.js files as CommonJS instead of ES Modules
|
|
91
|
-
commonjs: true,
|
|
92
|
-
|
|
93
|
-
// for Next.js projects (implies `react`)
|
|
94
|
-
nextjs: true,
|
|
95
|
-
|
|
96
|
-
// for Node.js projects
|
|
97
|
-
node: true,
|
|
98
|
-
|
|
99
|
-
// for React
|
|
100
|
-
react: true
|
|
101
|
-
});
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
And, of course, you may include configs as any part of a larger one:
|
|
105
|
-
|
|
106
|
-
```js
|
|
107
|
-
// eslint.config.js
|
|
108
|
-
import { getEslintConfig } from "@haltcase/style/eslint";
|
|
109
|
-
|
|
110
|
-
export default [
|
|
111
|
-
...getEslintConfig({
|
|
112
|
-
nextjs: true
|
|
113
|
-
}),
|
|
114
|
-
|
|
115
|
-
{
|
|
116
|
-
name: "Customizations",
|
|
117
|
-
files: ["src/lib/**"],
|
|
118
|
-
rules: {
|
|
119
|
-
"no-unused-vars": "warn"
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
];
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
You can be more granular with your customizations by using the modular configs
|
|
126
|
-
also exported from `@haltcase/style/eslint`:
|
|
127
|
-
|
|
128
|
-
```js
|
|
129
|
-
// eslint.config.js
|
|
130
|
-
import {
|
|
131
|
-
getEslintBaseConfig,
|
|
132
|
-
getEslintBrowserConfig,
|
|
133
|
-
getEslintNodeConfig,
|
|
134
|
-
getEslintReactConfig,
|
|
135
|
-
withFiles
|
|
136
|
-
} from "@haltcase/style/eslint";
|
|
137
|
-
|
|
138
|
-
export default [
|
|
139
|
-
// use the base config for everything by default
|
|
140
|
-
...getEslintBaseConfig(),
|
|
141
|
-
|
|
142
|
-
// apply browser rules to some files
|
|
143
|
-
...getEslintBrowserConfig().map((config) => ({
|
|
144
|
-
...config,
|
|
145
|
-
files: ["src/client-only/**/*.js"]
|
|
146
|
-
})),
|
|
147
|
-
|
|
148
|
-
// apply React rules to some files
|
|
149
|
-
// (`withFiles` is equivalent to the above `map`)
|
|
150
|
-
...withFiles(getEslintReactConfig(), ["src/frontend/**/*.{ts,js,tsx,jsx}"]),
|
|
151
|
-
|
|
152
|
-
...withFiles(getEslintNodeConfig(), ["src/backend/**/*.{ts,js}"]),
|
|
153
|
-
|
|
154
|
-
{
|
|
155
|
-
name: "Customizations",
|
|
156
|
-
files: ["src/lib/**"],
|
|
157
|
-
rules: {
|
|
158
|
-
"no-unused-vars": "warn"
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
];
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
> [!TIP]
|
|
165
|
-
> See the ESLint documentation for more details on using configs:
|
|
166
|
-
> https://eslint.org/docs/latest/use/configure/combine-configs
|
|
167
|
-
|
|
168
|
-
#### Configuring ESLint for TypeScript
|
|
169
|
-
|
|
170
|
-
Some of the rules enabled in the TypeScript config require additional type
|
|
171
|
-
information. By default, this config will configure `parserOptions` with
|
|
172
|
-
[`project: true`](https://typescript-eslint.io/packages/parser/#project).
|
|
173
|
-
|
|
174
|
-
You can customize this behavior with the `typescriptProject` option:
|
|
175
|
-
|
|
176
|
-
```js
|
|
177
|
-
import { getEslintConfig } from "@haltcase/style/eslint";
|
|
178
|
-
|
|
179
|
-
export default [
|
|
180
|
-
...getEslintConfig({
|
|
181
|
-
typescriptProject: [
|
|
182
|
-
"./packages/**/tsconfig.json",
|
|
183
|
-
"./separate-package/tsconfig.json"
|
|
184
|
-
]
|
|
185
|
-
})
|
|
186
|
-
];
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
You can also enable TypeScript ESLint's
|
|
190
|
-
[`projectService`](https://typescript-eslint.io/packages/parser#projectservice):
|
|
191
|
-
|
|
192
|
-
```js
|
|
193
|
-
import { getEslintConfig } from "@haltcase/style/eslint";
|
|
194
|
-
|
|
195
|
-
export default [
|
|
196
|
-
...getEslintConfig({
|
|
197
|
-
typescriptProject: {
|
|
198
|
-
projectService: true
|
|
199
|
-
}
|
|
200
|
-
})
|
|
201
|
-
];
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
Because `eslint-import-resolver-typescript` [does not support
|
|
205
|
-
`projectService`](https://github.com/import-js/eslint-import-resolver-typescript/issues/282),
|
|
206
|
-
you should either:
|
|
207
|
-
|
|
208
|
-
1. Have a single `tsconfig.json` file in your root directory, including [project
|
|
209
|
-
references](https://www.typescriptlang.org/docs/handbook/project-references.html)
|
|
210
|
-
if necessary.
|
|
211
|
-
|
|
212
|
-
2. Explicitly pass your `tsconfig.json` paths:
|
|
213
|
-
|
|
214
|
-
```js
|
|
215
|
-
import { getEslintConfig } from "@haltcase/style/eslint";
|
|
216
|
-
|
|
217
|
-
export default [
|
|
218
|
-
...getEslintConfig({
|
|
219
|
-
typescriptProject: {
|
|
220
|
-
projectService: true,
|
|
221
|
-
tsconfigPaths: [
|
|
222
|
-
"./packages/**/tsconfig.json",
|
|
223
|
-
"./separate-package/tsconfig.json"
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
})
|
|
227
|
-
];
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
If you need to further customize the TypeScript behavior, use a separate config
|
|
231
|
-
with your own options, for example:
|
|
232
|
-
|
|
233
|
-
```js
|
|
234
|
-
import { getEslintConfig } from "@haltcase/style/eslint";
|
|
235
|
-
|
|
236
|
-
export default [
|
|
237
|
-
...getEslintConfig(),
|
|
238
|
-
|
|
239
|
-
{
|
|
240
|
-
files: ["*.{c,m,}ts{x,}"],
|
|
241
|
-
parserOptions: {
|
|
242
|
-
project: true,
|
|
243
|
-
tsConfigRootDir: "/custom/config/directory"
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
];
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
For more information, see: https://typescript-eslint.io/linting/typed-linting/
|
|
250
|
-
|
|
251
|
-
#### Configuring custom components for `jsx-a11y`
|
|
252
|
-
|
|
253
|
-
It's common practice for React apps to have shared components like `Button`
|
|
254
|
-
that wrap native elements. You can pass this information along to `jsx-a11y`
|
|
255
|
-
via the `components` setting.
|
|
256
|
-
|
|
257
|
-
The below list is not exhaustive.
|
|
258
|
-
|
|
259
|
-
```js
|
|
260
|
-
import { getEslintConfig } from "@haltcase/style/eslint";
|
|
261
|
-
|
|
262
|
-
export default [
|
|
263
|
-
getEslintConfig({
|
|
264
|
-
react: true
|
|
265
|
-
}),
|
|
266
|
-
|
|
267
|
-
{
|
|
268
|
-
settings: {
|
|
269
|
-
"jsx-a11y": {
|
|
270
|
-
components: {
|
|
271
|
-
Article: "article",
|
|
272
|
-
Button: "button",
|
|
273
|
-
Image: "img",
|
|
274
|
-
Input: "input",
|
|
275
|
-
Link: "a",
|
|
276
|
-
Video: "video"
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
];
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
##### A note on file extensions
|
|
285
|
-
|
|
286
|
-
By default, all TypeScript rules are scoped to files with extensions ending in
|
|
287
|
-
`ts` or `tsx`.
|
|
288
|
-
|
|
289
|
-
If you need to override configuration for TypeScript files, make sure to
|
|
290
|
-
specify the `files` property or ESLint will
|
|
291
|
-
[only target `*.js` files](https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-and-ignores).
|
|
292
|
-
|
|
293
|
-
```js
|
|
294
|
-
export default [
|
|
295
|
-
...getEslintConfig(),
|
|
296
|
-
|
|
297
|
-
{
|
|
298
|
-
// apply this config to js, ts, jsx, and tsx files
|
|
299
|
-
files: ["directory/**/*.[jt]s?(x)"],
|
|
300
|
-
rules: {
|
|
301
|
-
"my-rule": "off"
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
];
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
### TypeScript
|
|
308
|
-
|
|
309
|
-
Several Typescript configs are available to cover various scenarios:
|
|
310
|
-
|
|
311
|
-
| Name | Description |
|
|
312
|
-
| ------------------------------------ | ---------------------------------------------------------------------------------------------------- |
|
|
313
|
-
| `@haltcase/style/typescript/base` | Baseline config, intended to be extended from. |
|
|
314
|
-
| `@haltcase/style/typescript/bundler` | For use in bundled projects, most commonly [Vite](https://vitejs.dev/) + [React](https://react.dev). |
|
|
315
|
-
| `@haltcase/style/typescript/next` | For use in [Next.js](https://nextjs.org/) projects. |
|
|
316
|
-
| `@haltcase/style/typescript/node` | Default Node config, currently targeting Node 24. |
|
|
317
|
-
| `@haltcase/style/typescript/node-ts` | Addon for other Node configs for use with Node's built-in TypeScript support. |
|
|
318
|
-
| `@haltcase/style/typescript/node18` | For projects targeting Node 18. |
|
|
319
|
-
| `@haltcase/style/typescript/node20` | For projects targeting Node 20. |
|
|
320
|
-
| `@haltcase/style/typescript/node22` | For projects targeting Node 22. |
|
|
321
|
-
| `@haltcase/style/typescript/node24` | For projects targeting Node 24. |
|
|
322
|
-
| `@haltcase/style/typescript/web` | For use in web projects. |
|
|
323
|
-
|
|
324
|
-
Typically, you'll only need to extend from one of these:
|
|
325
|
-
|
|
326
|
-
```json
|
|
327
|
-
{
|
|
328
|
-
"extends": "@haltcase/style/typescript/next"
|
|
329
|
-
}
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
You could also combine them with an `extends` array in [Typescript 5+](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-rc/#supporting-multiple-configuration-files-in-extends):
|
|
333
|
-
|
|
334
|
-
```json
|
|
335
|
-
{
|
|
336
|
-
"extends": [
|
|
337
|
-
"@haltcase/style/typescript/node",
|
|
338
|
-
"@haltcase/style/typescript/web"
|
|
339
|
-
]
|
|
340
|
-
}
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
> [!TIP]
|
|
344
|
-
> Run `tsc --showConfig` to see the result of the combined configs.
|
|
345
|
-
|
|
346
|
-
#### TypeScript includes, excludes, and `paths` aliases
|
|
347
|
-
|
|
348
|
-
Some TypeScript configs set `include`, `exclude`, and `paths` for you with
|
|
349
|
-
common options. Currently:
|
|
350
|
-
|
|
351
|
-
| Name | Description |
|
|
352
|
-
| ------------------------------------ | --------------------------------------------------------------------------------- |
|
|
353
|
-
| `@haltcase/style/typescript/bundler` | Includes `@/*` → `src/*` path alias. |
|
|
354
|
-
| `@haltcase/style/typescript/next` | Includes `@/*` → `src/*` path alias and Next.js `include` and `exclude` settings. |
|
|
355
|
-
|
|
356
|
-
### Stylelint
|
|
357
|
-
|
|
358
|
-
To format and check CSS with Stylelint, install the `stylelint` package and
|
|
359
|
-
set your configuration to extend from `@haltcase/style/stylelint`.
|
|
360
|
-
|
|
361
|
-
> [!NOTE]
|
|
362
|
-
> Stylelint is a peer dependency you'll need to install
|
|
363
|
-
> at the root of your project.
|
|
364
|
-
>
|
|
365
|
-
> See: https://stylelint.io/user-guide/get-started
|
|
366
|
-
|
|
367
|
-
Add the following in `package.json`:
|
|
368
|
-
|
|
369
|
-
```json
|
|
370
|
-
{
|
|
371
|
-
"stylelint": {
|
|
372
|
-
"extends": "@haltcase/style/stylelint"
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
> [!TIP]
|
|
378
|
-
> See the [Stylelint documentation](https://stylelint.io/user-guide/configure)
|
|
379
|
-
> for other configuration options.
|
|
380
|
-
|
|
381
|
-
#### Stylelint configs
|
|
382
|
-
|
|
383
|
-
There are several configs you can extend from. The default config does not
|
|
384
|
-
enforce a specific naming convention for classes, IDs, etc. This is intended
|
|
385
|
-
to allow flexibility between conventional CSS, where `kebab-case` is standard,
|
|
386
|
-
and CSS Modules or CSS-in-JS, where `camelCase` is more common.
|
|
387
|
-
|
|
388
|
-
There are alternate entry points if you would like to enforce a specific naming
|
|
389
|
-
convention: `standard` for kebab case and `modules` for camel case.
|
|
390
|
-
|
|
391
|
-
| Name | Description |
|
|
392
|
-
| ------------------------------------ | --------------------------------------------------- |
|
|
393
|
-
| `@haltcase/style/stylelint` | Do not enforce a naming convention for identifiers. |
|
|
394
|
-
| `@haltcase/style/stylelint/modules` | Enforce `camelCase` identifiers. |
|
|
395
|
-
| `@haltcase/style/stylelint/standard` | Enforce conventional `kebab-case` identifiers. |
|
|
396
|
-
|
|
397
|
-
##### Tailwind
|
|
398
|
-
|
|
399
|
-
If you use Tailwind, you can additionally extend from `@haltcase/style/stylelint/tailwind`:
|
|
400
|
-
|
|
401
|
-
```json
|
|
402
|
-
{
|
|
403
|
-
"stylelint": {
|
|
404
|
-
"extends": [
|
|
405
|
-
"@haltcase/style/stylelint",
|
|
406
|
-
"@haltcase/style/stylelint/tailwind"
|
|
407
|
-
]
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
## contributing
|
|
413
|
-
|
|
414
|
-
Please read our [contributing](https://github.com/haltcase/style/blob/main/CONTRIBUTING.md)
|
|
415
|
-
guide before creating a pull request.
|
package/stylelint/_base.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import { defineConfig } from "stylelint-define-config";
|
|
4
|
-
|
|
5
|
-
export const stylelintBase = defineConfig({
|
|
6
|
-
extends: [
|
|
7
|
-
"stylelint-config-standard",
|
|
8
|
-
"stylelint-config-html",
|
|
9
|
-
"stylelint-config-clean-order"
|
|
10
|
-
],
|
|
11
|
-
rules: {
|
|
12
|
-
"at-rule-empty-line-before": [
|
|
13
|
-
"always",
|
|
14
|
-
{
|
|
15
|
-
except: ["blockless-after-same-name-blockless", "first-nested"],
|
|
16
|
-
ignore: ["after-comment"]
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"custom-property-empty-line-before": [
|
|
20
|
-
"always",
|
|
21
|
-
{
|
|
22
|
-
except: ["after-custom-property"],
|
|
23
|
-
ignore: ["after-comment", "first-nested", "inside-single-line-block"]
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
"declaration-empty-line-before": [
|
|
27
|
-
"always",
|
|
28
|
-
{
|
|
29
|
-
except: ["first-nested"],
|
|
30
|
-
ignore: [
|
|
31
|
-
"after-comment",
|
|
32
|
-
"after-declaration",
|
|
33
|
-
"inside-single-line-block"
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
],
|
|
37
|
-
"rule-empty-line-before": [
|
|
38
|
-
"always-multi-line",
|
|
39
|
-
{
|
|
40
|
-
except: ["first-nested"],
|
|
41
|
-
ignore: ["after-comment"]
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
});
|
package/stylelint/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
/* eslint-disable import-x/no-default-export */
|
|
3
|
-
|
|
4
|
-
import { defineConfig } from "stylelint-define-config";
|
|
5
|
-
|
|
6
|
-
import { stylelintBase } from "./_base.js";
|
|
7
|
-
|
|
8
|
-
export default defineConfig({
|
|
9
|
-
...stylelintBase,
|
|
10
|
-
|
|
11
|
-
rules: {
|
|
12
|
-
...stylelintBase.rules,
|
|
13
|
-
|
|
14
|
-
// disable identifier casing rules
|
|
15
|
-
"custom-media-pattern": null,
|
|
16
|
-
"custom-property-pattern": null,
|
|
17
|
-
"keyframes-name-pattern": null,
|
|
18
|
-
"selector-class-pattern": null
|
|
19
|
-
}
|
|
20
|
-
});
|
package/stylelint/modules.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
/* eslint-disable import-x/no-default-export */
|
|
3
|
-
|
|
4
|
-
import { defineConfig } from "stylelint-define-config";
|
|
5
|
-
|
|
6
|
-
import { stylelintBase } from "./_base.js";
|
|
7
|
-
|
|
8
|
-
const camelCaseRegex = /^[a-z][a-zA-Z0-9]+$/;
|
|
9
|
-
|
|
10
|
-
export default defineConfig({
|
|
11
|
-
...stylelintBase,
|
|
12
|
-
|
|
13
|
-
rules: {
|
|
14
|
-
...stylelintBase.rules,
|
|
15
|
-
|
|
16
|
-
"custom-media-pattern": camelCaseRegex,
|
|
17
|
-
|
|
18
|
-
// custom properties (variables) should still be kebab-case
|
|
19
|
-
// "custom-property-pattern": camelCaseRegex,
|
|
20
|
-
|
|
21
|
-
"keyframes-name-pattern": camelCaseRegex,
|
|
22
|
-
"selector-class-pattern": camelCaseRegex,
|
|
23
|
-
|
|
24
|
-
// allow the `:global` CSS Modules pseudo-class
|
|
25
|
-
"selector-pseudo-class-no-unknown": [
|
|
26
|
-
true,
|
|
27
|
-
{
|
|
28
|
-
ignorePseudoClasses: ["global"]
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
});
|
package/stylelint/standard.js
DELETED
package/stylelint/tailwind.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
/* eslint-disable import-x/no-default-export */
|
|
3
|
-
|
|
4
|
-
import { defineConfig } from "stylelint-define-config";
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
extends: "stylelint-config-tailwindcss",
|
|
8
|
-
rules: {
|
|
9
|
-
"at-rule-no-deprecated": [
|
|
10
|
-
true,
|
|
11
|
-
{
|
|
12
|
-
ignoreAtRules: ["apply"]
|
|
13
|
-
}
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"esModuleInterop": true,
|
|
5
|
-
"forceConsistentCasingInFileNames": true,
|
|
6
|
-
"incremental": true,
|
|
7
|
-
"isolatedModules": true,
|
|
8
|
-
"noFallthroughCasesInSwitch": true,
|
|
9
|
-
"noUncheckedIndexedAccess": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"strict": true,
|
|
12
|
-
"useDefineForClassFields": true
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"extends": "./tsconfig.base.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
6
|
-
"jsx": "react-jsx",
|
|
7
|
-
"module": "esnext",
|
|
8
|
-
"moduleResolution": "bundler",
|
|
9
|
-
"noEmit": true,
|
|
10
|
-
"allowImportingTsExtensions": true,
|
|
11
|
-
"resolveJsonModule": true,
|
|
12
|
-
"target": "es2020",
|
|
13
|
-
"paths": {
|
|
14
|
-
"@/*": ["${configDir}/src/*"]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"allowJs": true,
|
|
5
|
-
"esModuleInterop": true,
|
|
6
|
-
"forceConsistentCasingInFileNames": true,
|
|
7
|
-
"incremental": true,
|
|
8
|
-
"isolatedModules": true,
|
|
9
|
-
"jsx": "preserve",
|
|
10
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
11
|
-
"module": "esnext",
|
|
12
|
-
"moduleResolution": "bundler",
|
|
13
|
-
"noEmit": true,
|
|
14
|
-
"noFallthroughCasesInSwitch": true,
|
|
15
|
-
"noUncheckedIndexedAccess": true,
|
|
16
|
-
"resolveJsonModule": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
|
-
"strict": true,
|
|
19
|
-
"target": "ES2022",
|
|
20
|
-
"paths": {
|
|
21
|
-
"@/*": ["${configDir}/src/*"]
|
|
22
|
-
},
|
|
23
|
-
"plugins": [
|
|
24
|
-
{
|
|
25
|
-
"name": "next"
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
},
|
|
29
|
-
"include": [
|
|
30
|
-
"${configDir}/next-env.d.ts",
|
|
31
|
-
"${configDir}/**/*.ts",
|
|
32
|
-
"${configDir}/**/*.tsx",
|
|
33
|
-
"${configDir}/.next/types/**/*.ts"
|
|
34
|
-
],
|
|
35
|
-
"exclude": ["${configDir}/**/node_modules"]
|
|
36
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
// https://devblogs.microsoft.com/typescript/announcing-typescript-5-7/#path-rewriting-for-relative-paths
|
|
5
|
-
"rewriteRelativeImportExtensions": true,
|
|
6
|
-
// https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option
|
|
7
|
-
"erasableSyntaxOnly": true,
|
|
8
|
-
"verbatimModuleSyntax": true
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"extends": "./tsconfig.base.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"lib": ["es2023"],
|
|
6
|
-
// Use `"module": "node20"` when TypeScript 5.9+ is widely used
|
|
7
|
-
"module": "nodenext",
|
|
8
|
-
"target": "es2022",
|
|
9
|
-
"moduleResolution": "node16"
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"extends": "./tsconfig.base.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"lib": ["es2024", "ESNext.Array", "ESNext.Collection", "ESNext.Iterator"],
|
|
6
|
-
// Use `"module": "node20"` when TypeScript 5.9+ is widely used
|
|
7
|
-
"module": "nodenext",
|
|
8
|
-
"target": "es2022",
|
|
9
|
-
"moduleResolution": "node16"
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"extends": "./tsconfig.base.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"lib": [
|
|
6
|
-
"es2024",
|
|
7
|
-
"ESNext.Array",
|
|
8
|
-
"ESNext.Collection",
|
|
9
|
-
"ESNext.Iterator",
|
|
10
|
-
"ESNext.Promise"
|
|
11
|
-
],
|
|
12
|
-
// Use `"module": "node20"` when TypeScript 5.9+ is widely used
|
|
13
|
-
"module": "nodenext",
|
|
14
|
-
"target": "es2024",
|
|
15
|
-
"moduleResolution": "node16"
|
|
16
|
-
}
|
|
17
|
-
}
|