@subf/config 0.6.2 → 0.6.4

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 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
@@ -94,7 +94,10 @@ const baseRules = {
94
94
  name: "subf",
95
95
  specifier: "@subf/oxlint-plugin"
96
96
  }],
97
- categories: { correctness: "error" },
97
+ categories: {
98
+ correctness: "error",
99
+ perf: "warn"
100
+ },
98
101
  rules: {
99
102
  "subf/method-signature-style": "error",
100
103
  "subf/no-negated-conjunction": "error",
@@ -423,6 +426,7 @@ const vitest = {
423
426
  files: ["**/__tests__/**/*.{js,ts,jsx,tsx}", "**/*.{spec,test,bench,benchmark}.{js,ts,jsx,tsx}"],
424
427
  plugins: ["vitest"],
425
428
  rules: {
429
+ "unicorn/consistent-function-scoping": "off",
426
430
  "vitest/consistent-test-it": ["error", {
427
431
  fn: "it",
428
432
  withinDescribe: "it"
@@ -433,6 +437,7 @@ const vitest = {
433
437
  "vitest/prefer-lowercase-title": "error",
434
438
  "vitest/prefer-called-exactly-once-with": "warn",
435
439
  "vitest/require-awaited-expect-poll": "error",
440
+ "vitest/valid-expect": ["error", { maxArgs: 2 }],
436
441
  "no-unused-expressions": "off",
437
442
  "typescript/no-explicit-any": "off",
438
443
  "typescript/no-non-null-assertion": "off"
@@ -512,19 +517,25 @@ const CONFIG = {
512
517
  ...baseRules,
513
518
  overrides
514
519
  };
515
- const unocss = {
516
- files: FILES_TS_TSX$1,
517
- jsPlugins: [{
518
- name: "uno",
519
- specifier: "@subf/unocss/oxlint-plugin"
520
- }],
521
- rules: {
522
- "uno/order": ["warn", { unoFunctions: ["cn", "cva"] }],
523
- "uno/blocklist": "error"
524
- }
525
- };
520
+ function getUnocssOverride(option = {}) {
521
+ return {
522
+ files: FILES_TS_TSX$1,
523
+ jsPlugins: [{
524
+ name: "uno",
525
+ specifier: option.package || "@subf/unocss/oxlint-plugin"
526
+ }],
527
+ rules: {
528
+ "uno/order": ["warn", {
529
+ unoFunctions: option?.unoFunctions || ["cn", "cva"],
530
+ unoVariables: option?.unoVariables
531
+ }],
532
+ "uno/blocklist": "error"
533
+ }
534
+ };
535
+ }
536
+ const unocss = getUnocssOverride();
526
537
  function subfLint(options = {}) {
527
- const { lib, unocss: enableUnocss, solid: enableSolid, typeAware: enableTypeAware, overrides, extends: userExtends, ...oxlint } = options;
538
+ const { lib, unocss: unocssConfig, solid: enableSolid, typeAware: enableTypeAware, overrides, extends: userExtends, ...oxlint } = options;
528
539
  const ovr = [];
529
540
  let solidSettings;
530
541
  if (lib) ovr.push({
@@ -540,7 +551,8 @@ function subfLint(options = {}) {
540
551
  });
541
552
  else ovr.push(ts);
542
553
  ovr.push(vitest, markdownOverrideConfig);
543
- if (enableUnocss) ovr.push(unocss);
554
+ if (unocssConfig === true) ovr.push(unocss);
555
+ else if (typeof unocssConfig === "object" && unocssConfig.enable !== false) ovr.push(getUnocssOverride(unocssConfig.order));
544
556
  if (enableSolid) {
545
557
  const solidPreset = enableSolid === true ? "v2strict" : enableSolid;
546
558
  if (solidPreset === "v1") ovr.push(solidConfig);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subf/config",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "Universal configuration for TypeScript, oxlint (+unocss, +solid), oxfmt, and tsdown.",
5
5
  "keywords": [
6
6
  "config",