@vef-framework-react/dev 2.4.4 → 2.6.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.
@@ -0,0 +1,53 @@
1
+ var n = /* @__PURE__ */ new Set([
2
+ "size",
3
+ "componentSize",
4
+ "gap"
5
+ ]), u = /* @__PURE__ */ new Set([
6
+ "TSAsExpression",
7
+ "TSSatisfiesExpression",
8
+ "TSTypeAssertion",
9
+ "TSNonNullExpression"
10
+ ]);
11
+ function s(t) {
12
+ return t ? u.has(t.type) ? s(t.expression) : t.type === "Literal" ? t.value === "middle" ? t : null : t.type === "TemplateLiteral" && t.expressions.length === 0 && t.quasis.length === 1 && t.quasis[0].value.cooked === "middle" ? t : null : null;
13
+ }
14
+ var p = {
15
+ create(t) {
16
+ function a(e, i) {
17
+ t.report({
18
+ node: e,
19
+ messageId: "useMedium",
20
+ data: { prop: i },
21
+ fix: (r) => r.replaceText(e, '"medium"')
22
+ });
23
+ }
24
+ return {
25
+ JSXAttribute(e) {
26
+ const i = e.name?.name;
27
+ if (typeof i != "string" || !n.has(i))
28
+ return;
29
+ const r = e.value?.type === "JSXExpressionContainer" ? e.value.expression : e.value, l = s(r);
30
+ l && a(l, i);
31
+ },
32
+ Property(e) {
33
+ if (e.computed)
34
+ return;
35
+ const i = e.key?.type === "Identifier" ? e.key.name : e.key?.type === "Literal" && typeof e.key.value == "string" ? e.key.value : null;
36
+ if (typeof i != "string" || !n.has(i))
37
+ return;
38
+ const r = s(e.value);
39
+ r && a(r, i);
40
+ }
41
+ };
42
+ },
43
+ meta: {
44
+ type: "problem",
45
+ docs: { description: 'Enforce "medium" instead of the legacy "middle" size token.' },
46
+ fixable: "code",
47
+ messages: { useMedium: 'Use "medium" instead of "middle" for `{{prop}}`.' },
48
+ schema: []
49
+ }
50
+ }, o = { rules: { "no-legacy-middle-size": p } };
51
+ export {
52
+ o as localPlugin
53
+ };
@@ -1,67 +1,10 @@
1
- import r from "stylelint-config-recess-order/groups";
2
- var n = [
3
- "px",
4
- "em",
5
- "rem",
6
- "%",
7
- "vw",
8
- "vh",
9
- "fr",
10
- "deg",
11
- "rad",
12
- "grad",
13
- "turn",
14
- "ms",
15
- "s"
16
- ], o = {
17
- "order/order": [
18
- "dollar-variables",
19
- "at-variables",
20
- "custom-properties",
21
- "less-mixins",
22
- "declarations",
23
- "at-rules",
24
- "rules"
25
- ],
26
- "order/properties-order": r.map((e) => ({
27
- ...e,
28
- emptyLineBefore: "never",
29
- noEmptyLineBetween: !0
30
- }))
31
- }, l = {
32
- "declaration-empty-line-before": "never",
33
- "declaration-property-value-no-unknown": [!0, { ignoreProperties: {} }]
34
- }, s = {
35
- "at-rule-no-unknown": null,
36
- "function-no-unknown": null,
37
- "scss/at-rule-no-unknown": [!0, { ignoreAtRules: ["extend", "include"] }],
38
- "scss/function-no-unknown": [!0, { ignoreFunctions: [] }]
39
- }, t = {
40
- "color-hex-alpha": "never",
41
- "color-hex-length": "long",
42
- "color-named": "never"
43
- }, u = { "selector-pseudo-class-no-unknown": [!0, { ignorePseudoClasses: ["global"] }] }, i = {
44
- "number-max-precision": null,
45
- "unit-allowed-list": n
46
- };
47
- function c() {
48
- return {
49
- extends: [
50
- "stylelint-config-recommended",
51
- "stylelint-config-standard-scss",
52
- "@stylistic/stylelint-config"
53
- ],
54
- plugins: ["stylelint-order"],
55
- rules: {
56
- ...o,
57
- ...l,
58
- ...s,
59
- ...t,
60
- ...u,
61
- ...i
62
- }
63
- };
1
+ import { defineStylelintConfig as n } from "@coldsmirk/stylelint-config";
2
+ function t(e = {}) {
3
+ return n({
4
+ scss: !0,
5
+ ...e
6
+ });
64
7
  }
65
8
  export {
66
- c as defineStylelintConfig
9
+ t as defineStylelintConfig
67
10
  };
@@ -0,0 +1,6 @@
1
+ import o from "@tanstack/eslint-plugin-query";
2
+ import r from "@tanstack/eslint-plugin-router";
3
+ var t = [...o.configs["flat/recommended"], ...r.configs["flat/recommended"]];
4
+ export {
5
+ t as tanstackConfig
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1 @@
1
- import { UserConfig } from '@commitlint/types';
2
- export declare function defineCommitlintConfig(): UserConfig;
1
+ export { defineCommitlintConfig } from '@coldsmirk/commitlint-config';
@@ -1,2 +1,10 @@
1
+ import { EslintConfigOptions } from '@coldsmirk/eslint-config';
1
2
  import { defineConfig } from 'eslint/config';
2
- export declare function defineEslintConfig(...args: Parameters<typeof defineConfig>): ReturnType<typeof defineConfig>;
3
+ /**
4
+ * The framework's ESLint flat config for applications: canon's sealed React baseline, the TanStack
5
+ * Query/Router rules, and the one project-specific rule canon doesn't ship —
6
+ * `local/no-legacy-middle-size`. React is on by default (framework applications are React) and
7
+ * generated files (`*.gen.ts`) are ignored. Consumers import this from `@vef-framework-react/dev`
8
+ * and `export default` it.
9
+ */
10
+ export declare function defineEslintConfig(options?: EslintConfigOptions): ReturnType<typeof defineConfig>;
@@ -0,0 +1,10 @@
1
+ import { Rule } from 'eslint';
2
+ /**
3
+ * Local ESLint plugin carrying the framework's project-specific rules, layered after canon's sealed
4
+ * config by the dev `defineEslintConfig`.
5
+ */
6
+ export declare const localPlugin: {
7
+ rules: {
8
+ "no-legacy-middle-size": Rule.RuleModule;
9
+ };
10
+ };
@@ -1,2 +1,8 @@
1
+ import { StylelintConfigOptions } from '@coldsmirk/stylelint-config';
1
2
  import { Config } from 'stylelint';
2
- export declare function defineStylelintConfig(): Config;
3
+ /**
4
+ * The framework's Stylelint config. canon covers it fully; the only framework default is SCSS on
5
+ * (canon defaults it off) since the framework's stylesheets are SCSS. Pass `{ scss: false }` for a
6
+ * plain-CSS project.
7
+ */
8
+ export declare function defineStylelintConfig(options?: StylelintConfigOptions): Config;
@@ -0,0 +1,7 @@
1
+ import { Linter } from 'eslint';
2
+ /**
3
+ * TanStack Query + Router lint rules (flat recommended). Not part of canon — layered on top for the
4
+ * framework itself and for applications, both of which are built on TanStack. Shared by the dev
5
+ * package's `defineEslintConfig` and the framework's own root config.
6
+ */
7
+ export declare const tanstackConfig: Linter.Config[];
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@vef-framework-react/dev",
3
- "type": "module",
4
- "version": "2.4.4",
3
+ "version": "2.6.0",
5
4
  "private": false,
6
5
  "description": "Dev tools for VEF framework",
7
- "author": {
8
- "name": "Venus",
9
- "email": "iweixiaopeng@163.com",
10
- "url": "https://github.com/ilxqx"
11
- },
12
- "license": "Apache-2.0",
13
- "homepage": "https://vef.ilxqx.com",
14
6
  "keywords": [
15
7
  "vef",
16
8
  "framework",
17
9
  "react",
18
10
  "dev"
19
11
  ],
12
+ "homepage": "https://vef.ilxqx.com",
13
+ "license": "Apache-2.0",
14
+ "author": {
15
+ "name": "Venus",
16
+ "email": "iweixiaopeng@163.com",
17
+ "url": "https://github.com/ilxqx"
18
+ },
20
19
  "sideEffects": false,
20
+ "type": "module",
21
21
  "exports": {
22
22
  ".": {
23
23
  "vef": "./src/index.ts",
@@ -25,11 +25,11 @@
25
25
  "import": "./dist/es/index.js",
26
26
  "require": "./dist/cjs/index.cjs"
27
27
  },
28
+ "./package.json": "./package.json",
29
+ "./tsconfig.json": "./tsconfig.base.json",
28
30
  "./types": {
29
31
  "types": "./types.d.ts"
30
- },
31
- "./tsconfig.json": "./tsconfig.base.json",
32
- "./package.json": "./package.json"
32
+ }
33
33
  },
34
34
  "main": "dist/cjs/index.cjs",
35
35
  "module": "dist/es/index.js",
@@ -42,63 +42,25 @@
42
42
  "tsconfig.base.json",
43
43
  "types.d.ts"
44
44
  ],
