comment-variables 1.5.7 → 1.6.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.
@@ -61,12 +61,12 @@ const composedVariablesExclusives = [
61
61
 
62
62
  /* variations */
63
63
 
64
- const variations = {
64
+ const variations = Object.freeze({
65
65
  // Defines all variants that have matching variations duly defined within the top-level keys of `data`.
66
- variants: {
67
- [EN]: { label: ENGLISH },
68
- [FR]: { label: FRANÇAIS },
69
- },
66
+ variants: Object.freeze({
67
+ [EN]: Object.freeze({ label: ENGLISH }),
68
+ [FR]: Object.freeze({ label: FRANÇAIS }),
69
+ }),
70
70
  // Defines the current variant that Comment Variables currently resolves to.
71
71
  variant: FR,
72
72
  // Defines the reference variation that all other variations need to have (or aim to have) matching keys with. Requires a JavaScript variable as it needs to be the exact same object as the one referenced at `data[variations.referenceVariant]`.
@@ -75,7 +75,7 @@ const variations = {
75
75
  referenceVariant: EN,
76
76
  // Defines the behavior of the error handling in case of variations that do not match one-to-one with the reference variation. If `true`, allows incomplete variations data to remain. If `false`, errors and guides the fixing of missing variations data.
77
77
  allowIncompleteVariations: true,
78
- }; // can be omitted
78
+ }); // can be omitted
79
79
 
80
80
  const config = {
81
81
  data,
@@ -36,6 +36,8 @@ const makeRule = (reversedFlattenedConfigData, composedVariablesExclusives) => {
36
36
  },
37
37
  create: (context) => {
38
38
  const sourceCode = context.sourceCode;
39
+ if (!sourceCode) return;
40
+
39
41
  const comments = sourceCode
40
42
  .getAllComments()
41
43
  .filter((e) => e.type !== "Shebang");
@@ -35,6 +35,8 @@ const makeRule = (
35
35
  },
36
36
  create: (context) => {
37
37
  const sourceCode = context.sourceCode;
38
+ if (!sourceCode) return;
39
+
38
40
  const comments = sourceCode
39
41
  .getAllComments()
40
42
  .filter((e) => e.type !== "Shebang");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comment-variables",
3
- "version": "1.5.7",
3
+ "version": "1.6.1",
4
4
  "description": "A CLI tool for configuring, managing and maintaining JavaScript comments as JavaScript variables.",
5
5
  "bin": {
6
6
  "comment-variables": "./library/index.js",
@@ -32,7 +32,7 @@
32
32
  "type": "module",
33
33
  "dependencies": {
34
34
  "@eslint/markdown": "^6.5.0",
35
- "comment-variables-resolve-config": "^1.17.6",
35
+ "comment-variables-resolve-config": "^1.18.0",
36
36
  "eslint": "^9.29.0",
37
37
  "prompts": "^2.4.2"
38
38
  },