comment-variables 0.10.1 → 0.11.1
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 +41 -22
- package/library/_commons/constants/bases.js +1 -0
- package/library/_commons/rules/compress.js +3 -3
- package/library/_commons/rules/resolve.js +4 -4
- package/library/_commons/utilities/flows.js +101 -13
- package/library/_commons/utilities/helpers.js +4 -4
- package/library/index.js +16 -3
- package/package.json +2 -2
package/comments.config.js
CHANGED
|
@@ -2,14 +2,26 @@ const data = {
|
|
|
2
2
|
// for testing
|
|
3
3
|
levelOne: {
|
|
4
4
|
levelTwo: {
|
|
5
|
-
levelThree: "Level three."
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
levelThree: "Level three." /* $COMMENT#LEVELONE#LEVELTWO#LEVELTHREE */, // New placeholder structure. Not as sexy, but first and foremost guaranteed to be functional appended right at the end of the value as a Block comment, and last but not least also guaranteed to not modify Value Locations in the process. So `comment variables placeholders` it is, and this justifies enforcing strings only for values even outside of the use of the VS Code extension.
|
|
6
|
+
levelThreeEscape:
|
|
7
|
+
"Level three. \
|
|
8
|
+
fdff\
|
|
9
|
+
" /* $COMMENT#LEVELONE#LEVELTWO#LEVELTHREEESCAPE */, // valid
|
|
10
|
+
stillLevelThree:
|
|
11
|
+
"LEVELONE#LEVELTWO#LEVELTHREE" /* $COMMENT#LEVELONE#LEVELTWO#LEVELTHREE */, // now is an alias
|
|
12
|
+
otherLevelThree:
|
|
13
|
+
"LEVELONE#LEVELTWO#LEVELTHREE" /* $COMMENT#LEVELONE#LEVELTWO#LEVELTHREE */, // also an alias
|
|
8
14
|
composedVariable:
|
|
9
|
-
"$COMMENT#LEVELONE#LEVELTWO#LEVELTHREE $COMMENT#LEVELONE#LEVELTWO#STILLLEVELTHREE"
|
|
15
|
+
"$COMMENT#LEVELONE#LEVELTWO#LEVELTHREE $COMMENT#LEVELONE#LEVELTWO#STILLLEVELTHREE" /* $COMMENT#LEVELONE#LEVELTWO#COMPOSEDVARIABLE */, // This is a composed variable. What's the beauty in this? It allows for each comment variable to be its own single source of truth that can be reused still within the Comment Variables ecosystem. All while preventing the use of comment variables placeholders as values in the config. AND as a matter of fact, it even works... with aliases. (Personal note: And that part is free and included in the CLI tool.)
|
|
10
16
|
// wrongComposedVariable:
|
|
11
17
|
// "$COMMENT#LEVELONE#LEVELTWO#COMPOSEDVARIABLE $COMMENT#LEVELONE#LEVELTWO#STILLLEVELTHREE", // errors, can't make composed variables with composed variables
|
|
18
|
+
composedVariableAlias:
|
|
19
|
+
"LEVELONE#LEVELTWO#COMPOSEDVARIABLE" /* $COMMENT#LEVELONE#LEVELTWO#COMPOSEDVARIABLEALIAS */,
|
|
20
|
+
// wrongComposedVariableToo:
|
|
21
|
+
// "$COMMENT#LEVELONE#LEVELTWO#STILLLEVELTHREE $COMMENT#LEVELONE#LEVELTWO#COMPOSEDVARIABLE", // errors, can't make composed variables with composed variables even as aliases
|
|
22
|
+
|
|
12
23
|
// levelthree: "Also level three.", // errors, duplicate normalized key
|
|
24
|
+
// levelThree: "Also level three.", // errors, duplicate key with original overriden by legal JavaScript object value overrides
|
|
13
25
|
// alsoLevelThree: "Level three.", // errors, duplicate value
|
|
14
26
|
// tooLevelThree: 2, // errors, value is invalid
|
|
15
27
|
// $levelThree: "Dollar sign", // errors, key as "$" character
|
|
@@ -18,47 +30,54 @@ const data = {
|
|
|
18
30
|
// unrecognized: `Unrecognized value.`, // errors, is not a string literal
|
|
19
31
|
// emptyString: "", // errors, string is empty
|
|
20
32
|
// "": "emptyKey", // errors, key is empty caught by the regex
|
|
33
|
+
// ownAliasKey: "LEVELONE#LEVELTWO#OWNALIASKEY", // errors, is its own key/alias
|
|
21
34
|
},
|
|
22
35
|
},
|
|
23
36
|
// for deving
|
|
24
37
|
jsDoc: Object.freeze({
|
|
25
38
|
definitions: Object.freeze({
|
|
26
39
|
exitDueToFailure:
|
|
27
|
-
"Terminates the whole process with a 'failure' code (1)."
|
|
40
|
+
"Terminates the whole process with a 'failure' code (1)." /* $COMMENT#JSDOC#DEFINITIONS#EXITDUETOFAILURE */,
|
|
28
41
|
makeRuleResolve:
|
|
29
|
-
"The utility that creates the resolve rule based on the flattened config data, used to transform
|
|
42
|
+
"The utility that creates the resolve rule based on the flattened config data, used to transform `$COMMENT` placeholders into actual comments." /* $COMMENT#JSDOC#DEFINITIONS#MAKERULERESOLVE */,
|
|
30
43
|
makeRuleCompress:
|
|
31
|
-
"The utility that creates the compress rule based on the reversed flattened config data, used to transform actual comments into
|
|
44
|
+
"The utility that creates the compress rule based on the reversed flattened config data, used to transform actual comments into `$COMMENT` placeholders." /* $COMMENT#JSDOC#DEFINITIONS#MAKERULECOMPRESS */,
|
|
32
45
|
coreCommentsFlow:
|
|
33
|
-
"The core flow at the heart of resolving and compressing comments."
|
|
46
|
+
"The core flow at the heart of resolving and compressing comments." /* $COMMENT#JSDOC#DEFINITIONS#CORECOMMENTSFLOW */,
|
|
34
47
|
resolveCommentsFlow:
|
|
35
|
-
"The flow that resolves
|
|
48
|
+
"The flow that resolves `$COMMENT` placeholders into actual comments." /* $COMMENT#JSDOC#DEFINITIONS#RESOLVECOMMENTSFLOW */,
|
|
36
49
|
compressCommentsFlow:
|
|
37
|
-
"The flow that compresses actual comments into
|
|
50
|
+
"The flow that compresses actual comments into `$COMMENT` placeholders." /* $COMMENT#JSDOC#DEFINITIONS#COMPRESSCOMMENTSFLOW */,
|
|
38
51
|
logError:
|
|
39
|
-
'Logs an error to the console depending on its type. (`"error"` or `"warning"`.)'
|
|
52
|
+
'Logs an error to the console depending on its type. (`"error"` or `"warning"`.)' /* $COMMENT#JSDOC#DEFINITIONS#LOGERROR */,
|
|
40
53
|
}),
|
|
41
54
|
params: Object.freeze({
|
|
42
55
|
flattenedConfigData:
|
|
43
|
-
"The flattened config data, with
|
|
56
|
+
"The flattened config data, with `$COMMENT` placeholders as keys and actual comments as values." /* $COMMENT#JSDOC#PARAMS#FLATTENEDCONFIGDATA */,
|
|
44
57
|
reversedFlattenedConfigData:
|
|
45
|
-
"The reversed flattened config data, with actual comments as keys and
|
|
58
|
+
"The reversed flattened config data, with actual comments as keys and `$COMMENT` placeholders as values." /* $COMMENT#JSDOC#PARAMS#REVERSEDFLATTENEDCONFIGDATA */,
|
|
59
|
+
aliases_flattenedKeys:
|
|
60
|
+
"The dictionary that connects aliases to their original flattened keys in case an encountered placeholder is actually an alias." /* $COMMENT#JSDOC#PARAMS#ALIASES_FLATTENEDKEYS */,
|
|
46
61
|
ruleName:
|
|
47
|
-
'The name of the rule currently used. (Either `"resolve"` or `"compress"`.)'
|
|
62
|
+
'The name of the rule currently used. (Either `"resolve"` or `"compress"`.)' /* $COMMENT#JSDOC#PARAMS#RULENAME */,
|
|
48
63
|
ignores:
|
|
49
|
-
"The array of paths and globs for the flow's ESLint instance to ignore."
|
|
64
|
+
"The array of paths and globs for the flow's ESLint instance to ignore." /* $COMMENT#JSDOC#PARAMS#IGNORES */,
|
|
50
65
|
eitherFlattenedConfigData:
|
|
51
|
-
"Either the flattened config data or the reversed flattened config data, since they share the same structure."
|
|
52
|
-
error:
|
|
53
|
-
|
|
54
|
-
|
|
66
|
+
"Either the flattened config data or the reversed flattened config data, since they share the same structure." /* $COMMENT#JSDOC#PARAMS#EITHERFLATTENEDCONFIGDATA */,
|
|
67
|
+
error:
|
|
68
|
+
"The error object being handle for the logging." /* $COMMENT#JSDOC#PARAMS#ERROR */,
|
|
69
|
+
options:
|
|
70
|
+
"The additional options as follows:" /* $COMMENT#JSDOC#PARAMS#OPTIONS */,
|
|
71
|
+
settings:
|
|
72
|
+
"The required settings as follows:" /* $COMMENT#JSDOC#PARAMS#SETTINGS */,
|
|
55
73
|
}),
|
|
56
74
|
returns: Object.freeze({
|
|
57
75
|
exitDueToFailure:
|
|
58
|
-
"Never. (Somehow typing needs to be explicit for unreachable code inference.)"
|
|
59
|
-
makeRuleResolve:
|
|
76
|
+
"Never. (Somehow typing needs to be explicit for unreachable code inference.)" /* $COMMENT#JSDOC#RETURNS#EXITDUETOFAILURE */,
|
|
77
|
+
makeRuleResolve:
|
|
78
|
+
"The resolve rule based on the flattened config data." /* $COMMENT#JSDOC#RETURNS#MAKERULERESOLVE */,
|
|
60
79
|
makeRuleCompress:
|
|
61
|
-
"The compress rule based on the reversed flattened config data."
|
|
80
|
+
"The compress rule based on the reversed flattened config data." /* $COMMENT#JSDOC#RETURNS#MAKERULECOMPRESS */,
|
|
62
81
|
}),
|
|
63
82
|
}),
|
|
64
83
|
};
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
} from "comment-variables-resolve-config";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @param {{[key: string]: string}} reversedFlattenedConfigData
|
|
10
|
-
* @returns
|
|
8
|
+
* $COMMENT#JSDOC#DEFINITIONS#MAKERULECOMPRESS
|
|
9
|
+
* @param {{[key: string]: string}} reversedFlattenedConfigData $COMMENT#JSDOC#PARAMS#REVERSEDFLATTENEDCONFIGDATA
|
|
10
|
+
* @returns $COMMENT#JSDOC#RETURNS#MAKERULECOMPRESS
|
|
11
11
|
*/
|
|
12
12
|
const makeRule = (reversedFlattenedConfigData) => {
|
|
13
13
|
// Turns the whole reversedFlattenedConfig from an object to an array of key-value arrays sorted by the descending length of each key to prevent partial replacements.
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "comment-variables-resolve-config";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param {{[key: string]: string}} flattenedConfigData
|
|
9
|
-
* @param {{[key: string]: string}} aliases_flattenedKeys
|
|
10
|
-
* @returns
|
|
7
|
+
* $COMMENT#JSDOC#DEFINITIONS#MAKERULERESOLVE
|
|
8
|
+
* @param {{[key: string]: string}} flattenedConfigData $COMMENT#JSDOC#PARAMS#FLATTENEDCONFIGDATA
|
|
9
|
+
* @param {{[key: string]: string}} aliases_flattenedKeys $COMMENT#JSDOC#PARAMS#ALIASES_FLATTENEDKEYS
|
|
10
|
+
* @returns $COMMENT#JSDOC#RETURNS#MAKERULERESOLVE
|
|
11
11
|
*/
|
|
12
12
|
const makeRule = (flattenedConfigData, aliases_flattenedKeys) => {
|
|
13
13
|
/** @type {import('@typescript-eslint/utils').TSESLint.RuleModule<typeof placeholderMessageId, []>} */
|
|
@@ -2,8 +2,11 @@ import { ESLint } from "eslint";
|
|
|
2
2
|
import markdown from "@eslint/markdown";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
+
$COMMENT,
|
|
5
6
|
commentVariablesPluginName,
|
|
7
|
+
extractRuleName,
|
|
6
8
|
typeScriptAndJSXCompatible,
|
|
9
|
+
extractObjectStringLiteralValues,
|
|
7
10
|
} from "comment-variables-resolve-config";
|
|
8
11
|
|
|
9
12
|
import {
|
|
@@ -18,11 +21,11 @@ import { ruleNames_makeRules } from "../constants/rules.js";
|
|
|
18
21
|
/* coreCommentsFlow */
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
|
-
*
|
|
22
|
-
* @param {typeof resolveRuleName | typeof compressRuleName} ruleName
|
|
23
|
-
* @param {string[]} ignores
|
|
24
|
-
* @param {{[key: string]: string}} flattenedConfigData
|
|
25
|
-
* @param {
|
|
24
|
+
* $COMMENT#JSDOC#DEFINITIONS#CORECOMMENTSFLOW
|
|
25
|
+
* @param {typeof resolveRuleName | typeof compressRuleName} ruleName $COMMENT#JSDOC#PARAMS#RULENAME
|
|
26
|
+
* @param {string[]} ignores $COMMENT#JSDOC#PARAMS#IGNORES
|
|
27
|
+
* @param {{[key: string]: string}} flattenedConfigData $COMMENT#JSDOC#PARAMS#EITHERFLATTENEDCONFIGDATA
|
|
28
|
+
* @param {Record<string, string> | undefined} aliases_flattenedKeys
|
|
26
29
|
*/
|
|
27
30
|
const coreCommentsFlow = async (
|
|
28
31
|
ruleName,
|
|
@@ -76,7 +79,7 @@ const coreCommentsFlow = async (
|
|
|
76
79
|
]);
|
|
77
80
|
await ESLint.outputFixes(results);
|
|
78
81
|
|
|
79
|
-
console.log(
|
|
82
|
+
console.log(`Results for ${ruleName} are:`, results);
|
|
80
83
|
|
|
81
84
|
const resolvedOrCompressed =
|
|
82
85
|
ruleName === resolveRuleName
|
|
@@ -100,10 +103,10 @@ const coreCommentsFlow = async (
|
|
|
100
103
|
/* resolveCommentsFlow */
|
|
101
104
|
|
|
102
105
|
/**
|
|
103
|
-
*
|
|
104
|
-
* @param {string[]} ignores
|
|
105
|
-
* @param {
|
|
106
|
-
* @param {
|
|
106
|
+
* $COMMENT#JSDOC#DEFINITIONS#RESOLVECOMMENTSFLOW
|
|
107
|
+
* @param {string[]} ignores $COMMENT#JSDOC#PARAMS#IGNORES
|
|
108
|
+
* @param {Record<string, string>} flattenedConfigData $COMMENT#JSDOC#PARAMS#FLATTENEDCONFIGDATA
|
|
109
|
+
* @param {Record<string, string>} aliases_flattenedKeys
|
|
107
110
|
* @returns
|
|
108
111
|
*/
|
|
109
112
|
export const resolveCommentsFlow = async (
|
|
@@ -121,12 +124,97 @@ export const resolveCommentsFlow = async (
|
|
|
121
124
|
/* compressCommentsFlow */
|
|
122
125
|
|
|
123
126
|
/**
|
|
124
|
-
*
|
|
125
|
-
* @param {string[]} ignores
|
|
126
|
-
* @param {{[key: string]: string}} reversedFlattenedConfigData
|
|
127
|
+
* $COMMENT#JSDOC#DEFINITIONS#COMPRESSCOMMENTSFLOW
|
|
128
|
+
* @param {string[]} ignores $COMMENT#JSDOC#PARAMS#IGNORES
|
|
129
|
+
* @param {{[key: string]: string}} reversedFlattenedConfigData $COMMENT#JSDOC#PARAMS#REVERSEDFLATTENEDCONFIGDATA
|
|
127
130
|
* @returns
|
|
128
131
|
*/
|
|
129
132
|
export const compressCommentsFlow = async (
|
|
130
133
|
ignores,
|
|
131
134
|
reversedFlattenedConfigData
|
|
132
135
|
) => coreCommentsFlow(compressRuleName, ignores, reversedFlattenedConfigData);
|
|
136
|
+
|
|
137
|
+
/* placeholdersCommentsFlow */
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @param {string[]} configPathIgnores
|
|
142
|
+
* @param {{[k: string]: string;}} originalFlattenedConfigData
|
|
143
|
+
* @param {Record<string, string>} aliases_flattenedKeys
|
|
144
|
+
*/
|
|
145
|
+
export const placeholdersCommentsFlow = async (
|
|
146
|
+
configPathIgnores,
|
|
147
|
+
originalFlattenedConfigData,
|
|
148
|
+
aliases_flattenedKeys
|
|
149
|
+
) => {
|
|
150
|
+
/* TEST START
|
|
151
|
+
only for the jscomments/comment-variables placeholders command
|
|
152
|
+
meaning this should actually be only in the JSComments CLI, */
|
|
153
|
+
|
|
154
|
+
/** @type {Record<string, string>} */
|
|
155
|
+
const composedValues_originalKeys = {};
|
|
156
|
+
/** @type {Record<string, string>} */
|
|
157
|
+
const aliasValues_originalKeys = {};
|
|
158
|
+
/** @type {Record<string, string>} */
|
|
159
|
+
const regularValuesOnly_originalKeys = {};
|
|
160
|
+
|
|
161
|
+
for (const [key, value] of Object.entries(originalFlattenedConfigData)) {
|
|
162
|
+
if (value.includes(`${$COMMENT}#`))
|
|
163
|
+
// composed Comment Variables
|
|
164
|
+
composedValues_originalKeys[value] = key;
|
|
165
|
+
else if (originalFlattenedConfigData[value])
|
|
166
|
+
// alias Comment Variables
|
|
167
|
+
aliasValues_originalKeys[value] = aliases_flattenedKeys[key];
|
|
168
|
+
// regular Comment Variables
|
|
169
|
+
else regularValuesOnly_originalKeys[value] = key;
|
|
170
|
+
} // no need for continues, potential collisions are caught in resolveConfig run prior
|
|
171
|
+
|
|
172
|
+
const makePlaceholders = {
|
|
173
|
+
composedValues_originalKeys,
|
|
174
|
+
aliasValues_originalKeys,
|
|
175
|
+
regularValuesOnly_originalKeys,
|
|
176
|
+
};
|
|
177
|
+
const makePlaceholdersAsObject = { makePlaceholders };
|
|
178
|
+
|
|
179
|
+
const eslintForMakePlaceholders = new ESLint({
|
|
180
|
+
fix: true,
|
|
181
|
+
errorOnUnmatchedPattern: false,
|
|
182
|
+
overrideConfigFile: true,
|
|
183
|
+
overrideConfig: [
|
|
184
|
+
{
|
|
185
|
+
files: configPathIgnores,
|
|
186
|
+
languageOptions: typeScriptAndJSXCompatible,
|
|
187
|
+
plugins: {
|
|
188
|
+
[commentVariablesPluginName]: {
|
|
189
|
+
rules: {
|
|
190
|
+
[extractRuleName]: extractObjectStringLiteralValues,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
rules: {
|
|
195
|
+
[`${commentVariablesPluginName}/${extractRuleName}`]: [
|
|
196
|
+
"warn",
|
|
197
|
+
makePlaceholdersAsObject,
|
|
198
|
+
],
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
const resultsForMakePlaceholders = await eslintForMakePlaceholders.lintFiles(
|
|
205
|
+
configPathIgnores
|
|
206
|
+
);
|
|
207
|
+
await ESLint.outputFixes(resultsForMakePlaceholders);
|
|
208
|
+
|
|
209
|
+
console.log("Results for placeholders are:", resultsForMakePlaceholders);
|
|
210
|
+
|
|
211
|
+
const total = resultsForMakePlaceholders.reduce((sum, r) => {
|
|
212
|
+
const add = r.output ? 1 : 0;
|
|
213
|
+
return sum + add;
|
|
214
|
+
}, 0);
|
|
215
|
+
|
|
216
|
+
console.log(
|
|
217
|
+
`✅ Made placeholders on ${total} file${total === 1 ? "" : "s"}.`
|
|
218
|
+
);
|
|
219
|
+
/* TEST END */
|
|
220
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/* exitDueToFailure */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @returns {never}
|
|
4
|
+
* $COMMENT#JSDOC#DEFINITIONS#EXITDUETOFAILURE
|
|
5
|
+
* @returns {never} $COMMENT#JSDOC#RETURNS#EXITDUETOFAILURE
|
|
6
6
|
*/
|
|
7
7
|
export const exitDueToFailure = () => process.exit(1);
|
|
8
8
|
|
|
9
9
|
/* logError */
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @param {{type: "error" | "warning"; message: string}} error
|
|
12
|
+
* $COMMENT#JSDOC#DEFINITIONS#LOGERROR
|
|
13
|
+
* @param {{type: "error" | "warning"; message: string}} error $COMMENT#JSDOC#PARAMS#ERROR
|
|
14
14
|
*/
|
|
15
15
|
export const logError = (error) => {
|
|
16
16
|
switch (error.type) {
|
package/library/index.js
CHANGED
|
@@ -17,12 +17,14 @@ import {
|
|
|
17
17
|
hasGitFolder,
|
|
18
18
|
resolveRuleName,
|
|
19
19
|
compressRuleName,
|
|
20
|
+
placeholdersRuleName,
|
|
20
21
|
} from "./_commons/constants/bases.js";
|
|
21
22
|
|
|
22
23
|
import { exitDueToFailure, logError } from "./_commons/utilities/helpers.js";
|
|
23
24
|
import {
|
|
24
25
|
resolveCommentsFlow,
|
|
25
26
|
compressCommentsFlow,
|
|
27
|
+
placeholdersCommentsFlow,
|
|
26
28
|
} from "./_commons/utilities/flows.js";
|
|
27
29
|
|
|
28
30
|
// ENSURES THE CLI TOOL ONLY RUNS IN FOLDERS THAT POSSESS A package.json FILE AND A .git FOLDER.
|
|
@@ -46,7 +48,9 @@ const commands = process.argv;
|
|
|
46
48
|
const coreCommand = commands[2];
|
|
47
49
|
|
|
48
50
|
const skipDetails =
|
|
49
|
-
coreCommand === resolveRuleName ||
|
|
51
|
+
coreCommand === resolveRuleName ||
|
|
52
|
+
coreCommand === compressRuleName ||
|
|
53
|
+
coreCommand === placeholdersRuleName;
|
|
50
54
|
|
|
51
55
|
// OBTAINS THE VALIDATED FLATTENED CONFIG, REVERSE FLATTENED CONFIG, CONFIG PATH, AND PASSED IGNORES.
|
|
52
56
|
|
|
@@ -74,6 +78,7 @@ console.log("Config resolved.");
|
|
|
74
78
|
|
|
75
79
|
const {
|
|
76
80
|
config,
|
|
81
|
+
originalFlattenedConfigData,
|
|
77
82
|
flattenedConfigData,
|
|
78
83
|
reversedFlattenedConfigData,
|
|
79
84
|
aliases_flattenedKeys,
|
|
@@ -134,14 +139,22 @@ switch (coreCommand) {
|
|
|
134
139
|
console.log(`Running ${compressRuleName}...`);
|
|
135
140
|
await compressCommentsFlow(ignores, reversedFlattenedConfigData);
|
|
136
141
|
break;
|
|
142
|
+
case placeholdersRuleName:
|
|
143
|
+
console.log(`Running ${placeholdersRuleName}...`);
|
|
144
|
+
await placeholdersCommentsFlow(
|
|
145
|
+
configPathIgnores,
|
|
146
|
+
originalFlattenedConfigData,
|
|
147
|
+
aliases_flattenedKeys
|
|
148
|
+
);
|
|
149
|
+
break;
|
|
137
150
|
default:
|
|
138
151
|
if (coreCommand && !coreCommand.startsWith("--"))
|
|
139
152
|
console.error(
|
|
140
|
-
`ERROR. Core command not recognized. Choose between "resolve" and "compress".`
|
|
153
|
+
`ERROR. Core command not recognized. Choose between "resolve" and "compress" or "placeholders".`
|
|
141
154
|
);
|
|
142
155
|
else
|
|
143
156
|
console.log(
|
|
144
|
-
`If these settings are correct with you, feel free to initiate the command "resolve" to resolve comments, or "compress" to compress them back to their $COMMENT
|
|
157
|
+
`If these settings are correct with you, feel free to initiate the command "resolve" to resolve comments, or "compress" to compress them back to their $COMMENT forms. You can also generate the placeholders with the command "placeholders".${
|
|
145
158
|
passedConfigPath || lintConfigImports || myIgnoresOnly
|
|
146
159
|
? " (And DON'T FORGET YOUR FLAGS!)"
|
|
147
160
|
: ""
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comment-variables",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
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",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"type": "module",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@eslint/markdown": "^6.5.0",
|
|
29
|
-
"comment-variables-resolve-config": "^1.
|
|
29
|
+
"comment-variables-resolve-config": "^1.7.0",
|
|
30
30
|
"eslint": "^9.29.0",
|
|
31
31
|
"zod": "^3.25.67"
|
|
32
32
|
},
|