45
- "engines": {
46
- "node": ">=22.x"
47
- },
48
- "publishConfig": {
49
- "access": "public"
50
- },
51
- "peerDependencies": {
52
- "@commitlint/cli": "^21.0.0",
53
- "@stylistic/stylelint-config": "^5.0.0",
54
- "eslint": "^10.0.0",
55
- "husky": "^9.1.7",
56
- "lint-staged": "^17.0.0",
57
- "stylelint": "^17.0.0",
58
- "stylelint-config-recess-order": "^7.0.0",
59
- "stylelint-config-recommended": "^18.0.0",
60
- "stylelint-config-standard-scss": "^17.0.0",
61
- "stylelint-order": "^8.0.0",
62
- "vite": "^8.0.0"
63
- },
64
45
  "dependencies": {
65
46
  "@babel/core": "^7.29.7",
66
47
  "@babel/parser": "^7.29.7",
67
48
  "@babel/traverse": "^7.29.7",
68
- "@commitlint/config-conventional": "^21.0.2",
69
- "@commitlint/types": "^21.0.1",
49
+ "@coldsmirk/commitlint-config": "^0.3.0",
50
+ "@coldsmirk/eslint-config": "^0.3.0",
51
+ "@coldsmirk/stylelint-config": "^0.3.0",
70
52
  "@emotion/babel-plugin": "^11.13.5",
71
- "@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
72
- "@eslint-react/eslint-plugin": "^5.8.13",
73
- "@eslint-react/kit": "^5.8.13",
74
- "@eslint/js": "^10.0.1",
75
53
  "@rolldown/plugin-babel": "^0.2.3",
76
- "@stylistic/eslint-plugin": "^5.10.0",
77
54
  "@svgr/plugin-svgo": "^8.1.0",
78
55
  "@tanstack/eslint-plugin-query": "^5.101.0",
79
56
  "@tanstack/eslint-plugin-router": "^1.162.0",
80
57
  "@tanstack/router-plugin": "^1.168.18",
81
- "@typescript-eslint/utils": "^8.60.1",
82
58
  "@vitejs/plugin-react": "^6.0.2",
83
59
  "babel-plugin-react-compiler": "1.0.0",
84
60
  "chalk": "^5.6.2",
85
61
  "commander": "^15.0.0",
86
62
  "consola": "^3.4.2",
87
63
  "dotenv": "^17.4.2",
88
- "eslint-config-flat-gitignore": "^2.3.0",
89
- "eslint-plugin-antfu": "^3.2.2",
90
- "eslint-plugin-format": "^2.0.1",
91
- "eslint-plugin-import-lite": "^0.6.0",
92
- "eslint-plugin-jsdoc": "^63.0.2",
93
- "eslint-plugin-perfectionist": "^5.9.0",
94
- "eslint-plugin-react-dom": "^5.8.13",
95
- "eslint-plugin-react-hooks": "7.1.1",
96
- "eslint-plugin-react-jsx": "^5.8.13",
97
- "eslint-plugin-react-naming-convention": "^5.8.13",
98
- "eslint-plugin-react-web-api": "^5.8.13",
99
- "eslint-plugin-regexp": "^3.1.0",
100
- "eslint-plugin-unicorn": "^64.0.0",
101
- "eslint-plugin-unused-imports": "^4.4.1",
102
64
  "execa": "^9.6.1",
103
65
  "fs-extra": "^11.3.5",
104
66
  "html-minifier-terser": "^7.2.0",
@@ -109,7 +71,6 @@
109
71
  "radashi": "^12.9.0",
110
72
  "recast": "^0.23.11",
111
73
  "sass-embedded": "^1.100.0",
112
- "typescript-eslint": "^8.60.1",
113
74
  "unplugin-config": "^0.1.5",
114
75
  "unplugin-icons": "^23.0.1",
115
76
  "vite-plugin-eslint2": "^5.1.0",
@@ -119,24 +80,33 @@
119
80
  },
