@thethracian/oxlint-config 0.2.1 → 0.3.0
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/CHANGELOG.md +7 -0
- package/README.md +124 -18
- package/dist/codemod-fix/cli.d.ts +3 -0
- package/dist/codemod-fix/cli.d.ts.map +1 -0
- package/dist/codemod-fix/cli.js +22 -0
- package/dist/codemod-fix/cli.js.map +1 -0
- package/dist/codemod-fix/index.d.ts +44 -0
- package/dist/codemod-fix/index.d.ts.map +1 -0
- package/dist/codemod-fix/index.js +110 -0
- package/dist/codemod-fix/index.js.map +1 -0
- package/dist/codemods/arrow-body-style.d.ts +7 -0
- package/dist/codemods/arrow-body-style.d.ts.map +1 -0
- package/dist/codemods/arrow-body-style.js +106 -0
- package/dist/codemods/arrow-body-style.js.map +1 -0
- package/dist/codemods/comment-format.d.ts +24 -0
- package/dist/codemods/comment-format.d.ts.map +1 -0
- package/dist/codemods/comment-format.js +100 -0
- package/dist/codemods/comment-format.js.map +1 -0
- package/dist/codemods/explicit-return-types.d.ts +7 -0
- package/dist/codemods/explicit-return-types.d.ts.map +1 -0
- package/dist/codemods/explicit-return-types.js +350 -0
- package/dist/codemods/explicit-return-types.js.map +1 -0
- package/dist/codemods/format-file-header.d.ts +7 -0
- package/dist/codemods/format-file-header.d.ts.map +1 -0
- package/dist/codemods/format-file-header.js +163 -0
- package/dist/codemods/format-file-header.js.map +1 -0
- package/dist/codemods/format-jsdoc-comments.d.ts +7 -0
- package/dist/codemods/format-jsdoc-comments.d.ts.map +1 -0
- package/dist/codemods/format-jsdoc-comments.js +129 -0
- package/dist/codemods/format-jsdoc-comments.js.map +1 -0
- package/dist/codemods/function-declarations.d.ts +7 -0
- package/dist/codemods/function-declarations.d.ts.map +1 -0
- package/dist/codemods/function-declarations.js +202 -0
- package/dist/codemods/function-declarations.js.map +1 -0
- package/dist/codemods/inline-export-lists.d.ts +7 -0
- package/dist/codemods/inline-export-lists.d.ts.map +1 -0
- package/dist/codemods/inline-export-lists.js +168 -0
- package/dist/codemods/inline-export-lists.js.map +1 -0
- package/dist/codemods/internal-export-docs.d.ts +7 -0
- package/dist/codemods/internal-export-docs.d.ts.map +1 -0
- package/dist/codemods/internal-export-docs.js +93 -0
- package/dist/codemods/internal-export-docs.js.map +1 -0
- package/dist/codemods/no-ternary-branch-initializers.d.ts +14 -0
- package/dist/codemods/no-ternary-branch-initializers.d.ts.map +1 -0
- package/dist/codemods/no-ternary-branch-initializers.js +240 -0
- package/dist/codemods/no-ternary-branch-initializers.js.map +1 -0
- package/dist/codemods/no-ternary-variable-initializers.d.ts +14 -0
- package/dist/codemods/no-ternary-variable-initializers.d.ts.map +1 -0
- package/dist/codemods/no-ternary-variable-initializers.js +235 -0
- package/dist/codemods/no-ternary-variable-initializers.js.map +1 -0
- package/dist/codemods/no-ternary.d.ts +7 -0
- package/dist/codemods/no-ternary.d.ts.map +1 -0
- package/dist/codemods/no-ternary.js +215 -0
- package/dist/codemods/no-ternary.js.map +1 -0
- package/dist/codemods/rename-acronyms.d.ts +8 -0
- package/dist/codemods/rename-acronyms.d.ts.map +1 -0
- package/dist/codemods/rename-acronyms.js +193 -0
- package/dist/codemods/rename-acronyms.js.map +1 -0
- package/dist/codemods/run.d.ts +2 -0
- package/dist/codemods/run.d.ts.map +1 -0
- package/dist/codemods/run.js +14 -0
- package/dist/codemods/run.js.map +1 -0
- package/dist/codemods/sort-imports.d.ts +7 -0
- package/dist/codemods/sort-imports.d.ts.map +1 -0
- package/dist/codemods/sort-imports.js +235 -0
- package/dist/codemods/sort-imports.js.map +1 -0
- package/dist/index.d.ts +30 -96
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +156 -94
- package/dist/index.js.map +1 -1
- package/dist/rules/acronym-case.d.ts +7 -3
- package/dist/rules/acronym-case.d.ts.map +1 -1
- package/dist/rules/acronym-case.js +129 -118
- package/dist/rules/acronym-case.js.map +1 -1
- package/dist/rules/acronyms-1.d.ts +3 -0
- package/dist/rules/acronyms-1.d.ts.map +1 -0
- package/dist/rules/acronyms-1.js +407 -0
- package/dist/rules/acronyms-1.js.map +1 -0
- package/dist/rules/acronyms-2.d.ts +3 -0
- package/dist/rules/acronyms-2.d.ts.map +1 -0
- package/dist/rules/acronyms-2.js +407 -0
- package/dist/rules/acronyms-2.js.map +1 -0
- package/dist/rules/acronyms-3.d.ts +3 -0
- package/dist/rules/acronyms-3.d.ts.map +1 -0
- package/dist/rules/acronyms-3.js +407 -0
- package/dist/rules/acronyms-3.js.map +1 -0
- package/dist/rules/acronyms-4.d.ts +3 -0
- package/dist/rules/acronyms-4.d.ts.map +1 -0
- package/dist/rules/acronyms-4.js +377 -0
- package/dist/rules/acronyms-4.js.map +1 -0
- package/dist/rules/acronyms.d.ts +1 -8
- package/dist/rules/acronyms.d.ts.map +1 -1
- package/dist/rules/acronyms.js +14 -1578
- package/dist/rules/acronyms.js.map +1 -1
- package/dist/rules/boolean-prefix.d.ts +11 -2
- package/dist/rules/boolean-prefix.d.ts.map +1 -1
- package/dist/rules/boolean-prefix.js +95 -59
- package/dist/rules/boolean-prefix.js.map +1 -1
- package/dist/rules/camel-case-identifiers.d.ts +3 -4
- package/dist/rules/camel-case-identifiers.d.ts.map +1 -1
- package/dist/rules/camel-case-identifiers.js +59 -40
- package/dist/rules/camel-case-identifiers.js.map +1 -1
- package/dist/rules/char-class.d.ts +26 -13
- package/dist/rules/char-class.d.ts.map +1 -1
- package/dist/rules/char-class.js +56 -24
- package/dist/rules/char-class.js.map +1 -1
- package/dist/rules/diagnostic-guidance.d.ts +91 -0
- package/dist/rules/diagnostic-guidance.d.ts.map +1 -0
- package/dist/rules/diagnostic-guidance.js +243 -0
- package/dist/rules/diagnostic-guidance.js.map +1 -0
- package/dist/rules/effect-default-ast.d.ts +89 -0
- package/dist/rules/effect-default-ast.d.ts.map +1 -0
- package/dist/rules/effect-default-ast.js +208 -0
- package/dist/rules/effect-default-ast.js.map +1 -0
- package/dist/rules/effect-default-compat-rules.d.ts +76 -0
- package/dist/rules/effect-default-compat-rules.d.ts.map +1 -0
- package/dist/rules/effect-default-compat-rules.js +270 -0
- package/dist/rules/effect-default-compat-rules.js.map +1 -0
- package/dist/rules/effect-default-env-rules.d.ts +60 -0
- package/dist/rules/effect-default-env-rules.d.ts.map +1 -0
- package/dist/rules/effect-default-env-rules.js +259 -0
- package/dist/rules/effect-default-env-rules.js.map +1 -0
- package/dist/rules/effect-default-fiber-helpers.d.ts +13 -0
- package/dist/rules/effect-default-fiber-helpers.d.ts.map +1 -0
- package/dist/rules/effect-default-fiber-helpers.js +76 -0
- package/dist/rules/effect-default-fiber-helpers.js.map +1 -0
- package/dist/rules/effect-default-floating-helpers.d.ts +7 -0
- package/dist/rules/effect-default-floating-helpers.d.ts.map +1 -0
- package/dist/rules/effect-default-floating-helpers.js +113 -0
- package/dist/rules/effect-default-floating-helpers.js.map +1 -0
- package/dist/rules/effect-default-helpers.d.ts +8 -32
- package/dist/rules/effect-default-helpers.d.ts.map +1 -1
- package/dist/rules/effect-default-helpers.js +11 -535
- package/dist/rules/effect-default-helpers.js.map +1 -1
- package/dist/rules/effect-default-resource-helpers.d.ts +18 -4
- package/dist/rules/effect-default-resource-helpers.d.ts.map +1 -1
- package/dist/rules/effect-default-resource-helpers.js +30 -13
- package/dist/rules/effect-default-resource-helpers.js.map +1 -1
- package/dist/rules/effect-default-safety-helpers.d.ts +43 -0
- package/dist/rules/effect-default-safety-helpers.d.ts.map +1 -0
- package/dist/rules/effect-default-safety-helpers.js +126 -0
- package/dist/rules/effect-default-safety-helpers.js.map +1 -0
- package/dist/rules/effect-default-scan-helpers.d.ts +43 -0
- package/dist/rules/effect-default-scan-helpers.d.ts.map +1 -0
- package/dist/rules/effect-default-scan-helpers.js +141 -0
- package/dist/rules/effect-default-scan-helpers.js.map +1 -0
- package/dist/rules/effect-default-schema-helpers.d.ts +37 -0
- package/dist/rules/effect-default-schema-helpers.d.ts.map +1 -0
- package/dist/rules/effect-default-schema-helpers.js +104 -0
- package/dist/rules/effect-default-schema-helpers.js.map +1 -0
- package/dist/rules/effect-default-test-helpers.d.ts +18 -4
- package/dist/rules/effect-default-test-helpers.d.ts.map +1 -1
- package/dist/rules/effect-default-test-helpers.js +41 -20
- package/dist/rules/effect-default-test-helpers.js.map +1 -1
- package/dist/rules/effect-default-workflow-helpers.d.ts +91 -0
- package/dist/rules/effect-default-workflow-helpers.d.ts.map +1 -0
- package/dist/rules/effect-default-workflow-helpers.js +247 -0
- package/dist/rules/effect-default-workflow-helpers.js.map +1 -0
- package/dist/rules/effect-default.d.ts +1 -1
- package/dist/rules/effect-default.d.ts.map +1 -1
- package/dist/rules/effect-default.js +105 -680
- package/dist/rules/effect-default.js.map +1 -1
- package/dist/rules/effect-exported-declarations.d.ts +19 -0
- package/dist/rules/effect-exported-declarations.d.ts.map +1 -0
- package/dist/rules/effect-exported-declarations.js +237 -0
- package/dist/rules/effect-exported-declarations.js.map +1 -0
- package/dist/rules/effect-path-options.d.ts +49 -11
- package/dist/rules/effect-path-options.d.ts.map +1 -1
- package/dist/rules/effect-path-options.js +85 -52
- package/dist/rules/effect-path-options.js.map +1 -1
- package/dist/rules/effect-rule-aliases.d.ts +55 -0
- package/dist/rules/effect-rule-aliases.d.ts.map +1 -0
- package/dist/rules/effect-rule-aliases.js +278 -0
- package/dist/rules/effect-rule-aliases.js.map +1 -0
- package/dist/rules/effect-rule-core.d.ts +38 -24
- package/dist/rules/effect-rule-core.d.ts.map +1 -1
- package/dist/rules/effect-rule-core.js +157 -344
- package/dist/rules/effect-rule-core.js.map +1 -1
- package/dist/rules/effect-rule-names.d.ts +12 -3
- package/dist/rules/effect-rule-names.d.ts.map +1 -1
- package/dist/rules/effect-rule-names.js +15 -3
- package/dist/rules/effect-rule-names.js.map +1 -1
- package/dist/rules/effect-source-comments.d.ts +7 -0
- package/dist/rules/effect-source-comments.d.ts.map +1 -0
- package/dist/rules/effect-source-comments.js +227 -0
- package/dist/rules/effect-source-comments.js.map +1 -0
- package/dist/rules/effect-source-helpers.d.ts +4 -9
- package/dist/rules/effect-source-helpers.d.ts.map +1 -1
- package/dist/rules/effect-source-helpers.js +7 -358
- package/dist/rules/effect-source-helpers.js.map +1 -1
- package/dist/rules/effect-source-navigation.d.ts +25 -0
- package/dist/rules/effect-source-navigation.d.ts.map +1 -0
- package/dist/rules/effect-source-navigation.js +244 -0
- package/dist/rules/effect-source-navigation.js.map +1 -0
- package/dist/rules/effect-source-scan.d.ts +30 -7
- package/dist/rules/effect-source-scan.d.ts.map +1 -1
- package/dist/rules/effect-source-scan.js +372 -300
- package/dist/rules/effect-source-scan.js.map +1 -1
- package/dist/rules/effect-strict-ast-specs.d.ts +8 -0
- package/dist/rules/effect-strict-ast-specs.d.ts.map +1 -0
- package/dist/rules/effect-strict-ast-specs.js +166 -0
- package/dist/rules/effect-strict-ast-specs.js.map +1 -0
- package/dist/rules/effect-strict-boundary-helpers.d.ts +25 -0
- package/dist/rules/effect-strict-boundary-helpers.d.ts.map +1 -0
- package/dist/rules/effect-strict-boundary-helpers.js +127 -0
- package/dist/rules/effect-strict-boundary-helpers.js.map +1 -0
- package/dist/rules/effect-strict-core-specs.d.ts +8 -0
- package/dist/rules/effect-strict-core-specs.d.ts.map +1 -0
- package/dist/rules/effect-strict-core-specs.js +334 -0
- package/dist/rules/effect-strict-core-specs.js.map +1 -0
- package/dist/rules/effect-strict-external-helpers.d.ts +25 -0
- package/dist/rules/effect-strict-external-helpers.d.ts.map +1 -0
- package/dist/rules/effect-strict-external-helpers.js +87 -0
- package/dist/rules/effect-strict-external-helpers.js.map +1 -0
- package/dist/rules/effect-strict-helpers.d.ts +75 -33
- package/dist/rules/effect-strict-helpers.d.ts.map +1 -1
- package/dist/rules/effect-strict-helpers.js +93 -384
- package/dist/rules/effect-strict-helpers.js.map +1 -1
- package/dist/rules/effect-strict-internals.d.ts +198 -0
- package/dist/rules/effect-strict-internals.d.ts.map +1 -0
- package/dist/rules/effect-strict-internals.js +477 -0
- package/dist/rules/effect-strict-internals.js.map +1 -0
- package/dist/rules/effect-strict-segment-helpers.d.ts +79 -0
- package/dist/rules/effect-strict-segment-helpers.d.ts.map +1 -0
- package/dist/rules/effect-strict-segment-helpers.js +308 -0
- package/dist/rules/effect-strict-segment-helpers.js.map +1 -0
- package/dist/rules/effect-strict.d.ts +1 -1
- package/dist/rules/effect-strict.d.ts.map +1 -1
- package/dist/rules/effect-strict.js +10 -725
- package/dist/rules/effect-strict.js.map +1 -1
- package/dist/rules/max-import-depth.d.ts +2 -2
- package/dist/rules/max-import-depth.d.ts.map +1 -1
- package/dist/rules/max-import-depth.js +52 -17
- package/dist/rules/max-import-depth.js.map +1 -1
- package/dist/rules/max-line-length.d.ts +9 -2
- package/dist/rules/max-line-length.d.ts.map +1 -1
- package/dist/rules/max-line-length.js +52 -15
- package/dist/rules/max-line-length.js.map +1 -1
- package/dist/rules/no-commented-out-code.d.ts +3 -7
- package/dist/rules/no-commented-out-code.d.ts.map +1 -1
- package/dist/rules/no-commented-out-code.js +157 -102
- package/dist/rules/no-commented-out-code.js.map +1 -1
- package/dist/rules/pascal-case-types.d.ts +1 -1
- package/dist/rules/pascal-case-types.d.ts.map +1 -1
- package/dist/rules/pascal-case-types.js +65 -46
- package/dist/rules/pascal-case-types.js.map +1 -1
- package/dist/rules/plugin-commented-out-code-rule.d.ts +32 -0
- package/dist/rules/plugin-commented-out-code-rule.d.ts.map +1 -0
- package/dist/rules/plugin-commented-out-code-rule.js +135 -0
- package/dist/rules/plugin-commented-out-code-rule.js.map +1 -0
- package/dist/rules/plugin.d.ts +1 -0
- package/dist/rules/plugin.d.ts.map +1 -1
- package/dist/rules/plugin.js +164 -154
- package/dist/rules/plugin.js.map +1 -1
- package/dist/rules/private-underscore.d.ts +1 -1
- package/dist/rules/private-underscore.d.ts.map +1 -1
- package/dist/rules/private-underscore.js +11 -4
- package/dist/rules/private-underscore.js.map +1 -1
- package/dist/rules/require-file-doc.d.ts +5 -6
- package/dist/rules/require-file-doc.d.ts.map +1 -1
- package/dist/rules/require-file-doc.js +127 -78
- package/dist/rules/require-file-doc.js.map +1 -1
- package/dist/rules/require-function-doc-ignored-text.d.ts +7 -0
- package/dist/rules/require-function-doc-ignored-text.d.ts.map +1 -0
- package/dist/rules/require-function-doc-ignored-text.js +67 -0
- package/dist/rules/require-function-doc-ignored-text.js.map +1 -0
- package/dist/rules/require-function-doc-local-exports.d.ts +7 -0
- package/dist/rules/require-function-doc-local-exports.d.ts.map +1 -0
- package/dist/rules/require-function-doc-local-exports.js +114 -0
- package/dist/rules/require-function-doc-local-exports.js.map +1 -0
- package/dist/rules/require-function-doc.d.ts +3 -18
- package/dist/rules/require-function-doc.d.ts.map +1 -1
- package/dist/rules/require-function-doc.js +396 -221
- package/dist/rules/require-function-doc.js.map +1 -1
- package/dist/rules/source-cache.d.ts +13 -5
- package/dist/rules/source-cache.d.ts.map +1 -1
- package/dist/rules/source-cache.js +35 -22
- package/dist/rules/source-cache.js.map +1 -1
- package/package.json +10 -2
|
@@ -1,78 +1,154 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
/* -------------------------------------------------------------------------- */
|
|
2
|
+
/* Exported-declaration documentation requirement helper for custom Oxlint */
|
|
3
|
+
/* Rules. */
|
|
4
|
+
/* -------------------------------------------------------------------------- */
|
|
5
|
+
import { isDocumentedLocalExportList } from './require-function-doc-local-exports.js';
|
|
6
|
+
import { isInsideIgnoredText } from './require-function-doc-ignored-text.js';
|
|
7
|
+
const CHAR_CODE_SPACE = 32;
|
|
8
|
+
const CHAR_CODE_TAB = 9;
|
|
9
|
+
const CHAR_CODE_NEWLINE = 10;
|
|
10
|
+
const CHAR_CODE_CARRIAGE_RETURN = 13;
|
|
11
|
+
const CHAR_CODE_ASTERISK = 42;
|
|
12
|
+
const CHAR_CODE_SLASH = 47;
|
|
13
|
+
const CHAR_CODE_HASH = 35;
|
|
14
|
+
const CHAR_CODE_AT_SIGN = 64;
|
|
15
|
+
const CHAR_CODE_OPEN_PAREN = 40;
|
|
16
|
+
const CHAR_CODE_OPEN_BRACE = 123;
|
|
17
|
+
const CHAR_CODE_SEMICOLON = 59;
|
|
18
|
+
const CHAR_CODE_LESS_THAN = 60;
|
|
19
|
+
const CHAR_CODE_LOWER_A = 97;
|
|
20
|
+
const CHAR_CODE_LOWER_C = 99;
|
|
21
|
+
const CHAR_CODE_LOWER_D = 100;
|
|
22
|
+
const CHAR_CODE_LOWER_E = 101;
|
|
23
|
+
const CHAR_CODE_LOWER_F = 102;
|
|
24
|
+
const CHAR_CODE_LOWER_I = 105;
|
|
25
|
+
const CHAR_CODE_LOWER_L = 108;
|
|
26
|
+
const CHAR_CODE_LOWER_N = 110;
|
|
27
|
+
const CHAR_CODE_LOWER_T = 116;
|
|
28
|
+
const CHAR_CODE_LOWER_V = 118;
|
|
29
|
+
const CHAR_CODE_UPPER_C = 67;
|
|
30
|
+
const CHAR_CODE_UPPER_E = 69;
|
|
31
|
+
const CHAR_CODE_UPPER_F = 70;
|
|
32
|
+
const CHAR_CODE_UPPER_I = 73;
|
|
33
|
+
const CHAR_CODE_UPPER_L = 76;
|
|
34
|
+
const CHAR_CODE_UPPER_N = 78;
|
|
35
|
+
const CHAR_CODE_UPPER_V = 86;
|
|
36
|
+
const ASYNC_KEYWORD_LENGTH = 'async '.length;
|
|
37
|
+
const TYPE_KEYWORD_LENGTH = 'type '.length;
|
|
38
|
+
const EXPORT_KEYWORD_LENGTH = 'export '.length;
|
|
39
|
+
const DEFAULT_KEYWORD_LENGTH = 'default '.length;
|
|
40
|
+
const DECLARE_KEYWORD_LENGTH = 'declare '.length;
|
|
41
|
+
const ABSTRACT_KEYWORD_LENGTH = 'abstract '.length;
|
|
42
|
+
const isWhitespace = (code) => code === CHAR_CODE_SPACE ||
|
|
43
|
+
code === CHAR_CODE_TAB ||
|
|
44
|
+
code === CHAR_CODE_NEWLINE ||
|
|
45
|
+
code === CHAR_CODE_CARRIAGE_RETURN;
|
|
46
|
+
const lineEndFor = (source, lineStart, len) => {
|
|
47
|
+
const newlineIndex = source.indexOf('\n', lineStart);
|
|
48
|
+
if (newlineIndex === -1) {
|
|
49
|
+
return len;
|
|
50
|
+
}
|
|
51
|
+
return newlineIndex;
|
|
52
|
+
};
|
|
53
|
+
const skipLinePrefix = (source, pos, lineEnd) => {
|
|
54
|
+
let cursor = pos;
|
|
55
|
+
while (cursor < lineEnd && isWhitespace(source.charCodeAt(cursor))) {
|
|
56
|
+
cursor++;
|
|
57
|
+
}
|
|
58
|
+
if (cursor < lineEnd && source.charCodeAt(cursor) === CHAR_CODE_ASTERISK) {
|
|
59
|
+
cursor++;
|
|
60
|
+
}
|
|
61
|
+
while (cursor < lineEnd && isWhitespace(source.charCodeAt(cursor))) {
|
|
62
|
+
cursor++;
|
|
63
|
+
}
|
|
64
|
+
return cursor;
|
|
65
|
+
};
|
|
66
|
+
const isJSDocTagLine = (source, pos, lineEnd) => pos < lineEnd && source.charCodeAt(pos) === CHAR_CODE_AT_SIGN;
|
|
67
|
+
const lineHasDescriptionContent = (source, lineStart, lineEnd) => {
|
|
68
|
+
let pos = skipLinePrefix(source, lineStart, lineEnd);
|
|
69
|
+
if (isJSDocTagLine(source, pos, lineEnd)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
while (pos < lineEnd) {
|
|
73
|
+
if (!isWhitespace(source.charCodeAt(pos))) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
pos++;
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
};
|
|
80
|
+
const nextDescriptionLineStart = (newlineIndex) => {
|
|
81
|
+
if (newlineIndex === -1) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
return newlineIndex + 1;
|
|
85
|
+
};
|
|
86
|
+
const hasDescriptionLine = (jsdocBody, lineStart, len) => {
|
|
87
|
+
const newlineIndex = jsdocBody.indexOf('\n', lineStart);
|
|
88
|
+
const lineEnd = lineEndFor(jsdocBody, lineStart, len);
|
|
89
|
+
if (lineHasDescriptionContent(jsdocBody, lineStart, lineEnd)) {
|
|
90
|
+
return { found: true };
|
|
91
|
+
}
|
|
92
|
+
return { found: false, nextLineStart: nextDescriptionLineStart(newlineIndex) };
|
|
93
|
+
};
|
|
94
|
+
const hasDescriptionContent = (jsdocBody) => {
|
|
21
95
|
let lineStart = 0;
|
|
22
96
|
const len = jsdocBody.length;
|
|
23
97
|
while (lineStart <= len) {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
while (pos < lineEnd && isWhitespace(jsdocBody.charCodeAt(pos))) {
|
|
28
|
-
pos++;
|
|
29
|
-
}
|
|
30
|
-
if (pos < lineEnd && jsdocBody.charCodeAt(pos) === 42) {
|
|
31
|
-
pos++;
|
|
32
|
-
while (pos < lineEnd && isWhitespace(jsdocBody.charCodeAt(pos))) {
|
|
33
|
-
pos++;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
while (pos < lineEnd) {
|
|
37
|
-
if (!isWhitespace(jsdocBody.charCodeAt(pos))) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
pos++;
|
|
98
|
+
const result = hasDescriptionLine(jsdocBody, lineStart, len);
|
|
99
|
+
if (result.found) {
|
|
100
|
+
return true;
|
|
41
101
|
}
|
|
42
|
-
if (
|
|
102
|
+
if (result.nextLineStart === undefined) {
|
|
43
103
|
return false;
|
|
44
104
|
}
|
|
45
|
-
lineStart =
|
|
105
|
+
lineStart = result.nextLineStart;
|
|
46
106
|
}
|
|
47
107
|
return false;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
let
|
|
51
|
-
while (
|
|
52
|
-
|
|
108
|
+
};
|
|
109
|
+
const skipWhitespaceBack = (source, pos) => {
|
|
110
|
+
let cursor = pos;
|
|
111
|
+
while (cursor > 0 && isWhitespace(source.charCodeAt(cursor - 1))) {
|
|
112
|
+
cursor--;
|
|
53
113
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
114
|
+
return cursor;
|
|
115
|
+
};
|
|
116
|
+
const hasBlockCommentCloseAt = (source, pos) => pos >= '*/'.length &&
|
|
117
|
+
source.charCodeAt(pos - '*/'.length) === CHAR_CODE_ASTERISK &&
|
|
118
|
+
source.charCodeAt(pos - 1) === CHAR_CODE_SLASH;
|
|
119
|
+
const jsdocContentBeforeClose = (source, open, closeStar) => {
|
|
120
|
+
if (open + 1 < closeStar && source.charCodeAt(open + 1) === CHAR_CODE_ASTERISK) {
|
|
121
|
+
return source.slice(open + '/**'.length, closeStar).trim();
|
|
59
122
|
}
|
|
60
|
-
|
|
123
|
+
return undefined;
|
|
124
|
+
};
|
|
125
|
+
const previousJSDocContent = (source, closeStar) => {
|
|
61
126
|
let open = closeStar - 1;
|
|
62
127
|
while (open > 0) {
|
|
63
|
-
if (source.charCodeAt(open) ===
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
128
|
+
if (source.charCodeAt(open) === CHAR_CODE_ASTERISK &&
|
|
129
|
+
source.charCodeAt(open - 1) === CHAR_CODE_SLASH) {
|
|
130
|
+
const content = jsdocContentBeforeClose(source, open, closeStar);
|
|
131
|
+
if (content !== undefined) {
|
|
132
|
+
return content;
|
|
67
133
|
}
|
|
68
|
-
open -=
|
|
69
|
-
|
|
134
|
+
open -= '/*'.length;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
open--;
|
|
70
138
|
}
|
|
71
|
-
open--;
|
|
72
139
|
}
|
|
73
|
-
return
|
|
74
|
-
}
|
|
75
|
-
|
|
140
|
+
return undefined;
|
|
141
|
+
};
|
|
142
|
+
const hasJSDocBefore = (source, exportPOS) => {
|
|
143
|
+
const pos = skipWhitespaceBack(source, exportPOS);
|
|
144
|
+
if (!hasBlockCommentCloseAt(source, pos)) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
const closeStar = pos - '*/'.length;
|
|
148
|
+
const content = previousJSDocContent(source, closeStar);
|
|
149
|
+
return content !== undefined && hasDescriptionContent(content);
|
|
150
|
+
};
|
|
151
|
+
const endsWithWord = (source, pos, word) => {
|
|
76
152
|
const end = pos + word.length;
|
|
77
153
|
if (end > source.length) {
|
|
78
154
|
return false;
|
|
@@ -84,196 +160,295 @@ function endsWithWord(source, pos, word) {
|
|
|
84
160
|
return true;
|
|
85
161
|
}
|
|
86
162
|
const next = source.charCodeAt(end);
|
|
87
|
-
return isWhitespace(next) ||
|
|
88
|
-
|
|
89
|
-
|
|
163
|
+
return (isWhitespace(next) ||
|
|
164
|
+
next === CHAR_CODE_OPEN_PAREN ||
|
|
165
|
+
next === CHAR_CODE_OPEN_BRACE ||
|
|
166
|
+
next === CHAR_CODE_SEMICOLON ||
|
|
167
|
+
next === CHAR_CODE_LESS_THAN);
|
|
168
|
+
};
|
|
169
|
+
const isDefaultDeclaration = (source, pos, _len) => {
|
|
90
170
|
const ch = source.charCodeAt(pos);
|
|
91
|
-
if (ch ===
|
|
171
|
+
if (ch === CHAR_CODE_LOWER_F) {
|
|
92
172
|
return endsWithWord(source, pos, 'function');
|
|
93
173
|
}
|
|
94
|
-
if (ch ===
|
|
174
|
+
if (ch === CHAR_CODE_LOWER_C) {
|
|
95
175
|
return endsWithWord(source, pos, 'class');
|
|
96
176
|
}
|
|
97
|
-
if (ch ===
|
|
177
|
+
if (ch === CHAR_CODE_LOWER_I) {
|
|
98
178
|
return endsWithWord(source, pos, 'interface');
|
|
99
179
|
}
|
|
100
180
|
return false;
|
|
101
|
-
}
|
|
181
|
+
};
|
|
102
182
|
const AMBIENT_DECLARE_PREFIXES = ['declare module', 'declare namespace', 'declare global'];
|
|
103
|
-
|
|
104
|
-
let
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return false;
|
|
183
|
+
const skipShebangComments = (source, idx) => {
|
|
184
|
+
let cursor = idx;
|
|
185
|
+
while (cursor < source.length && source.charCodeAt(cursor) === CHAR_CODE_HASH) {
|
|
186
|
+
cursor = source.indexOf('\n', cursor);
|
|
187
|
+
if (cursor === -1) {
|
|
188
|
+
return undefined;
|
|
110
189
|
}
|
|
111
|
-
|
|
190
|
+
cursor++;
|
|
191
|
+
}
|
|
192
|
+
return cursor;
|
|
193
|
+
};
|
|
194
|
+
const skipBlockComment = (source, idx) => {
|
|
195
|
+
const close = source.indexOf('*/', idx + '/*'.length);
|
|
196
|
+
if (close === -1) {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
return close + '*/'.length;
|
|
200
|
+
};
|
|
201
|
+
const skipLineComment = (source, idx) => {
|
|
202
|
+
const nl = source.indexOf('\n', idx);
|
|
203
|
+
if (nl === -1) {
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
206
|
+
return nl + 1;
|
|
207
|
+
};
|
|
208
|
+
const skipTriviaToken = (source, idx) => {
|
|
209
|
+
const ch = source.charCodeAt(idx);
|
|
210
|
+
if (isWhitespace(ch)) {
|
|
211
|
+
return idx + 1;
|
|
212
|
+
}
|
|
213
|
+
if (ch === CHAR_CODE_SLASH &&
|
|
214
|
+
idx + 1 < source.length &&
|
|
215
|
+
source.charCodeAt(idx + 1) === CHAR_CODE_ASTERISK) {
|
|
216
|
+
return skipBlockComment(source, idx);
|
|
217
|
+
}
|
|
218
|
+
if (ch === CHAR_CODE_SLASH &&
|
|
219
|
+
idx + 1 < source.length &&
|
|
220
|
+
source.charCodeAt(idx + 1) === CHAR_CODE_SLASH) {
|
|
221
|
+
return skipLineComment(source, idx);
|
|
112
222
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
223
|
+
return idx;
|
|
224
|
+
};
|
|
225
|
+
const skipLeadingTrivia = (source, idx) => {
|
|
226
|
+
let cursor = idx;
|
|
227
|
+
while (cursor < source.length) {
|
|
228
|
+
const next = skipTriviaToken(source, cursor);
|
|
229
|
+
if (next === undefined) {
|
|
230
|
+
return undefined;
|
|
118
231
|
}
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
if (close !== -1) {
|
|
122
|
-
idx = close + 2;
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
return false;
|
|
232
|
+
if (next === cursor) {
|
|
233
|
+
return cursor;
|
|
126
234
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
235
|
+
cursor = next;
|
|
236
|
+
}
|
|
237
|
+
return cursor;
|
|
238
|
+
};
|
|
239
|
+
const hasAmbientPrefixAt = (source, idx) => AMBIENT_DECLARE_PREFIXES.some((prefix) => idx + prefix.length <= source.length && source.slice(idx, idx + prefix.length) === prefix);
|
|
240
|
+
const isAmbientDeclarationFile = (source) => {
|
|
241
|
+
const shebangEnd = skipShebangComments(source, 0);
|
|
242
|
+
if (shebangEnd === undefined) {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
const idx = skipLeadingTrivia(source, shebangEnd);
|
|
246
|
+
if (idx === undefined || idx >= source.length) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
return hasAmbientPrefixAt(source, idx);
|
|
250
|
+
};
|
|
251
|
+
const nextExportPosition = (source, start) => {
|
|
252
|
+
const exp = source.indexOf('export ', start);
|
|
253
|
+
if (exp === -1) {
|
|
254
|
+
return undefined;
|
|
255
|
+
}
|
|
256
|
+
return exp;
|
|
257
|
+
};
|
|
258
|
+
const isStandaloneExportKeyword = (source, exp) => {
|
|
259
|
+
if (exp === 0) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
return isWhitespace(source.charCodeAt(exp - 1));
|
|
263
|
+
};
|
|
264
|
+
const isDeclareExport = (source, exp) => exp >= DECLARE_KEYWORD_LENGTH && source.slice(exp - DECLARE_KEYWORD_LENGTH, exp) === 'declare ';
|
|
265
|
+
const skipWhitespace = (source, pos) => {
|
|
266
|
+
let cursor = pos;
|
|
267
|
+
while (cursor < source.length && isWhitespace(source.charCodeAt(cursor))) {
|
|
268
|
+
cursor++;
|
|
269
|
+
}
|
|
270
|
+
return cursor;
|
|
271
|
+
};
|
|
272
|
+
const isReExportAt = (source, afterExport) => {
|
|
273
|
+
if (afterExport >= source.length) {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
const c0 = source.charCodeAt(afterExport);
|
|
277
|
+
if (c0 === CHAR_CODE_OPEN_BRACE || c0 === CHAR_CODE_ASTERISK) {
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
if (c0 !== CHAR_CODE_LOWER_T ||
|
|
281
|
+
afterExport + TYPE_KEYWORD_LENGTH > source.length ||
|
|
282
|
+
source.slice(afterExport, afterExport + TYPE_KEYWORD_LENGTH) !== 'type ') {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
const afterType = afterExport + TYPE_KEYWORD_LENGTH;
|
|
286
|
+
return afterType < source.length && source.charCodeAt(afterType) === CHAR_CODE_OPEN_BRACE;
|
|
287
|
+
};
|
|
288
|
+
const modifierSpecs = [
|
|
289
|
+
{
|
|
290
|
+
charCode: CHAR_CODE_LOWER_D,
|
|
291
|
+
isDefault: true,
|
|
292
|
+
length: DEFAULT_KEYWORD_LENGTH,
|
|
293
|
+
shouldStop: false,
|
|
294
|
+
text: 'default ',
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
charCode: CHAR_CODE_LOWER_A,
|
|
298
|
+
isDefault: false,
|
|
299
|
+
length: ASYNC_KEYWORD_LENGTH,
|
|
300
|
+
shouldStop: false,
|
|
301
|
+
text: 'async ',
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
charCode: CHAR_CODE_LOWER_A,
|
|
305
|
+
isDefault: false,
|
|
306
|
+
length: ABSTRACT_KEYWORD_LENGTH,
|
|
307
|
+
shouldStop: false,
|
|
308
|
+
text: 'abstract ',
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
charCode: CHAR_CODE_LOWER_T,
|
|
312
|
+
isDefault: false,
|
|
313
|
+
length: TYPE_KEYWORD_LENGTH,
|
|
314
|
+
shouldStop: false,
|
|
315
|
+
text: 'type ',
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
charCode: CHAR_CODE_LOWER_N,
|
|
319
|
+
isDefault: false,
|
|
320
|
+
length: 0,
|
|
321
|
+
shouldStop: true,
|
|
322
|
+
text: 'namespace ',
|
|
323
|
+
},
|
|
324
|
+
];
|
|
325
|
+
const modifierSpecMatches = (source, pos, spec) => source.charCodeAt(pos) === spec.charCode &&
|
|
326
|
+
pos + spec.text.length <= source.length &&
|
|
327
|
+
source.slice(pos, pos + spec.text.length) === spec.text;
|
|
328
|
+
const modifierLengthAt = (source, pos) => {
|
|
329
|
+
for (const spec of modifierSpecs) {
|
|
330
|
+
if (modifierSpecMatches(source, pos, spec)) {
|
|
331
|
+
return spec;
|
|
134
332
|
}
|
|
135
|
-
break;
|
|
136
333
|
}
|
|
137
|
-
|
|
334
|
+
return undefined;
|
|
335
|
+
};
|
|
336
|
+
const scanExportModifiers = (source, start) => {
|
|
337
|
+
let pos = start;
|
|
338
|
+
let hasSawDefault = false;
|
|
339
|
+
let modifier = modifierLengthAt(source, pos);
|
|
340
|
+
while (modifier && !modifier.shouldStop) {
|
|
341
|
+
hasSawDefault ||= modifier.isDefault;
|
|
342
|
+
pos = skipWhitespace(source, pos + modifier.length);
|
|
343
|
+
modifier = modifierLengthAt(source, pos);
|
|
344
|
+
}
|
|
345
|
+
return { hasSawDefault, pos };
|
|
346
|
+
};
|
|
347
|
+
const declarationStartCodes = new Set([
|
|
348
|
+
CHAR_CODE_LOWER_F,
|
|
349
|
+
CHAR_CODE_UPPER_F,
|
|
350
|
+
CHAR_CODE_LOWER_C,
|
|
351
|
+
CHAR_CODE_UPPER_C,
|
|
352
|
+
CHAR_CODE_LOWER_I,
|
|
353
|
+
CHAR_CODE_UPPER_I,
|
|
354
|
+
CHAR_CODE_LOWER_E,
|
|
355
|
+
CHAR_CODE_UPPER_E,
|
|
356
|
+
CHAR_CODE_LOWER_L,
|
|
357
|
+
CHAR_CODE_UPPER_L,
|
|
358
|
+
CHAR_CODE_LOWER_V,
|
|
359
|
+
CHAR_CODE_UPPER_V,
|
|
360
|
+
CHAR_CODE_LOWER_N,
|
|
361
|
+
CHAR_CODE_UPPER_N,
|
|
362
|
+
]);
|
|
363
|
+
const isDeclarationStartCode = (code) => declarationStartCodes.has(code);
|
|
364
|
+
const canSkipDocumentedExport = (source, modifiers) => {
|
|
365
|
+
if (modifiers.pos >= source.length) {
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
const next = source.charCodeAt(modifiers.pos);
|
|
369
|
+
if (!isDeclarationStartCode(next)) {
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
return modifiers.hasSawDefault && !isDefaultDeclaration(source, modifiers.pos, source.length);
|
|
373
|
+
};
|
|
374
|
+
const documentedLocalExportListResult = (source, after, exp) => isDocumentedLocalExportList(source, after, exp, hasJSDocBefore);
|
|
375
|
+
const exhaustedExportDocResult = (source, after) => {
|
|
376
|
+
if (after >= source.length) {
|
|
377
|
+
return true;
|
|
378
|
+
}
|
|
379
|
+
return undefined;
|
|
380
|
+
};
|
|
381
|
+
const earlyExportDocResult = (source, after, exp) => {
|
|
382
|
+
const exhaustedExport = exhaustedExportDocResult(source, after);
|
|
383
|
+
if (exhaustedExport !== undefined) {
|
|
384
|
+
return exhaustedExport;
|
|
385
|
+
}
|
|
386
|
+
const localExportList = documentedLocalExportListResult(source, after, exp);
|
|
387
|
+
if (localExportList !== undefined) {
|
|
388
|
+
return localExportList;
|
|
389
|
+
}
|
|
390
|
+
if (isReExportAt(source, after)) {
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
393
|
+
return undefined;
|
|
394
|
+
};
|
|
395
|
+
const isDocumentedExportDeclaration = (source, exp) => {
|
|
396
|
+
const after = skipWhitespace(source, exp + EXPORT_KEYWORD_LENGTH);
|
|
397
|
+
const earlyResult = earlyExportDocResult(source, after, exp);
|
|
398
|
+
if (earlyResult !== undefined) {
|
|
399
|
+
return earlyResult;
|
|
400
|
+
}
|
|
401
|
+
const modifiers = scanExportModifiers(source, after);
|
|
402
|
+
if (canSkipDocumentedExport(source, modifiers)) {
|
|
403
|
+
return true;
|
|
404
|
+
}
|
|
405
|
+
return hasJSDocBefore(source, exp);
|
|
406
|
+
};
|
|
407
|
+
const isUndocumentedExportAt = (source, exp) => {
|
|
408
|
+
if (isInsideIgnoredText(source, exp) ||
|
|
409
|
+
!isStandaloneExportKeyword(source, exp) ||
|
|
410
|
+
isDeclareExport(source, exp)) {
|
|
138
411
|
return false;
|
|
139
412
|
}
|
|
140
|
-
|
|
141
|
-
|
|
413
|
+
return isDocumentedExportDeclaration(source, exp) === false;
|
|
414
|
+
};
|
|
415
|
+
const nextExportSearchPosition = (source, pos) => {
|
|
416
|
+
const exp = nextExportPosition(source, pos);
|
|
417
|
+
if (exp === undefined) {
|
|
418
|
+
return undefined;
|
|
419
|
+
}
|
|
420
|
+
return {
|
|
421
|
+
nextPOS: exp + EXPORT_KEYWORD_LENGTH,
|
|
422
|
+
undocumented: isUndocumentedExportAt(source, exp),
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
const hasUndocumentedExport = (source) => {
|
|
426
|
+
let pos = 0;
|
|
427
|
+
while (pos < source.length) {
|
|
428
|
+
const exportSearch = nextExportSearchPosition(source, pos);
|
|
429
|
+
if (!exportSearch) {
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
432
|
+
if (exportSearch.undocumented) {
|
|
142
433
|
return true;
|
|
143
434
|
}
|
|
435
|
+
pos = exportSearch.nextPOS;
|
|
144
436
|
}
|
|
145
437
|
return false;
|
|
146
|
-
}
|
|
438
|
+
};
|
|
147
439
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
440
|
+
* Checks whether exported declarations have meaningful JSDoc comments.
|
|
441
|
+
*
|
|
442
|
+
* @param source - TypeScript source text to inspect.
|
|
443
|
+
* @returns True when every public declaration is documented or no public declarations exist.
|
|
151
444
|
*/
|
|
152
445
|
export default function hasRequiredFunctionDocs(source) {
|
|
153
|
-
const len = source.length;
|
|
154
446
|
if (!source.includes('export ')) {
|
|
155
447
|
return true;
|
|
156
448
|
}
|
|
157
449
|
if (isAmbientDeclarationFile(source)) {
|
|
158
450
|
return true;
|
|
159
451
|
}
|
|
160
|
-
|
|
161
|
-
while (pos < len) {
|
|
162
|
-
const exp = source.indexOf('export ', pos);
|
|
163
|
-
if (exp === -1) {
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
if (exp > 0) {
|
|
167
|
-
const prev = source.charCodeAt(exp - 1);
|
|
168
|
-
if (prev !== 10 && prev !== 13 && prev !== 9 && prev !== 32) {
|
|
169
|
-
pos = exp + 1;
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
if (exp >= 8 && source.slice(exp - 8, exp) === 'declare ') {
|
|
173
|
-
pos = exp + 7;
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
let after = exp + 7;
|
|
178
|
-
while (after < len && isWhitespace(source.charCodeAt(after))) {
|
|
179
|
-
after++;
|
|
180
|
-
}
|
|
181
|
-
if (after >= len) {
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
const c0 = source.charCodeAt(after);
|
|
185
|
-
// Re-export block: export { ... }
|
|
186
|
-
if (c0 === 123) {
|
|
187
|
-
pos = exp + 7;
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
// Wildcard re-export: export *
|
|
191
|
-
if (c0 === 42) {
|
|
192
|
-
pos = exp + 7;
|
|
193
|
-
continue;
|
|
194
|
-
}
|
|
195
|
-
// Type re-export: export type { ... }
|
|
196
|
-
if (c0 === 116 && after + 5 <= len && source.slice(after, after + 5) === 'type ') {
|
|
197
|
-
const afterType = after + 5;
|
|
198
|
-
if (afterType < len && source.charCodeAt(afterType) === 123) {
|
|
199
|
-
pos = afterType;
|
|
200
|
-
continue;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
let afterMod = after;
|
|
204
|
-
let changed = true;
|
|
205
|
-
let sawDefault = false;
|
|
206
|
-
while (changed && afterMod < len) {
|
|
207
|
-
changed = false;
|
|
208
|
-
const ch = source.charCodeAt(afterMod);
|
|
209
|
-
if (ch === 100 &&
|
|
210
|
-
afterMod + 8 <= len &&
|
|
211
|
-
source.slice(afterMod, afterMod + 8) === 'default ') {
|
|
212
|
-
afterMod += 8;
|
|
213
|
-
changed = true;
|
|
214
|
-
sawDefault = true;
|
|
215
|
-
}
|
|
216
|
-
else if (ch === 97 &&
|
|
217
|
-
afterMod + 6 <= len &&
|
|
218
|
-
source.slice(afterMod, afterMod + 6) === 'async ') {
|
|
219
|
-
afterMod += 6;
|
|
220
|
-
changed = true;
|
|
221
|
-
}
|
|
222
|
-
else if (ch === 97 &&
|
|
223
|
-
afterMod + 9 <= len &&
|
|
224
|
-
source.slice(afterMod, afterMod + 9) === 'abstract ') {
|
|
225
|
-
afterMod += 9;
|
|
226
|
-
changed = true;
|
|
227
|
-
}
|
|
228
|
-
else if (ch === 116 &&
|
|
229
|
-
afterMod + 5 <= len &&
|
|
230
|
-
source.slice(afterMod, afterMod + 5) === 'type ') {
|
|
231
|
-
afterMod += 5;
|
|
232
|
-
changed = true;
|
|
233
|
-
}
|
|
234
|
-
else if (ch === 110 &&
|
|
235
|
-
afterMod + 10 <= len &&
|
|
236
|
-
source.slice(afterMod, afterMod + 10) === 'namespace ') {
|
|
237
|
-
break;
|
|
238
|
-
}
|
|
239
|
-
if (changed) {
|
|
240
|
-
while (afterMod < len && isWhitespace(source.charCodeAt(afterMod))) {
|
|
241
|
-
afterMod++;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
if (afterMod >= len) {
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
const next = source.charCodeAt(afterMod);
|
|
249
|
-
// Declaration keyword check (case-insensitive first character):
|
|
250
|
-
// First chars: f/F=function, c/C=class|const, i/I=interface, e/E=enum, l/L=let, v/V=var, n/N=namespace
|
|
251
|
-
if (next === 102 ||
|
|
252
|
-
next === 70 ||
|
|
253
|
-
next === 99 ||
|
|
254
|
-
next === 67 ||
|
|
255
|
-
next === 105 ||
|
|
256
|
-
next === 73 ||
|
|
257
|
-
next === 101 ||
|
|
258
|
-
next === 69 ||
|
|
259
|
-
next === 108 ||
|
|
260
|
-
next === 76 ||
|
|
261
|
-
next === 118 ||
|
|
262
|
-
next === 86 ||
|
|
263
|
-
next === 110 ||
|
|
264
|
-
next === 78) {
|
|
265
|
-
if (sawDefault) {
|
|
266
|
-
if (!isDefaultDeclaration(source, afterMod, len)) {
|
|
267
|
-
pos = exp + 7;
|
|
268
|
-
continue;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
if (!hasJSDocBefore(source, exp)) {
|
|
272
|
-
return false;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
pos = exp + 7;
|
|
276
|
-
}
|
|
277
|
-
return true;
|
|
452
|
+
return !hasUndocumentedExport(source);
|
|
278
453
|
}
|
|
279
454
|
//# sourceMappingURL=require-function-doc.js.map
|