eslint-plugin-crisp 1.5.0 → 1.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-crisp",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Custom ESLint Rules for Crisp",
5
5
  "author": "Crisp IM SAS",
6
6
  "main": "index.js",
@@ -236,6 +236,7 @@ export default function configRecommendedVue(pluginCrisp) {
236
236
  "private",
237
237
  "protected",
238
238
  "public",
239
+ "internal",
239
240
 
240
241
  "class",
241
242
 
package/recommended.js CHANGED
@@ -216,6 +216,7 @@ export default function configRecommended(pluginCrisp) {
216
216
  "private",
217
217
  "protected",
218
218
  "public",
219
+ "internal",
219
220
 
220
221
  "class",
221
222
  "classdesc",
@@ -1,4 +1,5 @@
1
1
  const SCOPE_REGEX = /^\s*\*\s*@(public|private|protected)/;
2
+ const INTERNAL_REGEX = /^\s*\*\s*@internal/;
2
3
  const GENERATOR_REGEX = /^\s*\*\s*@generator/;
3
4
  const CLASS_REGEX = /^\s*\*\s*@class\b/;
4
5
  const CLASSDESC_REGEX = /^\s*\*\s*@classdesc\s*(.*)/;
@@ -15,6 +16,7 @@ function parseJSDoc(jsdoc) {
15
16
  let classDescription = "";
16
17
  let description = "";
17
18
  let scope = "";
19
+ let internal = false;
18
20
  let generator = false;
19
21
 
20
22
  for (let i = 1; i < lines.length; i++) {
@@ -33,6 +35,7 @@ function parseJSDoc(jsdoc) {
33
35
  // If the line matches any of the other regexes, break out of the loop
34
36
  if (
35
37
  line.match(SCOPE_REGEX) ||
38
+ line.match(INTERNAL_REGEX) ||
36
39
  line.match(PARAM_REGEX) ||
37
40
  line.match(RETURN_REGEX) ||
38
41
  line.match(YIELD_REGEX)
@@ -88,13 +91,19 @@ function parseJSDoc(jsdoc) {
88
91
  scope = scopeMatch[1];
89
92
  }
90
93
 
94
+ if (line.match(INTERNAL_REGEX)) {
95
+ internal = true;
96
+ }
97
+
91
98
  const generatorMatch = line.match(GENERATOR_REGEX);
92
99
  if (generatorMatch) {
93
100
  generator = true;
94
101
  }
95
102
  }
96
103
 
97
- return { description, scope, params, returnLine, yieldLine, generator };
104
+ return {
105
+ description, scope, internal, params, returnLine, yieldLine, generator
106
+ };
98
107
  }
99
108
 
100
109
  function formatJSDoc(parsedJSDoc, indentation=0) {
@@ -123,6 +132,10 @@ function formatJSDoc(parsedJSDoc, indentation=0) {
123
132
  jsdoc += indent + "* @" + parsedJSDoc.scope + "\n";
124
133
  }
125
134
 
135
+ if (parsedJSDoc.internal) {
136
+ jsdoc += indent + "* @internal\n";
137
+ }
138
+
126
139
  if (parsedJSDoc.generator) {
127
140
  jsdoc += indent + "* @generator\n";
128
141
  }