120
81
  "devDependencies": {
121
82
  "@commitlint/cli": "^21.0.2",
122
- "@stylistic/stylelint-config": "^5.0.0",
123
83
  "@types/html-minifier-terser": "^7.0.2",
124
84
  "@types/prompts": "^2.4.9",
125
85
  "eslint": "^10.4.1",
126
86
  "husky": "^9.1.7",
127
87
  "lint-staged": "^17.0.7",
128
88
  "stylelint": "^17.13.0",
129
- "stylelint-config-recess-order": "^7.7.0",
130
- "stylelint-config-recommended": "^18.0.0",
131
- "stylelint-config-standard-scss": "^17.0.0",
132
- "stylelint-order": "^8.1.1",
133
89
  "tsup": "^8.5.1",
134
90
  "type-fest": "^5.7.0",
135
91
  "vite": "^8.0.16"
136
92
  },
93
+ "peerDependencies": {
94
+ "@commitlint/cli": "^21.0.0",
95
+ "eslint": "^10.0.0",
96
+ "husky": "^9.1.7",
97
+ "lint-staged": "^17.0.0",
98
+ "stylelint": "^17.0.0",
99
+ "vite": "^8.0.0"
100
+ },
101
+ "engines": {
102
+ "node": ">=22.x"
103
+ },
104
+ "publishConfig": {
105
+ "access": "public"
106
+ },
137
107
  "scripts": {
108
+ "build": "vite build && tsup",
138
109
  "clean": "rimraf dist",
139
- "typecheck": "tsc --noEmit",
140
- "build": "vite build && tsup"
110
+ "typecheck": "tsc --noEmit"
141
111
  }
