comment-variables 0.12.1 → 0.12.3
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/comments.config.js +3 -0
- package/comments.config.json +140 -28
- package/library/_commons/rules/resolve.js +1 -2
- package/library/index.js +4 -1
- package/package.json +2 -2
package/comments.config.js
CHANGED
|
@@ -41,6 +41,9 @@ const data = {
|
|
|
41
41
|
// emptyString: "", // errors, string is empty
|
|
42
42
|
// "": "emptyKey", // errors, key is empty caught by the regex
|
|
43
43
|
// ownAliasKey: "LEVELONE#LEVELTWO#OWNALIASKEY", // errors, is its own key/alias
|
|
44
|
+
// key: "key not allowed", // errors, "key", "value" and "placeholder" not allowed
|
|
45
|
+
// value: "value not allowed", // errors, "key", "value" and "placeholder" not allowed
|
|
46
|
+
// placeholder: "placeholder not allowed", // errors, "key", "value" and "placeholder" not allowed
|
|
44
47
|
},
|
|
45
48
|
},
|
|
46
49
|
// for deving
|
package/comments.config.json
CHANGED
|
@@ -1,42 +1,154 @@
|
|
|
1
1
|
{
|
|
2
2
|
"levelOne": {
|
|
3
3
|
"levelTwo": {
|
|
4
|
-
"levelThree":
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
4
|
+
"levelThree": {
|
|
5
|
+
"value": "Level three.",
|
|
6
|
+
"key": "LEVELONE#LEVELTWO#LEVELTHREE",
|
|
7
|
+
"placeholder": "$COMMENT#LEVELONE#LEVELTWO#LEVELTHREE"
|
|
8
|
+
},
|
|
9
|
+
"levelThreeEscape": {
|
|
10
|
+
"value": "Level three. fdff",
|
|
11
|
+
"key": "LEVELONE#LEVELTWO#LEVELTHREEESCAPE",
|
|
12
|
+
"placeholder": "$COMMENT#LEVELONE#LEVELTWO#LEVELTHREEESCAPE"
|
|
13
|
+
},
|
|
14
|
+
"stillLevelThree": {
|
|
15
|
+
"value": "Level three.",
|
|
16
|
+
"key": "LEVELONE#LEVELTWO#STILLLEVELTHREE",
|
|
17
|
+
"placeholder": "$COMMENT#LEVELONE#LEVELTWO#STILLLEVELTHREE"
|
|
18
|
+
},
|
|
19
|
+
"otherLevelThree": {
|
|
20
|
+
"value": "Level three.",
|
|
21
|
+
"key": "LEVELONE#LEVELTWO#OTHERLEVELTHREE",
|
|
22
|
+
"placeholder": "$COMMENT#LEVELONE#LEVELTWO#OTHERLEVELTHREE"
|
|
23
|
+
},
|
|
24
|
+
"composedVariable": {
|
|
25
|
+
"value": "Level three. Level three.",
|
|
26
|
+
"key": "LEVELONE#LEVELTWO#COMPOSEDVARIABLE",
|
|
27
|
+
"placeholder": "$COMMENT#LEVELONE#LEVELTWO#COMPOSEDVARIABLE"
|
|
28
|
+
},
|
|
29
|
+
"composedVariableAlias": {
|
|
30
|
+
"value": "Level three. Level three.",
|
|
31
|
+
"key": "LEVELONE#LEVELTWO#COMPOSEDVARIABLEALIAS",
|
|
32
|
+
"placeholder": "$COMMENT#LEVELONE#LEVELTWO#COMPOSEDVARIABLEALIAS"
|
|
33
|
+
}
|
|
10
34
|
}
|
|
11
35
|
},
|
|
12
36
|
"jsDoc": {
|
|
13
37
|
"definitions": {
|
|
14
|
-
"exitDueToFailure":
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
"exitDueToFailure": {
|
|
39
|
+
"value": "Terminates the whole process with a 'failure' code (`1`).",
|
|
40
|
+
"key": "JSDOC#DEFINITIONS#EXITDUETOFAILURE",
|
|
41
|
+
"placeholder": "$COMMENT#JSDOC#DEFINITIONS#EXITDUETOFAILURE"
|
|
42
|
+
},
|
|
43
|
+
"makeRuleResolve": {
|
|
44
|
+
"value": "The utility that creates the resolve rule based on the flattened config data, used to transform `$COMMENT` placeholders into actual comments.",
|
|
45
|
+
"key": "JSDOC#DEFINITIONS#MAKERULERESOLVE",
|
|
46
|
+
"placeholder": "$COMMENT#JSDOC#DEFINITIONS#MAKERULERESOLVE"
|
|
47
|
+
},
|
|
48
|
+
"makeRuleCompress": {
|
|
49
|
+
"value": "The utility that creates the compress rule based on the reversed flattened config data, used to transform actual comments into `$COMMENT` placeholders.",
|
|
50
|
+
"key": "JSDOC#DEFINITIONS#MAKERULECOMPRESS",
|
|
51
|
+
"placeholder": "$COMMENT#JSDOC#DEFINITIONS#MAKERULECOMPRESS"
|
|
52
|
+
},
|
|
53
|
+
"coreCommentsFlow": {
|
|
54
|
+
"value": "The core flow at the heart of resolving and compressing comments.",
|
|
55
|
+
"key": "JSDOC#DEFINITIONS#CORECOMMENTSFLOW",
|
|
56
|
+
"placeholder": "$COMMENT#JSDOC#DEFINITIONS#CORECOMMENTSFLOW"
|
|
57
|
+
},
|
|
58
|
+
"resolveCommentsFlow": {
|
|
59
|
+
"value": "The flow that resolves `$COMMENT` placeholders into actual comments.",
|
|
60
|
+
"key": "JSDOC#DEFINITIONS#RESOLVECOMMENTSFLOW",
|
|
61
|
+
"placeholder": "$COMMENT#JSDOC#DEFINITIONS#RESOLVECOMMENTSFLOW"
|
|
62
|
+
},
|
|
63
|
+
"compressCommentsFlow": {
|
|
64
|
+
"value": "The flow that compresses actual comments into `$COMMENT` placeholders.",
|
|
65
|
+
"key": "JSDOC#DEFINITIONS#COMPRESSCOMMENTSFLOW",
|
|
66
|
+
"placeholder": "$COMMENT#JSDOC#DEFINITIONS#COMPRESSCOMMENTSFLOW"
|
|
67
|
+
},
|
|
68
|
+
"placeholdersCommentsFlow": {
|
|
69
|
+
"value": "The flow that creates `$COMMENT` placeholders right next to where they're defined.",
|
|
70
|
+
"key": "JSDOC#DEFINITIONS#PLACEHOLDERSCOMMENTSFLOW",
|
|
71
|
+
"placeholder": "$COMMENT#JSDOC#DEFINITIONS#PLACEHOLDERSCOMMENTSFLOW"
|
|
72
|
+
},
|
|
73
|
+
"logError": {
|
|
74
|
+
"value": "Logs an error to the console depending on its type. (`\"error\"` or `\"warning\"`.)",
|
|
75
|
+
"key": "JSDOC#DEFINITIONS#LOGERROR",
|
|
76
|
+
"placeholder": "$COMMENT#JSDOC#DEFINITIONS#LOGERROR"
|
|
77
|
+
}
|
|
22
78
|
},
|
|
23
79
|
"params": {
|
|
24
|
-
"flattenedConfigData":
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
80
|
+
"flattenedConfigData": {
|
|
81
|
+
"value": "The flattened config data, with `$COMMENT` placeholders as keys and actual comments as values.",
|
|
82
|
+
"key": "JSDOC#PARAMS#FLATTENEDCONFIGDATA",
|
|
83
|
+
"placeholder": "$COMMENT#JSDOC#PARAMS#FLATTENEDCONFIGDATA"
|
|
84
|
+
},
|
|
85
|
+
"reversedFlattenedConfigData": {
|
|
86
|
+
"value": "The reversed flattened config data, with actual comments as keys and `$COMMENT` placeholders as values.",
|
|
87
|
+
"key": "JSDOC#PARAMS#REVERSEDFLATTENEDCONFIGDATA",
|
|
88
|
+
"placeholder": "$COMMENT#JSDOC#PARAMS#REVERSEDFLATTENEDCONFIGDATA"
|
|
89
|
+
},
|
|
90
|
+
"aliases_flattenedKeys": {
|
|
91
|
+
"value": "The dictionary that connects aliases to their original flattened keys in case an encountered placeholder is actually an alias.",
|
|
92
|
+
"key": "JSDOC#PARAMS#ALIASES_FLATTENEDKEYS",
|
|
93
|
+
"placeholder": "$COMMENT#JSDOC#PARAMS#ALIASES_FLATTENEDKEYS"
|
|
94
|
+
},
|
|
95
|
+
"ruleName": {
|
|
96
|
+
"value": "The name of the rule currently used. (Either `\"resolve\"` or `\"compress\"`.)",
|
|
97
|
+
"key": "JSDOC#PARAMS#RULENAME",
|
|
98
|
+
"placeholder": "$COMMENT#JSDOC#PARAMS#RULENAME"
|
|
99
|
+
},
|
|
100
|
+
"ignores": {
|
|
101
|
+
"value": "The array of paths and globs for the flow's ESLint instance to ignore.",
|
|
102
|
+
"key": "JSDOC#PARAMS#IGNORES",
|
|
103
|
+
"placeholder": "$COMMENT#JSDOC#PARAMS#IGNORES"
|
|
104
|
+
},
|
|
105
|
+
"eitherFlattenedConfigData": {
|
|
106
|
+
"value": "Either the flattened config data or the reversed flattened config data, since they share the same structure.",
|
|
107
|
+
"key": "JSDOC#PARAMS#EITHERFLATTENEDCONFIGDATA",
|
|
108
|
+
"placeholder": "$COMMENT#JSDOC#PARAMS#EITHERFLATTENEDCONFIGDATA"
|
|
109
|
+
},
|
|
110
|
+
"error": {
|
|
111
|
+
"value": "The error object being handle for the logging.",
|
|
112
|
+
"key": "JSDOC#PARAMS#ERROR",
|
|
113
|
+
"placeholder": "$COMMENT#JSDOC#PARAMS#ERROR"
|
|
114
|
+
},
|
|
115
|
+
"options": {
|
|
116
|
+
"value": "The additional options as follows:",
|
|
117
|
+
"key": "JSDOC#PARAMS#OPTIONS",
|
|
118
|
+
"placeholder": "$COMMENT#JSDOC#PARAMS#OPTIONS"
|
|
119
|
+
},
|
|
120
|
+
"settings": {
|
|
121
|
+
"value": "The required settings as follows:",
|
|
122
|
+
"key": "JSDOC#PARAMS#SETTINGS",
|
|
123
|
+
"placeholder": "$COMMENT#JSDOC#PARAMS#SETTINGS"
|
|
124
|
+
},
|
|
125
|
+
"configPathIgnores": {
|
|
126
|
+
"value": "The array of paths linked to the config file, (named \"ignores\" given it is ignored by the \"compress\" and \"resolve\" commands).",
|
|
127
|
+
"key": "JSDOC#PARAMS#CONFIGPATHIGNORES",
|
|
128
|
+
"placeholder": "$COMMENT#JSDOC#PARAMS#CONFIGPATHIGNORES"
|
|
129
|
+
},
|
|
130
|
+
"originalFlattenedConfigData": {
|
|
131
|
+
"value": "The original flattened config data, before changes to Aliases Variables and Composed Variables are applied.",
|
|
132
|
+
"key": "JSDOC#PARAMS#ORIGINALFLATTENEDCONFIGDATA",
|
|
133
|
+
"placeholder": "$COMMENT#JSDOC#PARAMS#ORIGINALFLATTENEDCONFIGDATA"
|
|
134
|
+
}
|
|
35
135
|
},
|
|
36
136
|
"returns": {
|
|
37
|
-
"exitDueToFailure":
|
|
38
|
-
|
|
39
|
-
|
|
137
|
+
"exitDueToFailure": {
|
|
138
|
+
"value": "Never. (Somehow typing needs to be explicit for unreachable code inference.)",
|
|
139
|
+
"key": "JSDOC#RETURNS#EXITDUETOFAILURE",
|
|
140
|
+
"placeholder": "$COMMENT#JSDOC#RETURNS#EXITDUETOFAILURE"
|
|
141
|
+
},
|
|
142
|
+
"makeRuleResolve": {
|
|
143
|
+
"value": "The resolve rule based on the flattened config data.",
|
|
144
|
+
"key": "JSDOC#RETURNS#MAKERULERESOLVE",
|
|
145
|
+
"placeholder": "$COMMENT#JSDOC#RETURNS#MAKERULERESOLVE"
|
|
146
|
+
},
|
|
147
|
+
"makeRuleCompress": {
|
|
148
|
+
"value": "The compress rule based on the reversed flattened config data.",
|
|
149
|
+
"key": "JSDOC#RETURNS#MAKERULECOMPRESS",
|
|
150
|
+
"placeholder": "$COMMENT#JSDOC#RETURNS#MAKERULECOMPRESS"
|
|
151
|
+
}
|
|
40
152
|
}
|
|
41
153
|
}
|
|
42
154
|
}
|
|
@@ -47,9 +47,8 @@ const makeRule = (flattenedConfigData, aliases_flattenedKeys) => {
|
|
|
47
47
|
const replacement =
|
|
48
48
|
flattenedConfigData[key] || // original
|
|
49
49
|
flattenedConfigData[aliases_flattenedKeys?.[key]]; // alias
|
|
50
|
-
|
|
51
50
|
if (replacement) {
|
|
52
|
-
fixedText = fixedText.replace(fullMatch, replacement);
|
|
51
|
+
fixedText = fixedText.replace(fullMatch, () => replacement);
|
|
53
52
|
hasValidFix = true;
|
|
54
53
|
}
|
|
55
54
|
}
|
package/library/index.js
CHANGED
|
@@ -136,7 +136,10 @@ if (!makeResolvedConfigDataResults.success) {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
const resolvedConfigData = makeResolvedConfigDataResults.resolvedConfigData;
|
|
139
|
-
const jsonPath = resolveConfigResults.configPath.replace(
|
|
139
|
+
const jsonPath = resolveConfigResults.configPath.replace(
|
|
140
|
+
/\.js$/,
|
|
141
|
+
() => ".json"
|
|
142
|
+
);
|
|
140
143
|
const jsonData = JSON.stringify(resolvedConfigData, null, 2);
|
|
141
144
|
fs.writeFileSync(jsonPath, jsonData, "utf8");
|
|
142
145
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comment-variables",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"description": "A CLI tool for configuring, managing and maintaining JavaScript comments as JavaScript variables.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"jscomments": "./library/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"type": "module",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@eslint/markdown": "^6.5.0",
|
|
30
|
-
"comment-variables-resolve-config": "^1.
|
|
30
|
+
"comment-variables-resolve-config": "^1.10.1",
|
|
31
31
|
"eslint": "^9.29.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|