@futdevpro/dynamo-eslint 1.15.7 → 1.15.8
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/.dynamo/version-bump.config.json +5 -0
- package/.github/workflows/main.yml +424 -395
- package/.husky/pre-commit +1 -0
- package/__documentations/2026-04-18-ccap-review-integration.md +173 -0
- package/build/configs/base.js +20 -1
- package/build/configs/base.js.map +1 -1
- package/build/configs/ngx.js +10 -0
- package/build/configs/ngx.js.map +1 -1
- package/build/plugin/index.d.ts +21 -0
- package/build/plugin/index.d.ts.map +1 -1
- package/build/plugin/index.js +38 -0
- package/build/plugin/index.js.map +1 -1
- package/build/plugin/rules/angular/angular-for-track-logic.d.ts +8 -0
- package/build/plugin/rules/angular/angular-for-track-logic.d.ts.map +1 -0
- package/build/plugin/rules/angular/angular-for-track-logic.js +82 -0
- package/build/plugin/rules/angular/angular-for-track-logic.js.map +1 -0
- package/build/plugin/rules/angular/effect-signal-loop.d.ts +10 -0
- package/build/plugin/rules/angular/effect-signal-loop.d.ts.map +1 -0
- package/build/plugin/rules/angular/effect-signal-loop.js +113 -0
- package/build/plugin/rules/angular/effect-signal-loop.js.map +1 -0
- package/build/plugin/rules/angular/no-async-ngoninit.d.ts +9 -0
- package/build/plugin/rules/angular/no-async-ngoninit.d.ts.map +1 -0
- package/build/plugin/rules/angular/no-async-ngoninit.js +43 -0
- package/build/plugin/rules/angular/no-async-ngoninit.js.map +1 -0
- package/build/plugin/rules/angular/no-component-direct-api.d.ts +10 -0
- package/build/plugin/rules/angular/no-component-direct-api.d.ts.map +1 -0
- package/build/plugin/rules/angular/no-component-direct-api.js +76 -0
- package/build/plugin/rules/angular/no-component-direct-api.js.map +1 -0
- package/build/plugin/rules/angular/no-method-call-in-template.d.ts +9 -0
- package/build/plugin/rules/angular/no-method-call-in-template.d.ts.map +1 -0
- package/build/plugin/rules/angular/no-method-call-in-template.js +80 -0
- package/build/plugin/rules/angular/no-method-call-in-template.js.map +1 -0
- package/build/plugin/rules/angular/no-ngfor-directive.d.ts +8 -0
- package/build/plugin/rules/angular/no-ngfor-directive.d.ts.map +1 -0
- package/build/plugin/rules/angular/no-ngfor-directive.js +60 -0
- package/build/plugin/rules/angular/no-ngfor-directive.js.map +1 -0
- package/build/plugin/rules/angular/no-ngif-directive.d.ts +8 -0
- package/build/plugin/rules/angular/no-ngif-directive.d.ts.map +1 -0
- package/build/plugin/rules/angular/no-ngif-directive.js +60 -0
- package/build/plugin/rules/angular/no-ngif-directive.js.map +1 -0
- package/build/plugin/rules/naming-patterns.d.ts +4 -0
- package/build/plugin/rules/naming-patterns.d.ts.map +1 -1
- package/build/plugin/rules/naming-patterns.js +331 -8
- package/build/plugin/rules/naming-patterns.js.map +1 -1
- package/build/plugin/rules/no-getter-logic.d.ts.map +1 -1
- package/build/plugin/rules/no-getter-logic.js +21 -2
- package/build/plugin/rules/no-getter-logic.js.map +1 -1
- package/build/plugin/rules/require-jsdoc-description.d.ts.map +1 -1
- package/build/plugin/rules/require-jsdoc-description.js +17 -0
- package/build/plugin/rules/require-jsdoc-description.js.map +1 -1
- package/build/plugin/rules/ts/data-model-extends.d.ts +9 -0
- package/build/plugin/rules/ts/data-model-extends.d.ts.map +1 -0
- package/build/plugin/rules/ts/data-model-extends.js +95 -0
- package/build/plugin/rules/ts/data-model-extends.js.map +1 -0
- package/build/plugin/rules/ts/no-any-type.d.ts +9 -0
- package/build/plugin/rules/ts/no-any-type.d.ts.map +1 -0
- package/build/plugin/rules/ts/no-any-type.js +37 -0
- package/build/plugin/rules/ts/no-any-type.js.map +1 -0
- package/build/plugin/rules/ts/no-as-cast.d.ts +9 -0
- package/build/plugin/rules/ts/no-as-cast.d.ts.map +1 -0
- package/build/plugin/rules/ts/no-as-cast.js +50 -0
- package/build/plugin/rules/ts/no-as-cast.js.map +1 -0
- package/build/plugin/rules/ts/no-dynamic-imports.d.ts +9 -0
- package/build/plugin/rules/ts/no-dynamic-imports.d.ts.map +1 -0
- package/build/plugin/rules/ts/no-dynamic-imports.js +51 -0
- package/build/plugin/rules/ts/no-dynamic-imports.js.map +1 -0
- package/build/plugin/rules/ts/no-native-browser-dialogs.d.ts +9 -0
- package/build/plugin/rules/ts/no-native-browser-dialogs.d.ts.map +1 -0
- package/build/plugin/rules/ts/no-native-browser-dialogs.js +79 -0
- package/build/plugin/rules/ts/no-native-browser-dialogs.js.map +1 -0
- package/build/plugin/rules/ts/no-plain-function-export.d.ts +10 -0
- package/build/plugin/rules/ts/no-plain-function-export.d.ts.map +1 -0
- package/build/plugin/rules/ts/no-plain-function-export.js +70 -0
- package/build/plugin/rules/ts/no-plain-function-export.js.map +1 -0
- package/build/plugin/rules/ts/one-export-per-file.d.ts +9 -0
- package/build/plugin/rules/ts/one-export-per-file.d.ts.map +1 -0
- package/build/plugin/rules/ts/one-export-per-file.js +74 -0
- package/build/plugin/rules/ts/one-export-per-file.js.map +1 -0
- package/package.json +5 -8
- package/pipeline.cicd.config.json +152 -0
- package/src/configs/base.ts +21 -1
- package/src/configs/ngx.ts +12 -0
- package/src/plugin/index.ts +44 -3
- package/src/plugin/rules/angular/angular-for-track-logic.spec.ts +44 -0
- package/src/plugin/rules/angular/angular-for-track-logic.ts +88 -0
- package/src/plugin/rules/angular/effect-signal-loop.spec.ts +89 -0
- package/src/plugin/rules/angular/effect-signal-loop.ts +125 -0
- package/src/plugin/rules/angular/no-async-ngoninit.spec.ts +50 -0
- package/src/plugin/rules/angular/no-async-ngoninit.ts +43 -0
- package/src/plugin/rules/angular/no-component-direct-api.spec.ts +78 -0
- package/src/plugin/rules/angular/no-component-direct-api.ts +82 -0
- package/src/plugin/rules/angular/no-method-call-in-template.spec.ts +63 -0
- package/src/plugin/rules/angular/no-method-call-in-template.ts +89 -0
- package/src/plugin/rules/angular/no-ngfor-directive.spec.ts +44 -0
- package/src/plugin/rules/angular/no-ngfor-directive.ts +62 -0
- package/src/plugin/rules/angular/no-ngif-directive.spec.ts +44 -0
- package/src/plugin/rules/angular/no-ngif-directive.ts +62 -0
- package/src/plugin/rules/naming-patterns.spec.ts +108 -22
- package/src/plugin/rules/naming-patterns.ts +390 -11
- package/src/plugin/rules/no-getter-logic.spec.ts +71 -0
- package/src/plugin/rules/no-getter-logic.ts +21 -2
- package/src/plugin/rules/require-jsdoc-description.spec.ts +1 -0
- package/src/plugin/rules/require-jsdoc-description.ts +19 -0
- package/src/plugin/rules/ts/data-model-extends.spec.ts +84 -0
- package/src/plugin/rules/ts/data-model-extends.ts +100 -0
- package/src/plugin/rules/ts/no-any-type.spec.ts +28 -0
- package/src/plugin/rules/ts/no-any-type.ts +36 -0
- package/src/plugin/rules/ts/no-as-cast.spec.ts +51 -0
- package/src/plugin/rules/ts/no-as-cast.ts +51 -0
- package/src/plugin/rules/ts/no-dynamic-imports.spec.ts +54 -0
- package/src/plugin/rules/ts/no-dynamic-imports.ts +49 -0
- package/src/plugin/rules/ts/no-native-browser-dialogs.spec.ts +54 -0
- package/src/plugin/rules/ts/no-native-browser-dialogs.ts +84 -0
- package/src/plugin/rules/ts/no-plain-function-export.spec.ts +72 -0
- package/src/plugin/rules/ts/no-plain-function-export.ts +73 -0
- package/src/plugin/rules/ts/one-export-per-file.spec.ts +64 -0
- package/src/plugin/rules/ts/one-export-per-file.ts +77 -0
- package/futdevpro-dynamo-eslint-1.15.7.tgz +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Dynamo-ESLint CI/CD Pipeline",
|
|
3
|
+
"outputDir": "./logs/cicd-pipeline",
|
|
4
|
+
"timing": {
|
|
5
|
+
"stepTimeout": "10m",
|
|
6
|
+
"teeMaxRuntime": "10m",
|
|
7
|
+
"stepCooldown": "1s"
|
|
8
|
+
},
|
|
9
|
+
"log": {
|
|
10
|
+
"runtimeMaxBytes": 5242880,
|
|
11
|
+
"trimCheckEveryN": 1000
|
|
12
|
+
},
|
|
13
|
+
"versionBump": {
|
|
14
|
+
"enabled": false
|
|
15
|
+
},
|
|
16
|
+
"report": {
|
|
17
|
+
"fileName": "cicd-report.json",
|
|
18
|
+
"includeLogTail": true,
|
|
19
|
+
"logTailLines": 10000,
|
|
20
|
+
"includeStepLogs": false
|
|
21
|
+
},
|
|
22
|
+
"steps": [
|
|
23
|
+
{
|
|
24
|
+
"label": "discord-start",
|
|
25
|
+
"command": "dc ci-dn-s '{\"appName\":\"Dynamo-ESLint\",\"appEmoji\":\"🔧\",\"commitMessage\":\"$COMMIT_MESSAGE\",\"branchName\":\"$GITHUB_REF_NAME\",\"author\":\"$GITHUB_ACTOR\",\"runNumber\":\"$GITHUB_RUN_NUMBER\",\"runId\":\"$GITHUB_RUN_ID\",\"repository\":\"$GITHUB_REPOSITORY\",\"eventName\":\"$GITHUB_EVENT_NAME\",\"eventDateTime\":\"$EVENT_DATETIME\"}'",
|
|
26
|
+
"fatal": false,
|
|
27
|
+
"discord": {
|
|
28
|
+
"hide": true
|
|
29
|
+
},
|
|
30
|
+
"condition": {
|
|
31
|
+
"envSet": [
|
|
32
|
+
"DISCORD_WEBHOOK_ID"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"label": "pre-flight",
|
|
38
|
+
"type": "pre-flight-check",
|
|
39
|
+
"fatal": true,
|
|
40
|
+
"discord": {
|
|
41
|
+
"emoji": "🔐",
|
|
42
|
+
"name": "Pre-flight Check"
|
|
43
|
+
},
|
|
44
|
+
"settings": {
|
|
45
|
+
"requiredEnvVars": [
|
|
46
|
+
"NPM_TOKEN"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"label": "install",
|
|
52
|
+
"command": "pnpm i",
|
|
53
|
+
"fatal": true,
|
|
54
|
+
"discord": {
|
|
55
|
+
"hide": true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"label": "check-dev-leftovers",
|
|
60
|
+
"type": "check-dev-leftovers",
|
|
61
|
+
"fatal": false,
|
|
62
|
+
"discord": {
|
|
63
|
+
"emoji": "🔍",
|
|
64
|
+
"name": "Dev Leftovers Check"
|
|
65
|
+
},
|
|
66
|
+
"settings": {
|
|
67
|
+
"checks": [
|
|
68
|
+
{
|
|
69
|
+
"type": "TSCONFIG_PATHS",
|
|
70
|
+
"directory": "."
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"type": "PACKAGE_VERSIONS",
|
|
74
|
+
"directory": ".",
|
|
75
|
+
"packages": [
|
|
76
|
+
"@futdevpro/fsm-dynamo"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"label": "build",
|
|
84
|
+
"command": "npx tsc",
|
|
85
|
+
"fatal": true,
|
|
86
|
+
"discord": {
|
|
87
|
+
"emoji": "🏗️",
|
|
88
|
+
"name": "Build"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"label": "test",
|
|
93
|
+
"command": "npx jasmine",
|
|
94
|
+
"fatal": true,
|
|
95
|
+
"discord": {
|
|
96
|
+
"emoji": "🧪",
|
|
97
|
+
"name": "Tests"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"label": "npm-publish",
|
|
102
|
+
"type": "npm-publish",
|
|
103
|
+
"fatal": false,
|
|
104
|
+
"discord": {
|
|
105
|
+
"emoji": "📦",
|
|
106
|
+
"name": "NPM Publish"
|
|
107
|
+
},
|
|
108
|
+
"condition": {
|
|
109
|
+
"branchMatch": [
|
|
110
|
+
"master"
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
"settings": {
|
|
114
|
+
"directory": ".",
|
|
115
|
+
"skipIfPublished": true,
|
|
116
|
+
"retryAttempts": 3,
|
|
117
|
+
"retryDelaySeconds": 30
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"label": "pipeline-report",
|
|
122
|
+
"command": "fdp pipeline-report --report ./logs/cicd-pipeline/cicd-report.json --overseer-url $OVERSEER_URL --overseer-secret $OVERSEER_SECRET_KEY --branch $GITHUB_REF_NAME",
|
|
123
|
+
"fatal": false,
|
|
124
|
+
"always": true,
|
|
125
|
+
"discord": {
|
|
126
|
+
"emoji": "📊",
|
|
127
|
+
"name": "Build Report"
|
|
128
|
+
},
|
|
129
|
+
"condition": {
|
|
130
|
+
"envSet": [
|
|
131
|
+
"OVERSEER_URL"
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"label": "discord-result",
|
|
137
|
+
"command": "fdp pipeline-notify --report ./logs/cicd-pipeline/cicd-report.json --config ./pipeline.cicd.config.json --app-name Dynamo-ESLint --app-emoji 🔧 --webhook-id $DISCORD_WEBHOOK_ID --webhook-token $DISCORD_WEBHOOK_TOKEN --overseer-url $OVERSEER_DASHBOARD_URL",
|
|
138
|
+
"fatal": false,
|
|
139
|
+
"retryOnFail": 2,
|
|
140
|
+
"retryDelaySec": 5,
|
|
141
|
+
"always": true,
|
|
142
|
+
"discord": {
|
|
143
|
+
"hide": true
|
|
144
|
+
},
|
|
145
|
+
"condition": {
|
|
146
|
+
"envSet": [
|
|
147
|
+
"DISCORD_WEBHOOK_ID"
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
package/src/configs/base.ts
CHANGED
|
@@ -88,9 +88,14 @@ module.exports = [
|
|
|
88
88
|
'keyword-spacing': 'warn',
|
|
89
89
|
'no-else-return': 'warn',
|
|
90
90
|
'no-duplicate-imports': 'warn',
|
|
91
|
-
|
|
91
|
+
// CCAP method-input-count: 3+ paraméter helyett egyetlen object input kötelező
|
|
92
|
+
'max-params': [ 'warn', 3 ],
|
|
92
93
|
'max-params-no-constructor/max-params-no-constructor': [ 'warn', 5 ],
|
|
93
94
|
'quotes': [ 'warn', 'single', { allowTemplateLiterals: true }],
|
|
95
|
+
// CCAP no-object-shorthand: tilos a `{ foo }` shorthand, mindig `{ foo: foo }`
|
|
96
|
+
'object-shorthand': [ 'warn', 'never' ],
|
|
97
|
+
// CCAP no-bracket-property-access: dot-notation előnyben (ahol lehetséges)
|
|
98
|
+
'dot-notation': 'warn',
|
|
94
99
|
|
|
95
100
|
// TypeScript rules
|
|
96
101
|
'@typescript-eslint/no-unused-vars': 'warn',
|
|
@@ -103,6 +108,12 @@ module.exports = [
|
|
|
103
108
|
},
|
|
104
109
|
],
|
|
105
110
|
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
|
|
111
|
+
// CCAP no-array-generic: `Array<T>` helyett `T[]`
|
|
112
|
+
'@typescript-eslint/array-type': [ 'warn', { default: 'array' }],
|
|
113
|
+
// CCAP prefer-optional-chaining: `a && a.b` helyett `a?.b`
|
|
114
|
+
'@typescript-eslint/prefer-optional-chain': 'warn',
|
|
115
|
+
// CCAP no-dynamic-imports (CommonJS variant): `require()` helyett ES import
|
|
116
|
+
'@typescript-eslint/no-require-imports': 'warn',
|
|
106
117
|
|
|
107
118
|
// Dynamo custom rules
|
|
108
119
|
'@futdevpro/dynamo/explicit-types': 'warn',
|
|
@@ -115,6 +126,15 @@ module.exports = [
|
|
|
115
126
|
'@futdevpro/dynamo/prefer-enum-over-string-union': [ 'warn', { minValues: 3 }],
|
|
116
127
|
'@futdevpro/dynamo/require-test-description-prefix': [ 'warn', { prefix: '| ' }],
|
|
117
128
|
'@futdevpro/dynamo/no-getter-logic': 'warn',
|
|
129
|
+
|
|
130
|
+
// CCAP-portolt TypeScript review-k (AST-alapú).
|
|
131
|
+
'@futdevpro/dynamo/no-as-cast': 'warn',
|
|
132
|
+
'@futdevpro/dynamo/no-any-type': 'warn',
|
|
133
|
+
'@futdevpro/dynamo/no-dynamic-imports': 'warn',
|
|
134
|
+
'@futdevpro/dynamo/one-export-per-file': 'warn',
|
|
135
|
+
'@futdevpro/dynamo/no-plain-function-export': 'warn',
|
|
136
|
+
'@futdevpro/dynamo/data-model-extends': 'warn',
|
|
137
|
+
'@futdevpro/dynamo/no-native-browser-dialogs': 'warn',
|
|
118
138
|
},
|
|
119
139
|
},
|
|
120
140
|
];
|
package/src/configs/ngx.ts
CHANGED
|
@@ -45,6 +45,11 @@ module.exports = [
|
|
|
45
45
|
'@angular-eslint/no-outputs-metadata-property': 'error',
|
|
46
46
|
'@angular-eslint/use-lifecycle-interface': 'error',
|
|
47
47
|
'@angular-eslint/use-pipe-transform-interface': 'error',
|
|
48
|
+
|
|
49
|
+
// CCAP-portolt Angular TypeScript review-k.
|
|
50
|
+
'@futdevpro/dynamo/no-async-ngoninit': 'warn',
|
|
51
|
+
'@futdevpro/dynamo/no-component-direct-api': 'warn',
|
|
52
|
+
'@futdevpro/dynamo/effect-signal-loop': 'warn',
|
|
48
53
|
},
|
|
49
54
|
},
|
|
50
55
|
{
|
|
@@ -57,6 +62,7 @@ module.exports = [
|
|
|
57
62
|
},
|
|
58
63
|
},
|
|
59
64
|
plugins: {
|
|
65
|
+
...ngxBaseConfig[1].plugins,
|
|
60
66
|
'@angular-eslint/template': angularTemplatePlugin,
|
|
61
67
|
},
|
|
62
68
|
rules: {
|
|
@@ -67,6 +73,12 @@ module.exports = [
|
|
|
67
73
|
'@angular-eslint/template/no-duplicate-attributes': 'error',
|
|
68
74
|
'@angular-eslint/template/no-negated-async': 'error',
|
|
69
75
|
'@angular-eslint/template/use-track-by-function': 'error',
|
|
76
|
+
|
|
77
|
+
// CCAP-portolt Angular template review-k (regex-alapú text scan).
|
|
78
|
+
'@futdevpro/dynamo/no-method-call-in-template': 'warn',
|
|
79
|
+
'@futdevpro/dynamo/angular-for-track-logic': 'warn',
|
|
80
|
+
'@futdevpro/dynamo/no-ngif-directive': 'warn',
|
|
81
|
+
'@futdevpro/dynamo/no-ngfor-directive': 'warn',
|
|
70
82
|
},
|
|
71
83
|
},
|
|
72
84
|
];
|
package/src/plugin/index.ts
CHANGED
|
@@ -9,6 +9,22 @@ import preferEnumRule from './rules/prefer-enum-over-string-union';
|
|
|
9
9
|
import requireTestPrefixRule from './rules/require-test-description-prefix';
|
|
10
10
|
import noGetterLogicRule from './rules/no-getter-logic';
|
|
11
11
|
|
|
12
|
+
import noAsCastRule from './rules/ts/no-as-cast';
|
|
13
|
+
import noAnyTypeRule from './rules/ts/no-any-type';
|
|
14
|
+
import noDynamicImportsRule from './rules/ts/no-dynamic-imports';
|
|
15
|
+
import oneExportPerFileRule from './rules/ts/one-export-per-file';
|
|
16
|
+
import noPlainFunctionExportRule from './rules/ts/no-plain-function-export';
|
|
17
|
+
import dataModelExtendsRule from './rules/ts/data-model-extends';
|
|
18
|
+
import noNativeBrowserDialogsRule from './rules/ts/no-native-browser-dialogs';
|
|
19
|
+
|
|
20
|
+
import noAsyncNgOnInitRule from './rules/angular/no-async-ngoninit';
|
|
21
|
+
import noComponentDirectApiRule from './rules/angular/no-component-direct-api';
|
|
22
|
+
import effectSignalLoopRule from './rules/angular/effect-signal-loop';
|
|
23
|
+
import noMethodCallInTemplateRule from './rules/angular/no-method-call-in-template';
|
|
24
|
+
import angularForTrackLogicRule from './rules/angular/angular-for-track-logic';
|
|
25
|
+
import noNgIfDirectiveRule from './rules/angular/no-ngif-directive';
|
|
26
|
+
import noNgForDirectiveRule from './rules/angular/no-ngfor-directive';
|
|
27
|
+
|
|
12
28
|
export = {
|
|
13
29
|
rules: {
|
|
14
30
|
'explicit-types': explicitTypesRule,
|
|
@@ -22,6 +38,24 @@ export = {
|
|
|
22
38
|
'no-getter-logic': noGetterLogicRule,
|
|
23
39
|
|
|
24
40
|
'naming-patterns': namingPatternsRule,
|
|
41
|
+
|
|
42
|
+
// CCAP-portolt TypeScript review-k (AST-alapú).
|
|
43
|
+
'no-as-cast': noAsCastRule,
|
|
44
|
+
'no-any-type': noAnyTypeRule,
|
|
45
|
+
'no-dynamic-imports': noDynamicImportsRule,
|
|
46
|
+
'one-export-per-file': oneExportPerFileRule,
|
|
47
|
+
'no-plain-function-export': noPlainFunctionExportRule,
|
|
48
|
+
'data-model-extends': dataModelExtendsRule,
|
|
49
|
+
'no-native-browser-dialogs': noNativeBrowserDialogsRule,
|
|
50
|
+
|
|
51
|
+
// CCAP-portolt Angular review-k (TS + template-szöveg AST-alapú).
|
|
52
|
+
'no-async-ngoninit': noAsyncNgOnInitRule,
|
|
53
|
+
'no-component-direct-api': noComponentDirectApiRule,
|
|
54
|
+
'effect-signal-loop': effectSignalLoopRule,
|
|
55
|
+
'no-method-call-in-template': noMethodCallInTemplateRule,
|
|
56
|
+
'angular-for-track-logic': angularForTrackLogicRule,
|
|
57
|
+
'no-ngif-directive': noNgIfDirectiveRule,
|
|
58
|
+
'no-ngfor-directive': noNgForDirectiveRule,
|
|
25
59
|
},
|
|
26
60
|
configs: {
|
|
27
61
|
recommended: {
|
|
@@ -35,11 +69,18 @@ export = {
|
|
|
35
69
|
'@futdevpro/dynamo/prefer-enum-over-string-union': 'warn',
|
|
36
70
|
'@futdevpro/dynamo/require-test-description-prefix': 'warn',
|
|
37
71
|
'@futdevpro/dynamo/no-getter-logic': 'warn',
|
|
38
|
-
|
|
72
|
+
|
|
39
73
|
'@futdevpro/dynamo/naming-patterns': 'warn',
|
|
74
|
+
|
|
75
|
+
// CCAP-portolt TypeScript review-k (AST-alapú).
|
|
76
|
+
'@futdevpro/dynamo/no-as-cast': 'warn',
|
|
77
|
+
'@futdevpro/dynamo/no-any-type': 'warn',
|
|
78
|
+
'@futdevpro/dynamo/no-dynamic-imports': 'warn',
|
|
79
|
+
'@futdevpro/dynamo/one-export-per-file': 'warn',
|
|
80
|
+
'@futdevpro/dynamo/no-plain-function-export': 'warn',
|
|
81
|
+
'@futdevpro/dynamo/data-model-extends': 'warn',
|
|
82
|
+
'@futdevpro/dynamo/no-native-browser-dialogs': 'warn',
|
|
40
83
|
},
|
|
41
84
|
},
|
|
42
85
|
},
|
|
43
86
|
};
|
|
44
|
-
|
|
45
|
-
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import angularForTrackLogicRule from './angular-for-track-logic';
|
|
2
|
+
|
|
3
|
+
describe('| angular-for-track-logic', () => {
|
|
4
|
+
it('| should be a valid ESLint rule', () => {
|
|
5
|
+
expect(angularForTrackLogicRule.meta?.type).toBe('problem');
|
|
6
|
+
expect(angularForTrackLogicRule.meta?.messages?.trackLogic).toBeDefined();
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('| should skip non-html files', () => {
|
|
10
|
+
const mockContext: any = { filename: '/x/foo.ts', report: () => {}, options: [], sourceCode: { text: '' } };
|
|
11
|
+
const result: any = angularForTrackLogicRule.create(mockContext);
|
|
12
|
+
expect(result.Program).toBeUndefined();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('| should NOT report `track item.id` (simple property access)', () => {
|
|
16
|
+
let reportCount: number = 0;
|
|
17
|
+
const mockContext: any = {
|
|
18
|
+
filename: '/x/list.component.html',
|
|
19
|
+
report: (): void => { reportCount += 1; },
|
|
20
|
+
options: [],
|
|
21
|
+
sourceCode: { text: '@for (item of items; track item.id) { <div>X</div> }' },
|
|
22
|
+
};
|
|
23
|
+
const rule: any = angularForTrackLogicRule.create(mockContext);
|
|
24
|
+
rule.Program();
|
|
25
|
+
expect(reportCount).toBe(0);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('| should report `track method(item)` (logic in track)', () => {
|
|
29
|
+
let reportCount: number = 0;
|
|
30
|
+
const mockContext: any = {
|
|
31
|
+
filename: '/x/list.component.html',
|
|
32
|
+
report: (options: any): void => {
|
|
33
|
+
if (options.messageId === 'trackLogic') {
|
|
34
|
+
reportCount += 1;
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
options: [],
|
|
38
|
+
sourceCode: { text: '@for (item of items; track trackFn(item)) { <div>X</div> }' },
|
|
39
|
+
};
|
|
40
|
+
const rule: any = angularForTrackLogicRule.create(mockContext);
|
|
41
|
+
rule.Program();
|
|
42
|
+
expect(reportCount).toBeGreaterThan(0);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Rule } from 'eslint';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `@for (...; track <expr>)` kifejezés keresése — capture group 1: a track expression.
|
|
5
|
+
*/
|
|
6
|
+
const FOR_TRACK_REGEX: RegExp = /@for\s*\([^)]*;\s*track\s+([^;)]+)/g;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Logika detektáló minták a track kifejezésben.
|
|
10
|
+
* Tiltott: `??`, `||`, `&&`, `()`, `+-*\/`, ternary `?`.
|
|
11
|
+
* Megengedett: egyszerű property access (`item.id`).
|
|
12
|
+
*/
|
|
13
|
+
const TRACK_LOGIC_PATTERNS: RegExp[] = [
|
|
14
|
+
/\?\?/,
|
|
15
|
+
/\|\|/,
|
|
16
|
+
/&&/,
|
|
17
|
+
/\(/,
|
|
18
|
+
/\)/,
|
|
19
|
+
/[+\-*/%]/,
|
|
20
|
+
/\?\s*[^:]/,
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Adott offset alapján a sor és oszlop kiszámítása az alap szövegből.
|
|
25
|
+
*/
|
|
26
|
+
function computeLoc(text: string, index: number): { line: number; column: number } {
|
|
27
|
+
const before: string = text.substring(0, index);
|
|
28
|
+
const newlineMatches: RegExpMatchArray | null = before.match(/\n/g);
|
|
29
|
+
const line: number = (newlineMatches ? newlineMatches.length : 0) + 1;
|
|
30
|
+
const lastNewline: number = before.lastIndexOf('\n');
|
|
31
|
+
const column: number = lastNewline === -1 ? index : index - lastNewline - 1;
|
|
32
|
+
return { line: line, column: column };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Angular-for-track-logic szabály: tilos logika `@for (...; track <expr>)` kifejezésben.
|
|
37
|
+
* CCAP "angular-for-track-logic" review ESLint template-text-scan portja.
|
|
38
|
+
*/
|
|
39
|
+
const rule: Rule.RuleModule = {
|
|
40
|
+
meta: {
|
|
41
|
+
type: 'problem',
|
|
42
|
+
docs: {
|
|
43
|
+
description:
|
|
44
|
+
'Forbid logic in Angular `@for (...; track <expr>)`; '
|
|
45
|
+
+ 'only direct property access (`item.id`) allowed.',
|
|
46
|
+
recommended: true,
|
|
47
|
+
},
|
|
48
|
+
schema: [],
|
|
49
|
+
messages: {
|
|
50
|
+
trackLogic: 'Logika a `@for track` kifejezésben: `track {{expr}}`.',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
create(context: Rule.RuleContext): Rule.RuleListener {
|
|
54
|
+
const filename: string = context.filename ?? '';
|
|
55
|
+
if (!filename.endsWith('.html')) {
|
|
56
|
+
return {};
|
|
57
|
+
}
|
|
58
|
+
const text: string = context.sourceCode.text ?? '';
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
Program(): void {
|
|
62
|
+
try {
|
|
63
|
+
const localRegex: RegExp = new RegExp(FOR_TRACK_REGEX.source, 'g');
|
|
64
|
+
let match: RegExpExecArray | null = localRegex.exec(text);
|
|
65
|
+
while (match !== null) {
|
|
66
|
+
const expr: string = match[1].trim();
|
|
67
|
+
const hasLogic: boolean = TRACK_LOGIC_PATTERNS.some(
|
|
68
|
+
(p: RegExp): boolean => p.test(expr),
|
|
69
|
+
);
|
|
70
|
+
if (hasLogic) {
|
|
71
|
+
const loc: { line: number; column: number } = computeLoc(text, match.index);
|
|
72
|
+
context.report({
|
|
73
|
+
loc: { start: loc, end: { line: loc.line, column: loc.column + match[0].length } },
|
|
74
|
+
messageId: 'trackLogic',
|
|
75
|
+
data: { expr: expr },
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
match = localRegex.exec(text);
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.error('[angular-for-track-logic] Error in Program visitor:', error);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default rule;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import effectSignalLoopRule from './effect-signal-loop';
|
|
2
|
+
|
|
3
|
+
describe('| effect-signal-loop', () => {
|
|
4
|
+
it('| should be a valid ESLint rule', () => {
|
|
5
|
+
expect(effectSignalLoopRule.meta?.type).toBe('problem');
|
|
6
|
+
expect(effectSignalLoopRule.meta?.messages?.effectSignalLoop).toBeDefined();
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('| should report when same signal is read AND written in effect', () => {
|
|
10
|
+
let reportCalled: boolean = false;
|
|
11
|
+
const mockContext: any = {
|
|
12
|
+
report: (options: any): void => {
|
|
13
|
+
reportCalled = true;
|
|
14
|
+
expect(options.messageId).toBe('effectSignalLoop');
|
|
15
|
+
expect(options.data.signalName).toBe('count_$');
|
|
16
|
+
},
|
|
17
|
+
options: [],
|
|
18
|
+
};
|
|
19
|
+
const rule: any = effectSignalLoopRule.create(mockContext);
|
|
20
|
+
const mockNode: any = {
|
|
21
|
+
callee: { type: 'Identifier', name: 'effect' },
|
|
22
|
+
arguments: [
|
|
23
|
+
{
|
|
24
|
+
type: 'ArrowFunctionExpression',
|
|
25
|
+
body: {
|
|
26
|
+
type: 'BlockStatement',
|
|
27
|
+
body: [
|
|
28
|
+
{
|
|
29
|
+
type: 'ExpressionStatement',
|
|
30
|
+
expression: {
|
|
31
|
+
type: 'CallExpression',
|
|
32
|
+
callee: { type: 'Identifier', name: 'count_$' },
|
|
33
|
+
arguments: [],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: 'ExpressionStatement',
|
|
38
|
+
expression: {
|
|
39
|
+
type: 'CallExpression',
|
|
40
|
+
callee: {
|
|
41
|
+
type: 'MemberExpression',
|
|
42
|
+
object: { type: 'Identifier', name: 'count_$' },
|
|
43
|
+
property: { type: 'Identifier', name: 'set' },
|
|
44
|
+
},
|
|
45
|
+
arguments: [{ type: 'Literal', value: 1 }],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
rule.CallExpression(mockNode);
|
|
54
|
+
expect(reportCalled).toBe(true);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('| should not report when only reading a signal', () => {
|
|
58
|
+
let reportCalled: boolean = false;
|
|
59
|
+
const mockContext: any = { report: () => { reportCalled = true; }, options: [] };
|
|
60
|
+
const rule: any = effectSignalLoopRule.create(mockContext);
|
|
61
|
+
const mockNode: any = {
|
|
62
|
+
callee: { type: 'Identifier', name: 'effect' },
|
|
63
|
+
arguments: [
|
|
64
|
+
{
|
|
65
|
+
type: 'ArrowFunctionExpression',
|
|
66
|
+
body: {
|
|
67
|
+
type: 'CallExpression',
|
|
68
|
+
callee: { type: 'Identifier', name: 'count_$' },
|
|
69
|
+
arguments: [],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
rule.CallExpression(mockNode);
|
|
75
|
+
expect(reportCalled).toBe(false);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('| should ignore non-effect calls', () => {
|
|
79
|
+
let reportCalled: boolean = false;
|
|
80
|
+
const mockContext: any = { report: () => { reportCalled = true; }, options: [] };
|
|
81
|
+
const rule: any = effectSignalLoopRule.create(mockContext);
|
|
82
|
+
const mockNode: any = {
|
|
83
|
+
callee: { type: 'Identifier', name: 'computed' },
|
|
84
|
+
arguments: [],
|
|
85
|
+
};
|
|
86
|
+
rule.CallExpression(mockNode);
|
|
87
|
+
expect(reportCalled).toBe(false);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Rule } from 'eslint';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Adott AST node alá tartozó signal olvasások / írások begyűjtése.
|
|
5
|
+
* Olvasás: `something_$()` hívás (callee Identifier `*_$` névvel vagy
|
|
6
|
+
* MemberExpression `.foo_$()` property-vel).
|
|
7
|
+
* Írás: `something_$.set(...)` vagy `something_$.update(...)`.
|
|
8
|
+
*/
|
|
9
|
+
function collectSignals(
|
|
10
|
+
rootNode: any,
|
|
11
|
+
reads: Set<string>,
|
|
12
|
+
writes: Set<string>,
|
|
13
|
+
): void {
|
|
14
|
+
if (!rootNode || typeof rootNode !== 'object') {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (rootNode.type === 'CallExpression') {
|
|
19
|
+
const callee: any = rootNode.callee;
|
|
20
|
+
// Signal olvasás: `name_$()` direkt hívás (Identifier callee)
|
|
21
|
+
if (callee && callee.type === 'Identifier' && /_\$$/.test(callee.name)) {
|
|
22
|
+
reads.add(callee.name);
|
|
23
|
+
}
|
|
24
|
+
// Signal olvasás: `this.name_$()` vagy `obj.name_$()`
|
|
25
|
+
if (
|
|
26
|
+
callee
|
|
27
|
+
&& callee.type === 'MemberExpression'
|
|
28
|
+
&& callee.property
|
|
29
|
+
&& callee.property.type === 'Identifier'
|
|
30
|
+
&& /_\$$/.test(callee.property.name)
|
|
31
|
+
) {
|
|
32
|
+
reads.add(callee.property.name);
|
|
33
|
+
}
|
|
34
|
+
// Signal írás: `name_$.set(...)` / `name_$.update(...)`
|
|
35
|
+
if (
|
|
36
|
+
callee
|
|
37
|
+
&& callee.type === 'MemberExpression'
|
|
38
|
+
&& callee.property
|
|
39
|
+
&& callee.property.type === 'Identifier'
|
|
40
|
+
&& (callee.property.name === 'set' || callee.property.name === 'update')
|
|
41
|
+
) {
|
|
42
|
+
const obj: any = callee.object;
|
|
43
|
+
if (obj && obj.type === 'Identifier' && /_\$$/.test(obj.name)) {
|
|
44
|
+
writes.add(obj.name);
|
|
45
|
+
}
|
|
46
|
+
if (
|
|
47
|
+
obj
|
|
48
|
+
&& obj.type === 'MemberExpression'
|
|
49
|
+
&& obj.property
|
|
50
|
+
&& obj.property.type === 'Identifier'
|
|
51
|
+
&& /_\$$/.test(obj.property.name)
|
|
52
|
+
) {
|
|
53
|
+
writes.add(obj.property.name);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
for (const key in rootNode) {
|
|
59
|
+
if (key === 'parent' || key === 'loc' || key === 'range') {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const value: any = rootNode[key];
|
|
63
|
+
if (Array.isArray(value)) {
|
|
64
|
+
for (const item of value) {
|
|
65
|
+
collectSignals(item, reads, writes);
|
|
66
|
+
}
|
|
67
|
+
} else if (value && typeof value === 'object' && typeof value.type === 'string') {
|
|
68
|
+
collectSignals(value, reads, writes);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Effect-signal-loop szabály: detektálja azt az `effect(...)` hívást ami
|
|
75
|
+
* ugyanazt a signal-t olvassa (dependency-ként) és írja (`.set` / `.update`).
|
|
76
|
+
* Ez végtelen loop-ot okozna, mert a write újra triggereli az effect-et.
|
|
77
|
+
* CCAP "effect-signal-loop" review ESLint AST-portja.
|
|
78
|
+
*/
|
|
79
|
+
const rule: Rule.RuleModule = {
|
|
80
|
+
meta: {
|
|
81
|
+
type: 'problem',
|
|
82
|
+
docs: {
|
|
83
|
+
description: 'Detect `effect()` callbacks that read and write the same signal — infinite loop risk.',
|
|
84
|
+
recommended: true,
|
|
85
|
+
},
|
|
86
|
+
schema: [],
|
|
87
|
+
messages: {
|
|
88
|
+
effectSignalLoop:
|
|
89
|
+
'Effect-signal loop: `{{signalName}}` olvasva ÉS írva (.set/.update) ugyanabban az `effect()`-ben. '
|
|
90
|
+
+ 'Végtelen újrafutás veszélye — a signal-írás újra triggereli az effect-et.',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
create(context: Rule.RuleContext): Rule.RuleListener {
|
|
94
|
+
return {
|
|
95
|
+
CallExpression(node: any): void {
|
|
96
|
+
try {
|
|
97
|
+
const callee: any = node.callee;
|
|
98
|
+
if (!callee || callee.type !== 'Identifier' || callee.name !== 'effect') {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const firstArg: any = node.arguments && node.arguments[0];
|
|
102
|
+
if (!firstArg) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const reads: Set<string> = new Set<string>();
|
|
106
|
+
const writes: Set<string> = new Set<string>();
|
|
107
|
+
collectSignals(firstArg, reads, writes);
|
|
108
|
+
for (const signalName of writes) {
|
|
109
|
+
if (reads.has(signalName)) {
|
|
110
|
+
context.report({
|
|
111
|
+
node: node,
|
|
112
|
+
messageId: 'effectSignalLoop',
|
|
113
|
+
data: { signalName: signalName },
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.error('[effect-signal-loop] Error in CallExpression visitor:', error);
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export default rule;
|