@living-architecture/riviere-extract-conventions-published-language 0.7.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.
Files changed (36) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +69 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +69 -0
  6. package/dist/published-language/decorators.d.ts +83 -0
  7. package/dist/published-language/decorators.d.ts.map +1 -0
  8. package/dist/published-language/decorators.js +130 -0
  9. package/package.json +44 -0
  10. package/src/published-language/default-extraction.config.json +153 -0
  11. package/src/published-language/eslint-plugin/api-controller-requires-route-and-method.cjs +85 -0
  12. package/src/published-language/eslint-plugin/api-controller-requires-route-and-method.d.cts +6 -0
  13. package/src/published-language/eslint-plugin/event-handler-requires-subscribed-events.cjs +47 -0
  14. package/src/published-language/eslint-plugin/event-handler-requires-subscribed-events.d.cts +6 -0
  15. package/src/published-language/eslint-plugin/event-publisher-method-signature.cjs +179 -0
  16. package/src/published-language/eslint-plugin/event-publisher-method-signature.d.cts +6 -0
  17. package/src/published-language/eslint-plugin/event-requires-type-property.cjs +47 -0
  18. package/src/published-language/eslint-plugin/event-requires-type-property.d.cts +6 -0
  19. package/src/published-language/eslint-plugin/http-call-requires-http-client-container.cjs +68 -0
  20. package/src/published-language/eslint-plugin/http-call-requires-http-client-container.d.cts +5 -0
  21. package/src/published-language/eslint-plugin/http-call-requires-route.cjs +104 -0
  22. package/src/published-language/eslint-plugin/http-call-requires-route.d.cts +5 -0
  23. package/src/published-language/eslint-plugin/http-client-public-methods-require-http-call.cjs +80 -0
  24. package/src/published-language/eslint-plugin/http-client-public-methods-require-http-call.d.cts +5 -0
  25. package/src/published-language/eslint-plugin/http-client-requires-remote-name.cjs +77 -0
  26. package/src/published-language/eslint-plugin/http-client-requires-remote-name.d.cts +5 -0
  27. package/src/published-language/eslint-plugin/index.cjs +64 -0
  28. package/src/published-language/eslint-plugin/index.d.ts +57 -0
  29. package/src/published-language/eslint-plugin/interface-ast-predicates.cjs +83 -0
  30. package/src/published-language/eslint-plugin/no-fetch-outside-http-client.cjs +60 -0
  31. package/src/published-language/eslint-plugin/no-fetch-outside-http-client.d.cts +5 -0
  32. package/src/published-language/eslint-plugin/require-component-decorator.cjs +56 -0
  33. package/src/published-language/eslint-plugin/require-component-decorator.d.cts +4 -0
  34. package/src/published-language/eslint-plugin/rule-module-declarations.d.ts +59 -0
  35. package/src/published-language/eslint-plugin/ui-page-requires-route.cjs +47 -0
  36. package/src/published-language/eslint-plugin/ui-page-requires-route.d.cts +6 -0
@@ -0,0 +1,47 @@
1
+ const {
2
+ hasDecorator,
3
+ findInstanceProperty,
4
+ hasStringLiteralValue,
5
+ getValueTypeDescription,
6
+ } = require('./interface-ast-predicates.cjs')
7
+
8
+ module.exports = {
9
+ meta: {
10
+ type: 'problem',
11
+ docs: { description: 'Require @UI classes to have route property with literal value' },
12
+ schema: [],
13
+ messages: {
14
+ missingRoute: "Class '{{className}}' decorated with @UI but is missing 'route' property",
15
+ routeNotLiteral: "Class '{{className}}' has 'route' property but value must be a string literal, not {{actualType}}",
16
+ },
17
+ },
18
+ create(context) {
19
+ return {
20
+ ClassDeclaration(node) {
21
+ /* v8 ignore next -- ClassDeclaration always has id (name) */
22
+ if (!node.id) return
23
+ if (!hasDecorator(node, 'UI')) return
24
+
25
+ const className = node.id.name
26
+ const routeProperty = findInstanceProperty(node, 'route')
27
+
28
+ if (!routeProperty) {
29
+ context.report({
30
+ node: node.id,
31
+ messageId: 'missingRoute',
32
+ data: { className },
33
+ })
34
+ } else if (!hasStringLiteralValue(routeProperty)) {
35
+ context.report({
36
+ node: routeProperty,
37
+ messageId: 'routeNotLiteral',
38
+ data: {
39
+ className,
40
+ actualType: getValueTypeDescription(routeProperty),
41
+ },
42
+ })
43
+ }
44
+ },
45
+ }
46
+ },
47
+ }
@@ -0,0 +1,6 @@
1
+ import type { TSESLint } from '@typescript-eslint/utils'
2
+
3
+ type MessageIds = 'missingRoute' | 'routeNotLiteral'
4
+
5
+ declare const rule: TSESLint.RuleModule<MessageIds>
6
+ export default rule