@subf/config 0.6.1 → 0.6.3
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 +0 -40
- package/dist/oxlint.d.mts +19 -1
- package/dist/oxlint.mjs +25 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,46 +22,6 @@ subf --type web # SolidJS apps
|
|
|
22
22
|
|
|
23
23
|
When `tsconfig.json` already exists, missing settings are added while existing settings are preserved. Use `--force` to overwrite generated settings. Legacy `@subf/config` entries in `extends` are removed automatically.
|
|
24
24
|
|
|
25
|
-
### `tsdown`
|
|
26
|
-
|
|
27
|
-
Helpers to create `tsdown` build configs.
|
|
28
|
-
|
|
29
|
-
Example: use `lib()` in your `tsdown.config.ts`:
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
import { lib } from '@subf/config/tsdown'
|
|
33
|
-
import { defineConfig } from 'tsdown'
|
|
34
|
-
|
|
35
|
-
export default lib({
|
|
36
|
-
entry: 'shallow',
|
|
37
|
-
excludeDeps: ['oxlint', 'oxfmt', 'tsdown'],
|
|
38
|
-
overrides: {
|
|
39
|
-
exports: {
|
|
40
|
-
customExports(exports) {
|
|
41
|
-
exports['./custom'] = './you-custom-file.js'
|
|
42
|
-
return exports
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
})
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
For Node builds use `nodeLib()`:
|
|
50
|
-
|
|
51
|
-
```ts
|
|
52
|
-
import { nodeLib } from '@subf/config/tsdown'
|
|
53
|
-
export default nodeLib({ entry: 'src/index.ts' })
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
For Solid builds (requires `vite-plugin-solid`) use `solidLib()`:
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
import { solidLib } from '@subf/config/tsdown'
|
|
60
|
-
import { defineConfig } from 'tsdown'
|
|
61
|
-
|
|
62
|
-
export default solidLib({ entry: 'src/index.tsx' })
|
|
63
|
-
```
|
|
64
|
-
|
|
65
25
|
### `oxfmt`
|
|
66
26
|
|
|
67
27
|
In `oxfmt.config.ts`:
|
package/dist/oxlint.d.mts
CHANGED
|
@@ -8,6 +8,24 @@ export declare const typeAware: OxlintConfig;
|
|
|
8
8
|
export declare const markdownOverrideConfig: OxlintOverride;
|
|
9
9
|
export declare const overrides: Array<OxlintOverride>;
|
|
10
10
|
export declare const CONFIG: OxlintConfig;
|
|
11
|
+
export type UnoCSSOption = {
|
|
12
|
+
/**
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
enable?: boolean;
|
|
16
|
+
order?: {
|
|
17
|
+
/**
|
|
18
|
+
* Package name
|
|
19
|
+
* @default '@subf/unocss/oxlint-plugin'
|
|
20
|
+
*/
|
|
21
|
+
package?: string;
|
|
22
|
+
/**
|
|
23
|
+
* @default ['cn', 'cva']
|
|
24
|
+
*/
|
|
25
|
+
unoFunctions?: Array<string>;
|
|
26
|
+
unoVariables?: Array<string>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
11
29
|
export declare const unocss: OxlintOverride;
|
|
12
30
|
export type SolidPreset = 'v1' | 'v2' | 'v2strict';
|
|
13
31
|
export interface SubfOptions extends OxlintConfig {
|
|
@@ -20,7 +38,7 @@ export interface SubfOptions extends OxlintConfig {
|
|
|
20
38
|
*/
|
|
21
39
|
solid?: boolean | SolidPreset;
|
|
22
40
|
typeAware?: boolean;
|
|
23
|
-
unocss?: boolean;
|
|
41
|
+
unocss?: boolean | UnoCSSOption;
|
|
24
42
|
}
|
|
25
43
|
export declare function subfLint(options?: SubfOptions): OxlintConfig;
|
|
26
44
|
export { CONFIG as default, FILES_TS_TSX, type OxlintConfig, type OxlintOverride, solid, solidV2, solidV2Strict };
|
package/dist/oxlint.mjs
CHANGED
|
@@ -124,7 +124,7 @@ const baseRules = {
|
|
|
124
124
|
"no-class-assign": "error",
|
|
125
125
|
"no-compare-neg-zero": "error",
|
|
126
126
|
"no-cond-assign": ["error", "except-parens"],
|
|
127
|
-
"no-console": "warn",
|
|
127
|
+
"no-console": ["warn", { allow: ["warn", "error"] }],
|
|
128
128
|
"no-const-assign": "error",
|
|
129
129
|
"no-control-regex": "error",
|
|
130
130
|
"no-debugger": "error",
|
|
@@ -330,7 +330,6 @@ const baseRules = {
|
|
|
330
330
|
"import/no-absolute-path": "error",
|
|
331
331
|
"import/no-cycle": "error",
|
|
332
332
|
"import/no-duplicates": "error",
|
|
333
|
-
"import/no-namespace": "error",
|
|
334
333
|
"import/no-self-import": "error",
|
|
335
334
|
"import/no-named-export": "allow",
|
|
336
335
|
"import/first": "error",
|
|
@@ -379,7 +378,7 @@ const ts = {
|
|
|
379
378
|
"no-use-before-define": ["error", {
|
|
380
379
|
classes: false,
|
|
381
380
|
functions: false,
|
|
382
|
-
variables:
|
|
381
|
+
variables: false
|
|
383
382
|
}],
|
|
384
383
|
"typescript/array-type": ["error", { default: "generic" }],
|
|
385
384
|
"typescript/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
|
|
@@ -387,7 +386,7 @@ const ts = {
|
|
|
387
386
|
"typescript/method-signature-style": ["error", "property"],
|
|
388
387
|
"typescript/no-confusing-non-null-assertion": "error",
|
|
389
388
|
"typescript/no-duplicate-enum-values": "error",
|
|
390
|
-
"typescript/no-empty-object-type": "error",
|
|
389
|
+
"typescript/no-empty-object-type": ["error", { allowInterfaces: "always" }],
|
|
391
390
|
"typescript/no-explicit-any": "error",
|
|
392
391
|
"typescript/no-extra-non-null-assertion": "error",
|
|
393
392
|
"typescript/no-misused-new": "error",
|
|
@@ -421,13 +420,7 @@ const ts = {
|
|
|
421
420
|
}
|
|
422
421
|
};
|
|
423
422
|
const vitest = {
|
|
424
|
-
files: [
|
|
425
|
-
"**/__tests__/**/*.?{js,ts,jsx,tsx}",
|
|
426
|
-
"**/*.spec.?{js,ts,jsx,tsx}",
|
|
427
|
-
"**/*.test.?{js,ts,jsx,tsx}",
|
|
428
|
-
"**/*.bench.?{js,ts,jsx,tsx}",
|
|
429
|
-
"**/*.benchmark.?{js,ts,jsx,tsx}"
|
|
430
|
-
],
|
|
423
|
+
files: ["**/__tests__/**/*.{js,ts,jsx,tsx}", "**/*.{spec,test,bench,benchmark}.{js,ts,jsx,tsx}"],
|
|
431
424
|
plugins: ["vitest"],
|
|
432
425
|
rules: {
|
|
433
426
|
"vitest/consistent-test-it": ["error", {
|
|
@@ -499,7 +492,7 @@ const typeAware = {
|
|
|
499
492
|
]
|
|
500
493
|
};
|
|
501
494
|
const markdownOverrideConfig = {
|
|
502
|
-
files: ["**/*.md
|
|
495
|
+
files: ["**/*.md/**/*.{js,ts,jsx,tsx}"],
|
|
503
496
|
rules: {
|
|
504
497
|
"no-alert": "off",
|
|
505
498
|
"no-labels": "off",
|
|
@@ -519,19 +512,25 @@ const CONFIG = {
|
|
|
519
512
|
...baseRules,
|
|
520
513
|
overrides
|
|
521
514
|
};
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
515
|
+
function getUnocssOverride(option = {}) {
|
|
516
|
+
return {
|
|
517
|
+
files: FILES_TS_TSX$1,
|
|
518
|
+
jsPlugins: [{
|
|
519
|
+
name: "uno",
|
|
520
|
+
specifier: option.package || "@subf/unocss/oxlint-plugin"
|
|
521
|
+
}],
|
|
522
|
+
rules: {
|
|
523
|
+
"uno/order": ["warn", {
|
|
524
|
+
unoFunctions: option?.unoFunctions || ["cn", "cva"],
|
|
525
|
+
unoVariables: option?.unoVariables
|
|
526
|
+
}],
|
|
527
|
+
"uno/blocklist": "error"
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
const unocss = getUnocssOverride();
|
|
533
532
|
function subfLint(options = {}) {
|
|
534
|
-
const { lib, unocss:
|
|
533
|
+
const { lib, unocss: unocssConfig, solid: enableSolid, typeAware: enableTypeAware, overrides, extends: userExtends, ...oxlint } = options;
|
|
535
534
|
const ovr = [];
|
|
536
535
|
let solidSettings;
|
|
537
536
|
if (lib) ovr.push({
|
|
@@ -547,7 +546,8 @@ function subfLint(options = {}) {
|
|
|
547
546
|
});
|
|
548
547
|
else ovr.push(ts);
|
|
549
548
|
ovr.push(vitest, markdownOverrideConfig);
|
|
550
|
-
if (
|
|
549
|
+
if (unocssConfig === true) ovr.push(unocss);
|
|
550
|
+
else if (typeof unocssConfig === "object" && unocssConfig.enable !== false) ovr.push(getUnocssOverride(unocssConfig.order));
|
|
551
551
|
if (enableSolid) {
|
|
552
552
|
const solidPreset = enableSolid === true ? "v2strict" : enableSolid;
|
|
553
553
|
if (solidPreset === "v1") ovr.push(solidConfig);
|