comment-variables 0.3.0 → 0.3.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
CHANGED
|
@@ -3,18 +3,13 @@ const data = {
|
|
|
3
3
|
levelOne: {
|
|
4
4
|
levelTwo: {
|
|
5
5
|
levelThree: "Level three.",
|
|
6
|
-
// levelthree: "Also level three.", // errors
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
// [`level$Three#First
|
|
14
|
-
// whitespace`]: `This is level three
|
|
15
|
-
// with whitespaces. `, // fails
|
|
16
|
-
// testing: 2, // fails
|
|
17
|
-
// ".'e": "",
|
|
6
|
+
// levelthree: "Also level three.", // errors, duplicate normalized key
|
|
7
|
+
// stillLevelThree: "LEVELONE#LEVELTWO#LEVELTHREE", // errors, value is also a normalized key
|
|
8
|
+
// alsoLevelThree: "Level three.", // errors, duplicate value
|
|
9
|
+
// tooLevelThree: 2, // errors, value is invalid
|
|
10
|
+
// $levelThree: "Dollar sign", // errors, key as "$" character
|
|
11
|
+
// "#levelThree": "Hashtag", // errors, key as "#" character
|
|
12
|
+
// ".levelThree": "Punctuation", // errors, key is invalid
|
|
18
13
|
},
|
|
19
14
|
},
|
|
20
15
|
// for deving
|
|
@@ -22,7 +17,8 @@ const data = {
|
|
|
22
17
|
definitions: Object.freeze({
|
|
23
18
|
exitDueToFailure:
|
|
24
19
|
"Terminates the whole process with a 'failure' code (1).",
|
|
25
|
-
escapeRegex:
|
|
20
|
+
escapeRegex:
|
|
21
|
+
'Escapes all regex characters with a `"\\"` in a string to prepare it for use in a regex.',
|
|
26
22
|
makeRuleResolve:
|
|
27
23
|
"The utility that creates the resolve rule based on the flattened config data, used to transform $COMMENT#* placeholders into actual comments.",
|
|
28
24
|
makeRuleCompress:
|
|
@@ -64,7 +64,7 @@ const coreCommentsFlow = async (ruleName, ignores, flattenedConfigData) => {
|
|
|
64
64
|
]);
|
|
65
65
|
await ESLint.outputFixes(results);
|
|
66
66
|
|
|
67
|
-
console.log(
|
|
67
|
+
console.log("Results are:", results);
|
|
68
68
|
|
|
69
69
|
const resolvedOrCompressed =
|
|
70
70
|
ruleName === resolveRuleName
|
package/library/index.js
CHANGED
|
@@ -17,13 +17,12 @@ import {
|
|
|
17
17
|
import { exitDueToFailure } from "./_commons/utilities/helpers.js";
|
|
18
18
|
import { resolveConfig } from "./_commons/utilities/resolve-config.js";
|
|
19
19
|
import { findAllImports } from "./_commons/utilities/find-all-imports.js";
|
|
20
|
-
|
|
21
20
|
import {
|
|
22
21
|
resolveCommentsFlow,
|
|
23
22
|
compressCommentsFlow,
|
|
24
23
|
} from "./_commons/utilities/flows.js";
|
|
25
24
|
|
|
26
|
-
// ENSURES THE CLI TOOL ONLY
|
|
25
|
+
// ENSURES THE CLI TOOL ONLY RUNS IN FOLDERS THAT POSSESS A package.json FILE AND A .git FOLDER.
|
|
27
26
|
|
|
28
27
|
if (!hasPackageJson) {
|
|
29
28
|
console.error(
|
|
@@ -42,7 +41,7 @@ if (!hasGitFolder) {
|
|
|
42
41
|
|
|
43
42
|
const commands = process.argv;
|
|
44
43
|
|
|
45
|
-
// OBTAINS THE VALIDATED FLATTENED CONFIG, REVERSE FLATTENED CONFIG, AND
|
|
44
|
+
// OBTAINS THE VALIDATED FLATTENED CONFIG, REVERSE FLATTENED CONFIG, CONFIG PATH, AND PASSED IGNORES.
|
|
46
45
|
|
|
47
46
|
// extracts the position of the --config flag
|
|
48
47
|
const configFlagIndex = commands.indexOf(configFlag);
|
|
@@ -109,7 +108,6 @@ switch (coreCommand) {
|
|
|
109
108
|
case "compress":
|
|
110
109
|
await compressCommentsFlow(ignores, reversedFlattenedConfigData);
|
|
111
110
|
break;
|
|
112
|
-
case undefined: // falls through the default
|
|
113
111
|
default:
|
|
114
112
|
if (coreCommand && !coreCommand.startsWith("--"))
|
|
115
113
|
console.error(
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comment-variables",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.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",
|
|
7
7
|
"comment-variables": "./library/index.js"
|
|
8
8
|
},
|
|
9
9
|
"main": "library/index.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"library",
|
|
12
|
+
"comments.config.js"
|
|
13
|
+
],
|
|
10
14
|
"repository": {
|
|
11
15
|
"type": "git",
|
|
12
16
|
"url": "git+https://github.com/LutherTS/jscomments.git"
|
|
13
17
|
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
16
|
-
},
|
|
17
18
|
"keywords": [
|
|
18
19
|
"cli",
|
|
19
20
|
"javascript",
|