comment-variables 0.14.5 → 0.14.7
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/generate.template.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// A Comment Variables config template generated in case no config file has been found. Feel free to use it as a stepping stone to learn how to use Comment Variables.
|
|
2
2
|
|
|
3
3
|
// As a first step, go ahead and run the command `comment-variables placeholders`.
|
|
4
|
-
// Then rename the `$COMMENT#COMMENT` placeholder next to `alias` to `$COMMENT#ALIAS` and run `comment-variables placeholders` to see what happens.
|
|
4
|
+
// Then rename the `$COMMENT#COMMENT` placeholder next to `alias` to `$COMMENT#ALIAS` and run again `comment-variables placeholders` to see what happens.
|
|
5
5
|
// You can now use and explore Comment Variables on the accompanying `comments.example.js` file that has also been generated.
|
|
6
6
|
|
|
7
7
|
const data = Object.freeze({
|
|
@@ -28,4 +28,4 @@ const config = {
|
|
|
28
28
|
|
|
29
29
|
export default config;
|
|
30
30
|
|
|
31
|
-
// Once you've grasped these concepts, simply
|
|
31
|
+
// Once you've grasped these concepts, simply rename this file and its JSON counterpart to `comments.config.js` and `comments.config.json` respectively and you're good to go. (If you're using the extension, make sure to run VS Code's "Developer: Reload Window" command for the extension to operate based on your new `comments.config.js` file.)
|
|
@@ -38,10 +38,10 @@ const coreCommentsFlow = async (
|
|
|
38
38
|
fix: true,
|
|
39
39
|
errorOnUnmatchedPattern: false,
|
|
40
40
|
overrideConfigFile: true,
|
|
41
|
+
ignorePatterns: ignores,
|
|
41
42
|
overrideConfig: [
|
|
42
43
|
{
|
|
43
44
|
files: allJSTSFileGlobs,
|
|
44
|
-
ignores,
|
|
45
45
|
languageOptions: typeScriptAndJSXCompatible,
|
|
46
46
|
plugins: {
|
|
47
47
|
[commentVariablesPluginName]: {
|
|
@@ -59,13 +59,11 @@ const coreCommentsFlow = async (
|
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
files: allMDFileGlobs,
|
|
62
|
-
ignores,
|
|
63
62
|
plugins: { markdown },
|
|
64
63
|
processor: "markdown/markdown",
|
|
65
64
|
},
|
|
66
65
|
{
|
|
67
66
|
files: allMDVirtualJSTSFileGlobs,
|
|
68
|
-
ignores,
|
|
69
67
|
languageOptions: typeScriptAndJSXCompatible,
|
|
70
68
|
rules: {
|
|
71
69
|
[`${commentVariablesPluginName}/${ruleName}`]: "warn",
|
package/library/index.js
CHANGED
|
@@ -72,6 +72,8 @@ const passedConfigPath =
|
|
|
72
72
|
// defaults to comments.config.js if no --config flag is set
|
|
73
73
|
let rawConfigPath = passedConfigPath ?? path.join(cwd, defaultConfigFileName);
|
|
74
74
|
|
|
75
|
+
// HANDLES TUTORIAL MODE
|
|
76
|
+
|
|
75
77
|
if (!fs.existsSync(rawConfigPath)) {
|
|
76
78
|
console.log(
|
|
77
79
|
`No Comment Variables config file found at ${rawConfigPath}. Switching to tutorial mode.`
|
|
@@ -103,6 +105,8 @@ if (!fs.existsSync(rawConfigPath)) {
|
|
|
103
105
|
rawConfigPath = templateFilePath;
|
|
104
106
|
}
|
|
105
107
|
|
|
108
|
+
// RESOLVES THE CONFIG
|
|
109
|
+
|
|
106
110
|
console.log(`Resolving config at ${rawConfigPath}...`);
|
|
107
111
|
|
|
108
112
|
const resolveConfigResults = await resolveConfig(rawConfigPath);
|
|
@@ -141,12 +145,6 @@ skipDetails || console.log("Passed ignores are:", passedIgnores);
|
|
|
141
145
|
skipDetails || console.log("lintConfigImports is:", lintConfigImports);
|
|
142
146
|
skipDetails || console.log("myIgnoresOnly are:", myIgnoresOnly);
|
|
143
147
|
|
|
144
|
-
/* IMPORTANT
|
|
145
|
-
Aside from the config flag, all other flags (`--lint-config-imports`, `--my-ignores-only`) should be included in the config so that they can be shared across the CLI and the extension within a single source of truth, invalidating the need to scream " (And DON'T FORGET YOUR FLAGS!)".
|
|
146
|
-
This didn't come to mind originally because the idea of these flags came into play before I reliably made the VS Code extension.
|
|
147
|
-
The goal therefore becomes that ONLY the config path remains the SOLE available flag for the CLI and config option for the extension that users will have to manage manually across both solutions.
|
|
148
|
-
And then I can start working on the template for Comment Variables to unleash upon asking if no config file is found. comments.template.js */
|
|
149
|
-
|
|
150
148
|
// ADDRESSES THE --lint-config-imports FLAG (lintConfigImports, no longer a flag), GIVEN THAT THE FILES IMPORTED BY THE CONFIG ARE IGNORED BY DEFAULT.
|
|
151
149
|
|
|
152
150
|
// const lintConfigImports = commands.indexOf(lintConfigImportsFlag) >= 2; // NOW FROM CONFIG
|
package/package.json
CHANGED