@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.
- package/LICENSE +190 -0
- package/README.md +69 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69 -0
- package/dist/published-language/decorators.d.ts +83 -0
- package/dist/published-language/decorators.d.ts.map +1 -0
- package/dist/published-language/decorators.js +130 -0
- package/package.json +44 -0
- package/src/published-language/default-extraction.config.json +153 -0
- package/src/published-language/eslint-plugin/api-controller-requires-route-and-method.cjs +85 -0
- package/src/published-language/eslint-plugin/api-controller-requires-route-and-method.d.cts +6 -0
- package/src/published-language/eslint-plugin/event-handler-requires-subscribed-events.cjs +47 -0
- package/src/published-language/eslint-plugin/event-handler-requires-subscribed-events.d.cts +6 -0
- package/src/published-language/eslint-plugin/event-publisher-method-signature.cjs +179 -0
- package/src/published-language/eslint-plugin/event-publisher-method-signature.d.cts +6 -0
- package/src/published-language/eslint-plugin/event-requires-type-property.cjs +47 -0
- package/src/published-language/eslint-plugin/event-requires-type-property.d.cts +6 -0
- package/src/published-language/eslint-plugin/http-call-requires-http-client-container.cjs +68 -0
- package/src/published-language/eslint-plugin/http-call-requires-http-client-container.d.cts +5 -0
- package/src/published-language/eslint-plugin/http-call-requires-route.cjs +104 -0
- package/src/published-language/eslint-plugin/http-call-requires-route.d.cts +5 -0
- package/src/published-language/eslint-plugin/http-client-public-methods-require-http-call.cjs +80 -0
- package/src/published-language/eslint-plugin/http-client-public-methods-require-http-call.d.cts +5 -0
- package/src/published-language/eslint-plugin/http-client-requires-remote-name.cjs +77 -0
- package/src/published-language/eslint-plugin/http-client-requires-remote-name.d.cts +5 -0
- package/src/published-language/eslint-plugin/index.cjs +64 -0
- package/src/published-language/eslint-plugin/index.d.ts +57 -0
- package/src/published-language/eslint-plugin/interface-ast-predicates.cjs +83 -0
- package/src/published-language/eslint-plugin/no-fetch-outside-http-client.cjs +60 -0
- package/src/published-language/eslint-plugin/no-fetch-outside-http-client.d.cts +5 -0
- package/src/published-language/eslint-plugin/require-component-decorator.cjs +56 -0
- package/src/published-language/eslint-plugin/require-component-decorator.d.cts +4 -0
- package/src/published-language/eslint-plugin/rule-module-declarations.d.ts +59 -0
- package/src/published-language/eslint-plugin/ui-page-requires-route.cjs +47 -0
- 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
|
+
}
|