142
112
  }
package/types.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  // surrounding double-underscores follow the build-tool convention for
7
7
  // framework-injected names (akin to `__webpack_require__`); the lint exemption
8
8
  // reflects that, rather than introducing a casing exception elsewhere.
9
- /* eslint-disable @typescript-eslint/naming-convention */
9
+ /* eslint-disable @typescript-eslint/naming-convention -- Vite-injected globals use the double-underscore build-tool convention */
10
10
 
11
11
  /**
12
12
  * The version of the vef framework
@@ -21,4 +21,4 @@ declare const __VEF_APP_VERSION__: string;
21
21
  */
22
22
  declare const __VEF_APP_CONFIG__: Readonly<Record<string, string>>;
23
23
 
24
- /* eslint-enable @typescript-eslint/naming-convention */
24
+ /* eslint-enable @typescript-eslint/naming-convention -- end of the Vite-global declarations */
@@ -1 +0,0 @@
1
- const p=require("../_internal/_rolldown/runtime.cjs");let o=require("@eslint-react/kit");o=p.__toESM(o,1);function u(){return r=>({JSXAttribute(n){const{value:e}=n;e?.type==="JSXExpressionContainer"&&e.expression?.type==="Literal"&&e.expression.value===!0&&r.report({fix:i=>i.removeRange([n.name.range[1],e.range[1]]),message:"Use shorthand boolean attribute instead of `={true}`.",node:n})}})}function c(){return r=>({JSXElement(n){const e=n.openingElement;if(!e)return;const{name:i}=e;(i.type==="JSXIdentifier"&&i.name==="Fragment"||i.type==="JSXMemberExpression"&&i.object?.name==="React"&&i.property?.name==="Fragment")&&e.attributes.length===0&&r.report({message:"Use shorthand `<>...</>` instead of `<Fragment>...</Fragment>`.",node:n})}})}function f(){const r=new Set(["size","componentSize","gap"]);function n(e){return e?e.type==="TSAsExpression"||e.type==="TSSatisfiesExpression"||e.type==="TSTypeAssertion"||e.type==="TSNonNullExpression"?n(e.expression):e.type==="Literal"?e.value==="middle"?e:null:e.type==="TemplateLiteral"&&e.expressions.length===0&&e.quasis.length===1&&e.quasis[0].value.cooked==="middle"?e:null:null}return e=>{function i(t,s){e.report({fix:a=>a.replaceText(t,'"medium"'),message:`Use "medium" instead of "middle" for \`${s}\`.`,node:t})}return{JSXAttribute(t){const s=t.name?.name;if(typeof s!="string"||!r.has(s))return;const a=t.value?.type==="JSXExpressionContainer"?t.value.expression:t.value,l=n(a);l&&i(l,s)},Property(t){if(t.computed)return;const s=t.key?.type==="Identifier"?t.key.name:t.key?.type==="Literal"&&typeof t.key.value=="string"?t.key.value:null;if(typeof s!="string"||!r.has(s))return;const a=n(t.value);a&&i(a,s)}}}}function m(){return r=>({JSXText(n){if(!n.value.endsWith("$"))return;const{parent:e}=n;if(!e?.children)return;const i=e.children.indexOf(n);e.children[i+1]?.type==="JSXExpressionContainer"&&r.report({message:"Unexpected `$` before JSX expression. Use `{...}` instead of `${...}`.",node:n})}})}var g=(0,o.default)().use(u).use(c).use(m).use(f).getConfig();function y(r){return r!==null&&typeof r=="object"&&"type"in r&&r.type==="JSXOpeningElement"}var x={create(r){const e=(r.options[0]??{}).ignoreCase??!1;return{JSXOpeningElement(i){if(!y(i))return;const t={};for(const s of i.attributes){if(s.type==="JSXSpreadAttribute")continue;let{name:a}=s.name;if(typeof a=="string"){if(e&&(a=a.toLowerCase()),Object.hasOwn(t,a)){r.report({messageId:"noDuplicateProps",node:s});continue}t[a]=!0}}}}},meta:{docs:{description:"Disallow duplicate properties in JSX."},messages:{noDuplicateProps:"No duplicate props allowed."},schema:[{additionalProperties:!1,properties:{ignoreCase:{type:"boolean"}},type:"object"}],type:"problem"}},S={rules:{"jsx-no-duplicate-props":x}},h={"local-react/jsx-no-duplicate-props":"error"};exports.kitConfig=g;exports.localReactPlugin=S;exports.localReactRules=h;
@@ -1,118 +0,0 @@
1
- import p from "@eslint-react/kit";
2
- function l() {
3
- return (r) => ({ JSXAttribute(n) {
4
- const { value: e } = n;
5
- e?.type === "JSXExpressionContainer" && e.expression?.type === "Literal" && e.expression.value === !0 && r.report({
6
- fix: (i) => i.removeRange([n.name.range[1], e.range[1]]),
7
- message: "Use shorthand boolean attribute instead of `={true}`.",
8
- node: n
9
- });
10
- } });
11
- }
12
- function u() {
13
- return (r) => ({ JSXElement(n) {
14
- const e = n.openingElement;
15
- if (!e)
16
- return;
17
- const { name: i } = e;
18
- (i.type === "JSXIdentifier" && i.name === "Fragment" || i.type === "JSXMemberExpression" && i.object?.name === "React" && i.property?.name === "Fragment") && e.attributes.length === 0 && r.report({
19
- message: "Use shorthand `<>...</>` instead of `<Fragment>...</Fragment>`.",
20
- node: n
21
- });
22
- } });
23
- }
24
- function c() {
25
- const r = /* @__PURE__ */ new Set([
26
- "size",
27
- "componentSize",
28
- "gap"
29
- ]);
30
- function n(e) {
31
- return e ? e.type === "TSAsExpression" || e.type === "TSSatisfiesExpression" || e.type === "TSTypeAssertion" || e.type === "TSNonNullExpression" ? n(e.expression) : e.type === "Literal" ? e.value === "middle" ? e : null : e.type === "TemplateLiteral" && e.expressions.length === 0 && e.quasis.length === 1 && e.quasis[0].value.cooked === "middle" ? e : null : null;
32
- }
33
- return (e) => {
34
- function i(t, s) {
35
- e.report({
36
- fix: (a) => a.replaceText(t, '"medium"'),
37
- message: `Use "medium" instead of "middle" for \`${s}\`.`,
38
- node: t
39
- });
40
- }
41
- return {
42
- JSXAttribute(t) {
43
- const s = t.name?.name;
44
- if (typeof s != "string" || !r.has(s))
45
- return;
46
- const a = t.value?.type === "JSXExpressionContainer" ? t.value.expression : t.value, o = n(a);
47
- o && i(o, s);
48
- },
49
- Property(t) {
50
- if (t.computed)
51
- return;
52
- const s = t.key?.type === "Identifier" ? t.key.name : t.key?.type === "Literal" && typeof t.key.value == "string" ? t.key.value : null;
53
- if (typeof s != "string" || !r.has(s))
54
- return;
55
- const a = n(t.value);
56
- a && i(a, s);
57
- }
58
- };
59
- };
60
- }
61
- function f() {
62
- return (r) => ({ JSXText(n) {
63
- if (!n.value.endsWith("$"))
64
- return;
65
- const { parent: e } = n;
66
- if (!e?.children)
67
- return;
68
- const i = e.children.indexOf(n);
69
- e.children[i + 1]?.type === "JSXExpressionContainer" && r.report({
70
- message: "Unexpected `$` before JSX expression. Use `{...}` instead of `${...}`.",
71
- node: n
72
- });
73
- } });
74
- }
75
- var x = p().use(l).use(u).use(f).use(c).getConfig();
76
- function m(r) {
77
- return r !== null && typeof r == "object" && "type" in r && r.type === "JSXOpeningElement";
78
- }
79
- var g = {
80
- create(r) {
81
- const e = (r.options[0] ?? {}).ignoreCase ?? !1;
82
- return { JSXOpeningElement(i) {
83
- if (!m(i))
84
- return;
85
- const t = {};
86
- for (const s of i.attributes) {
87
- if (s.type === "JSXSpreadAttribute")
88
- continue;
89
- let { name: a } = s.name;
90
- if (typeof a == "string") {
91
- if (e && (a = a.toLowerCase()), Object.hasOwn(t, a)) {
92
- r.report({
93
- messageId: "noDuplicateProps",
94
- node: s
95
- });
96
- continue;
97
- }
98
- t[a] = !0;
99
- }
100
- }
101
- } };
102
- },
103
- meta: {
104
- docs: { description: "Disallow duplicate properties in JSX." },
105
- messages: { noDuplicateProps: "No duplicate props allowed." },
106
- schema: [{
107
- additionalProperties: !1,
108
- properties: { ignoreCase: { type: "boolean" } },
109
- type: "object"
110
- }],
111
- type: "problem"
112
- }
113
- }, S = { rules: { "jsx-no-duplicate-props": g } }, h = { "local-react/jsx-no-duplicate-props": "error" };
114
- export {
115
- x as kitConfig,
116
- S as localReactPlugin,
117
- h as localReactRules
118
- };
@@ -1,30 +0,0 @@
1
- import { Linter, Rule } from 'eslint';
2
- export declare const kitConfig: Linter.Config;
3
- export declare const localReactPlugin: {
4
- rules: {
5
- "jsx-no-duplicate-props": {
6
- create(context: Rule.RuleContext): {
7
- JSXOpeningElement(node: unknown): void;
8
- };
9
- meta: {
10
- docs: {
11
- description: string;
12
- };
13
- messages: {
14
- noDuplicateProps: string;
15
- };
16
- schema: {
17
- additionalProperties: false;
18
- properties: {
19
- ignoreCase: {
20
- type: "boolean";
21
- };
22
- };
23
- type: "object";
24
- }[];
25
- type: "problem";
26
- };
27
- };
28
- };
29
- };
30
- export declare const localReactRules: Linter.RulesRecord;