@bleedingdev/modern-js-code-tools 3.5.0-ultramodern.9 → 3.5.0-ultramodern.91

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.
Files changed (49) hide show
  1. package/dist/cjs/cli/i18n-check.cjs +0 -6
  2. package/dist/cjs/cli/workspace-source-check.cjs +0 -3
  3. package/dist/cjs/oxlint-plugin/ast.cjs +181 -0
  4. package/dist/cjs/oxlint-plugin/options.cjs +172 -0
  5. package/dist/cjs/oxlint-plugin/rules/no-hardcoded-jsx-text.cjs +82 -0
  6. package/dist/cjs/oxlint-plugin/rules/no-legacy-mf-boundary-attributes.cjs +61 -0
  7. package/dist/cjs/oxlint-plugin/rules/no-literal-visible-jsx-attributes.cjs +74 -0
  8. package/dist/cjs/oxlint-plugin/rules/no-manual-locale-copy-branching.cjs +80 -0
  9. package/dist/cjs/oxlint-plugin/rules/no-split-translation-keys.cjs +70 -0
  10. package/dist/cjs/oxlint-plugin/rules/strict-effect-api-boundaries.cjs +84 -0
  11. package/dist/cjs/oxlint-plugin/types.cjs +18 -0
  12. package/dist/cjs/oxlint-plugin.cjs +100 -382
  13. package/dist/esm/cli/i18n-check.js +1 -1
  14. package/dist/esm/cli/workspace-source-check.js +1 -1
  15. package/dist/esm/oxlint-plugin/ast.js +83 -0
  16. package/dist/esm/oxlint-plugin/options.js +89 -0
  17. package/dist/esm/oxlint-plugin/rules/no-hardcoded-jsx-text.js +44 -0
  18. package/dist/esm/oxlint-plugin/rules/no-legacy-mf-boundary-attributes.js +23 -0
  19. package/dist/esm/oxlint-plugin/rules/no-literal-visible-jsx-attributes.js +36 -0
  20. package/dist/esm/oxlint-plugin/rules/no-manual-locale-copy-branching.js +42 -0
  21. package/dist/esm/oxlint-plugin/rules/no-split-translation-keys.js +32 -0
  22. package/dist/esm/oxlint-plugin/rules/strict-effect-api-boundaries.js +46 -0
  23. package/dist/esm/oxlint-plugin/types.js +0 -0
  24. package/dist/esm/oxlint-plugin.js +15 -367
  25. package/dist/esm-node/cli/i18n-check.js +1 -1
  26. package/dist/esm-node/cli/workspace-source-check.js +1 -1
  27. package/dist/esm-node/oxlint-plugin/ast.js +84 -0
  28. package/dist/esm-node/oxlint-plugin/options.js +90 -0
  29. package/dist/esm-node/oxlint-plugin/rules/no-hardcoded-jsx-text.js +45 -0
  30. package/dist/esm-node/oxlint-plugin/rules/no-legacy-mf-boundary-attributes.js +24 -0
  31. package/dist/esm-node/oxlint-plugin/rules/no-literal-visible-jsx-attributes.js +37 -0
  32. package/dist/esm-node/oxlint-plugin/rules/no-manual-locale-copy-branching.js +43 -0
  33. package/dist/esm-node/oxlint-plugin/rules/no-split-translation-keys.js +33 -0
  34. package/dist/esm-node/oxlint-plugin/rules/strict-effect-api-boundaries.js +47 -0
  35. package/dist/esm-node/oxlint-plugin/types.js +1 -0
  36. package/dist/esm-node/oxlint-plugin.js +15 -367
  37. package/dist/types/cli/i18n-check.d.ts +0 -2
  38. package/dist/types/cli/workspace-source-check.d.ts +0 -1
  39. package/dist/types/oxlint-plugin/ast.d.ts +22 -0
  40. package/dist/types/oxlint-plugin/options.d.ts +62 -0
  41. package/dist/types/oxlint-plugin/rules/no-hardcoded-jsx-text.d.ts +2 -0
  42. package/dist/types/oxlint-plugin/rules/no-legacy-mf-boundary-attributes.d.ts +2 -0
  43. package/dist/types/oxlint-plugin/rules/no-literal-visible-jsx-attributes.d.ts +2 -0
  44. package/dist/types/oxlint-plugin/rules/no-manual-locale-copy-branching.d.ts +2 -0
  45. package/dist/types/oxlint-plugin/rules/no-split-translation-keys.d.ts +2 -0
  46. package/dist/types/oxlint-plugin/rules/strict-effect-api-boundaries.d.ts +2 -0
  47. package/dist/types/oxlint-plugin/types.d.ts +60 -0
  48. package/dist/types/oxlint-plugin.d.ts +15 -56
  49. package/package.json +6 -7
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ createNoManualLocaleCopyBranchingRule: ()=>createNoManualLocaleCopyBranchingRule
32
+ });
33
+ const external_ast_cjs_namespaceObject = require("../ast.cjs");
34
+ const looksLikeLocaleTest = (context, node)=>{
35
+ const text = (0, external_ast_cjs_namespaceObject.getSourceText)(context, node);
36
+ return /\b(?:language|locale|lng|currentLanguage)\b/u.test(text) && /(?:={2,3}|!==?|\.\s*startsWith\s*\()/u.test(text) && /['"][a-z]{2}(?:-[A-Za-z0-9]+)?['"]/u.test(text);
37
+ };
38
+ const isAllowedBranchLiteral = (text)=>new Set([
39
+ 'page',
40
+ 'undefined',
41
+ 'null',
42
+ 'true',
43
+ 'false'
44
+ ]).has(text);
45
+ const createNoManualLocaleCopyBranchingRule = ()=>({
46
+ meta: {
47
+ type: 'problem',
48
+ docs: {
49
+ description: 'Disallow manual locale conditionals that choose user-visible copy.'
50
+ },
51
+ schema: []
52
+ },
53
+ create (context) {
54
+ const reportBranch = (node, text)=>{
55
+ context.report({
56
+ node,
57
+ message: `Move locale-specific copy branch to i18n resources: ${JSON.stringify(normalizeVisibleText(text))}`
58
+ });
59
+ };
60
+ return {
61
+ ConditionalExpression (node) {
62
+ if (!node.test || !looksLikeLocaleTest(context, node.test)) return;
63
+ for (const branch of [
64
+ node.consequent,
65
+ node.alternate
66
+ ]){
67
+ const text = expressionStringValue(branch);
68
+ if (text && hasLetters(text) && !isAllowedBranchLiteral(text.trim())) reportBranch(branch, text);
69
+ }
70
+ }
71
+ };
72
+ }
73
+ });
74
+ exports.createNoManualLocaleCopyBranchingRule = __webpack_exports__.createNoManualLocaleCopyBranchingRule;
75
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
76
+ "createNoManualLocaleCopyBranchingRule"
77
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
78
+ Object.defineProperty(exports, '__esModule', {
79
+ value: true
80
+ });
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ createNoSplitTranslationKeysRule: ()=>createNoSplitTranslationKeysRule
32
+ });
33
+ const external_ast_cjs_namespaceObject = require("../ast.cjs");
34
+ const external_options_cjs_namespaceObject = require("../options.cjs");
35
+ const createNoSplitTranslationKeysRule = ()=>({
36
+ meta: {
37
+ type: 'problem',
38
+ docs: {
39
+ description: 'Disallow split phrase translation key suffixes such as .prefix and .suffix.'
40
+ },
41
+ schema: [
42
+ external_options_cjs_namespaceObject.translationOptionsSchema
43
+ ]
44
+ },
45
+ create (context) {
46
+ const options = (0, external_options_cjs_namespaceObject.getSplitTranslationKeyRuleOption)(context, {
47
+ translationFunctions: external_options_cjs_namespaceObject.DEFAULT_TRANSLATION_FUNCTIONS
48
+ });
49
+ const translationFunctions = new Set(options.translationFunctions);
50
+ return {
51
+ CallExpression (node) {
52
+ const calleeName = (0, external_ast_cjs_namespaceObject.getCallExpressionName)(node.callee);
53
+ if (!calleeName || !translationFunctions.has(calleeName)) return;
54
+ const key = (0, external_ast_cjs_namespaceObject.expressionStringValue)(node.arguments?.[0]);
55
+ if (!key || !external_options_cjs_namespaceObject.SPLIT_TRANSLATION_KEY_PATTERN.test(key)) return;
56
+ context.report({
57
+ node,
58
+ message: 'Keep translator-owned phrases whole instead of using split translation keys.'
59
+ });
60
+ }
61
+ };
62
+ }
63
+ });
64
+ exports.createNoSplitTranslationKeysRule = __webpack_exports__.createNoSplitTranslationKeysRule;
65
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
66
+ "createNoSplitTranslationKeysRule"
67
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
68
+ Object.defineProperty(exports, '__esModule', {
69
+ value: true
70
+ });
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ createStrictEffectApiBoundariesRule: ()=>createStrictEffectApiBoundariesRule
32
+ });
33
+ const external_ast_cjs_namespaceObject = require("../ast.cjs");
34
+ const createStrictEffectApiBoundariesRule = ()=>({
35
+ meta: {
36
+ type: 'problem',
37
+ docs: {
38
+ description: 'Disallow raw HTTP handlers and non-Effect API runtime drift in UltraModern workspaces.'
39
+ },
40
+ schema: []
41
+ },
42
+ create (context) {
43
+ return {
44
+ Program (node) {
45
+ const source = (0, external_ast_cjs_namespaceObject.getSourceText)(context, node);
46
+ const filename = (0, external_ast_cjs_namespaceObject.normalizeFilename)(context.filename);
47
+ const apiFile = (0, external_ast_cjs_namespaceObject.isApiSourceFile)(filename);
48
+ if ((0, external_ast_cjs_namespaceObject.isForbiddenGeneratedEffectPath)(filename)) context.report({
49
+ node,
50
+ message: 'Generated UltraModern workspaces use direct api/index.ts, shared/api.ts and src/api/* paths; api/effect, api/lambda, shared/effect and src/effect are forbidden.'
51
+ });
52
+ (0, external_ast_cjs_namespaceObject.reportProgramPattern)(context, node, source, /@modern-js\/plugin-bff\/hono-server/u, 'UltraModern API workspaces must not import Hono server helpers; use @modern-js/plugin-bff/effect-edge and HttpApi.');
53
+ (0, external_ast_cjs_namespaceObject.reportProgramPattern)(context, node, source, /\bruntimeFramework\s*(?::|=)\s*['"]hono['"]/u, 'UltraModern API apps must use bff.runtimeFramework: "effect".');
54
+ (0, external_ast_cjs_namespaceObject.reportProgramPattern)(context, node, source, /(?:from|import)\s*['"][^'"]*(?:api\/effect|shared\/effect)[^'"]*['"]|shared-effect-api/u, 'Import API code from direct api/index.ts, shared/api.ts or src/api/* paths, not api/effect, shared/effect or shared Effect API packages.');
55
+ (0, external_ast_cjs_namespaceObject.reportProgramPattern)(context, node, source, /\bstrictEffectApproach\s*(?::|=)\s*false\b/u, 'UltraModern API apps must keep strictEffectApproach enabled.');
56
+ if ((0, external_ast_cjs_namespaceObject.isApiEntryFile)(filename)) {
57
+ (0, external_ast_cjs_namespaceObject.reportMissingProgramPattern)(context, node, source, /\bdefineEffectBff\b/u, 'Generated API entries must export defineEffectBff(...).');
58
+ (0, external_ast_cjs_namespaceObject.reportMissingProgramPattern)(context, node, source, /\bHttpApiBuilder\b/u, 'Generated API entries must implement handlers through HttpApiBuilder.');
59
+ (0, external_ast_cjs_namespaceObject.reportMissingProgramPattern)(context, node, source, /\bLayer\b/u, 'Generated API entries must compose dependencies with Effect Layer.');
60
+ (0, external_ast_cjs_namespaceObject.reportMissingProgramPattern)(context, node, source, /from\s+['"]\.\.\/shared\/api\.ts['"]/u, 'Generated API entries must import the contract from ../shared/api.ts.');
61
+ }
62
+ if ((0, external_ast_cjs_namespaceObject.isSharedApiContractFile)(filename)) {
63
+ (0, external_ast_cjs_namespaceObject.reportMissingProgramPattern)(context, node, source, /\bHttpApi\.make\b/u, 'Generated shared API contracts must declare an HttpApi contract.');
64
+ (0, external_ast_cjs_namespaceObject.reportMissingProgramPattern)(context, node, source, /\bHttpApiGroup\.make\b/u, 'Generated shared API contracts must declare HttpApi groups.');
65
+ (0, external_ast_cjs_namespaceObject.reportMissingProgramPattern)(context, node, source, /\bHttpApiEndpoint\./u, 'Generated shared API contracts must declare endpoints through HttpApiEndpoint.');
66
+ (0, external_ast_cjs_namespaceObject.reportMissingProgramPattern)(context, node, source, /\bSchema\./u, 'Generated shared API contracts must model request, response and error shapes with Schema.');
67
+ }
68
+ if (!apiFile) return;
69
+ (0, external_ast_cjs_namespaceObject.reportProgramPattern)(context, node, source, /\bnew\s+Response\s*\(|\bResponse\.json\s*\(/u, 'API modules must not hand-build Response objects; model endpoints through Effect HttpApi and schemas.');
70
+ (0, external_ast_cjs_namespaceObject.reportProgramPattern)(context, node, source, /\b(?:request|req)\.(?:json|text|formData|arrayBuffer)\s*\(/u, 'API modules must not manually parse request bodies; use HttpApiEndpoint payload/query/params schemas.');
71
+ (0, external_ast_cjs_namespaceObject.reportProgramPattern)(context, node, source, /\bexport\s+const\s+handler\b|\bexport\s+default\s+async\b/u, 'API modules must not export raw request handlers; export defineEffectBff(...) from api/index.ts.');
72
+ (0, external_ast_cjs_namespaceObject.reportProgramPattern)(context, node, source, /\bcreateHandler\s*[:=]\s*(?!defineEffectBff\b)/u, 'API modules must not define unbranded handler factories; use defineEffectBff(...).');
73
+ (0, external_ast_cjs_namespaceObject.reportProgramPattern)(context, node, source, /\bSchema\.(?:UnknownFromJsonString|Unknown|Any)\b/u, 'API modules must use concrete request, response and error schemas; Schema.UnknownFromJsonString, Schema.Unknown and Schema.Any are forbidden in UltraModern API code.');
74
+ }
75
+ };
76
+ }
77
+ });
78
+ exports.createStrictEffectApiBoundariesRule = __webpack_exports__.createStrictEffectApiBoundariesRule;
79
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
80
+ "createStrictEffectApiBoundariesRule"
81
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
82
+ Object.defineProperty(exports, '__esModule', {
83
+ value: true
84
+ });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.r = (exports1)=>{
5
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
6
+ value: 'Module'
7
+ });
8
+ Object.defineProperty(exports1, '__esModule', {
9
+ value: true
10
+ });
11
+ };
12
+ })();
13
+ var __webpack_exports__ = {};
14
+ __webpack_require__.r(__webpack_exports__);
15
+ for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
16
+ Object.defineProperty(exports, '__esModule', {
17
+ value: true
18
+ });