gurkencheck 0.0.4
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/LICENSE +13 -0
- package/README.md +327 -0
- package/dist/config-parser.d.ts +21 -0
- package/dist/config-parser.d.ts.map +1 -0
- package/dist/config-parser.js +171 -0
- package/dist/config-parser.js.map +1 -0
- package/dist/config-verifier.d.ts +4 -0
- package/dist/config-verifier.d.ts.map +1 -0
- package/dist/config-verifier.js +81 -0
- package/dist/config-verifier.js.map +1 -0
- package/dist/feature-finder.d.ts +18 -0
- package/dist/feature-finder.d.ts.map +1 -0
- package/dist/feature-finder.js +70 -0
- package/dist/feature-finder.js.map +1 -0
- package/dist/formatters/index.d.ts +23 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +79 -0
- package/dist/formatters/index.js.map +1 -0
- package/dist/formatters/json.d.ts +31 -0
- package/dist/formatters/json.d.ts.map +1 -0
- package/dist/formatters/json.js +31 -0
- package/dist/formatters/json.js.map +1 -0
- package/dist/formatters/junit.d.ts +17 -0
- package/dist/formatters/junit.d.ts.map +1 -0
- package/dist/formatters/junit.js +61 -0
- package/dist/formatters/junit.js.map +1 -0
- package/dist/formatters/sarif.d.ts +6 -0
- package/dist/formatters/sarif.d.ts.map +1 -0
- package/dist/formatters/sarif.js +81 -0
- package/dist/formatters/sarif.js.map +1 -0
- package/dist/formatters/stylish.d.ts +9 -0
- package/dist/formatters/stylish.d.ts.map +1 -0
- package/dist/formatters/stylish.js +66 -0
- package/dist/formatters/stylish.js.map +1 -0
- package/dist/formatters/tap.d.ts +14 -0
- package/dist/formatters/tap.d.ts.map +1 -0
- package/dist/formatters/tap.js +45 -0
- package/dist/formatters/tap.js.map +1 -0
- package/dist/gherkin/dialects.d.ts +31 -0
- package/dist/gherkin/dialects.d.ts.map +1 -0
- package/dist/gherkin/dialects.js +40 -0
- package/dist/gherkin/dialects.js.map +1 -0
- package/dist/gherkin/keywords.d.ts +21 -0
- package/dist/gherkin/keywords.d.ts.map +1 -0
- package/dist/gherkin/keywords.js +53 -0
- package/dist/gherkin/keywords.js.map +1 -0
- package/dist/gherkin/parse.d.ts +32 -0
- package/dist/gherkin/parse.d.ts.map +1 -0
- package/dist/gherkin/parse.js +236 -0
- package/dist/gherkin/parse.js.map +1 -0
- package/dist/gherkin/traverse.d.ts +45 -0
- package/dist/gherkin/traverse.d.ts.map +1 -0
- package/dist/gherkin/traverse.js +89 -0
- package/dist/gherkin/traverse.js.map +1 -0
- package/dist/gherkin/variables.d.ts +26 -0
- package/dist/gherkin/variables.d.ts.map +1 -0
- package/dist/gherkin/variables.js +51 -0
- package/dist/gherkin/variables.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/linter.d.ts +23 -0
- package/dist/linter.d.ts.map +1 -0
- package/dist/linter.js +57 -0
- package/dist/linter.js.map +1 -0
- package/dist/logger.d.ts +16 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +28 -0
- package/dist/logger.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +144 -0
- package/dist/main.js.map +1 -0
- package/dist/presets.d.ts +19 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/presets.js +24 -0
- package/dist/presets.js.map +1 -0
- package/dist/rules/allowed-tags.d.ts +4 -0
- package/dist/rules/allowed-tags.d.ts.map +1 -0
- package/dist/rules/allowed-tags.js +34 -0
- package/dist/rules/allowed-tags.js.map +1 -0
- package/dist/rules/file-name.d.ts +4 -0
- package/dist/rules/file-name.d.ts.map +1 -0
- package/dist/rules/file-name.js +41 -0
- package/dist/rules/file-name.js.map +1 -0
- package/dist/rules/indentation.d.ts +4 -0
- package/dist/rules/indentation.d.ts.map +1 -0
- package/dist/rules/indentation.js +153 -0
- package/dist/rules/indentation.js.map +1 -0
- package/dist/rules/index.d.ts +13 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +70 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/keywords-in-logical-order.d.ts +4 -0
- package/dist/rules/keywords-in-logical-order.d.ts.map +1 -0
- package/dist/rules/keywords-in-logical-order.js +37 -0
- package/dist/rules/keywords-in-logical-order.js.map +1 -0
- package/dist/rules/max-scenarios-per-file.d.ts +4 -0
- package/dist/rules/max-scenarios-per-file.d.ts.map +1 -0
- package/dist/rules/max-scenarios-per-file.js +42 -0
- package/dist/rules/max-scenarios-per-file.js.map +1 -0
- package/dist/rules/name-length.d.ts +4 -0
- package/dist/rules/name-length.d.ts.map +1 -0
- package/dist/rules/name-length.js +50 -0
- package/dist/rules/name-length.js.map +1 -0
- package/dist/rules/new-line-at-eof.d.ts +4 -0
- package/dist/rules/new-line-at-eof.d.ts.map +1 -0
- package/dist/rules/new-line-at-eof.js +30 -0
- package/dist/rules/new-line-at-eof.js.map +1 -0
- package/dist/rules/no-background-only-scenario.d.ts +4 -0
- package/dist/rules/no-background-only-scenario.d.ts.map +1 -0
- package/dist/rules/no-background-only-scenario.js +43 -0
- package/dist/rules/no-background-only-scenario.js.map +1 -0
- package/dist/rules/no-dupe-feature-names.d.ts +4 -0
- package/dist/rules/no-dupe-feature-names.d.ts.map +1 -0
- package/dist/rules/no-dupe-feature-names.js +25 -0
- package/dist/rules/no-dupe-feature-names.js.map +1 -0
- package/dist/rules/no-dupe-file-names.d.ts +4 -0
- package/dist/rules/no-dupe-file-names.d.ts.map +1 -0
- package/dist/rules/no-dupe-file-names.js +28 -0
- package/dist/rules/no-dupe-file-names.js.map +1 -0
- package/dist/rules/no-dupe-scenario-names.d.ts +4 -0
- package/dist/rules/no-dupe-scenario-names.d.ts.map +1 -0
- package/dist/rules/no-dupe-scenario-names.js +41 -0
- package/dist/rules/no-dupe-scenario-names.js.map +1 -0
- package/dist/rules/no-duplicate-tags.d.ts +4 -0
- package/dist/rules/no-duplicate-tags.d.ts.map +1 -0
- package/dist/rules/no-duplicate-tags.js +38 -0
- package/dist/rules/no-duplicate-tags.js.map +1 -0
- package/dist/rules/no-empty-background.d.ts +4 -0
- package/dist/rules/no-empty-background.d.ts.map +1 -0
- package/dist/rules/no-empty-background.js +24 -0
- package/dist/rules/no-empty-background.js.map +1 -0
- package/dist/rules/no-empty-file.d.ts +4 -0
- package/dist/rules/no-empty-file.d.ts.map +1 -0
- package/dist/rules/no-empty-file.js +12 -0
- package/dist/rules/no-empty-file.js.map +1 -0
- package/dist/rules/no-examples-in-scenarios.d.ts +4 -0
- package/dist/rules/no-examples-in-scenarios.d.ts.map +1 -0
- package/dist/rules/no-examples-in-scenarios.js +25 -0
- package/dist/rules/no-examples-in-scenarios.js.map +1 -0
- package/dist/rules/no-files-without-scenarios.d.ts +4 -0
- package/dist/rules/no-files-without-scenarios.d.ts.map +1 -0
- package/dist/rules/no-files-without-scenarios.js +18 -0
- package/dist/rules/no-files-without-scenarios.js.map +1 -0
- package/dist/rules/no-homogenous-tags.d.ts +4 -0
- package/dist/rules/no-homogenous-tags.d.ts.map +1 -0
- package/dist/rules/no-homogenous-tags.js +54 -0
- package/dist/rules/no-homogenous-tags.js.map +1 -0
- package/dist/rules/no-multiple-empty-lines.d.ts +4 -0
- package/dist/rules/no-multiple-empty-lines.d.ts.map +1 -0
- package/dist/rules/no-multiple-empty-lines.js +44 -0
- package/dist/rules/no-multiple-empty-lines.js.map +1 -0
- package/dist/rules/no-partially-commented-tag-lines.d.ts +4 -0
- package/dist/rules/no-partially-commented-tag-lines.d.ts.map +1 -0
- package/dist/rules/no-partially-commented-tag-lines.js +44 -0
- package/dist/rules/no-partially-commented-tag-lines.js.map +1 -0
- package/dist/rules/no-restricted-patterns.d.ts +4 -0
- package/dist/rules/no-restricted-patterns.d.ts.map +1 -0
- package/dist/rules/no-restricted-patterns.js +101 -0
- package/dist/rules/no-restricted-patterns.js.map +1 -0
- package/dist/rules/no-restricted-tags.d.ts +4 -0
- package/dist/rules/no-restricted-tags.d.ts.map +1 -0
- package/dist/rules/no-restricted-tags.js +35 -0
- package/dist/rules/no-restricted-tags.js.map +1 -0
- package/dist/rules/no-scenario-outlines-without-examples.d.ts +4 -0
- package/dist/rules/no-scenario-outlines-without-examples.d.ts.map +1 -0
- package/dist/rules/no-scenario-outlines-without-examples.js +29 -0
- package/dist/rules/no-scenario-outlines-without-examples.js.map +1 -0
- package/dist/rules/no-superfluous-tags.d.ts +4 -0
- package/dist/rules/no-superfluous-tags.d.ts.map +1 -0
- package/dist/rules/no-superfluous-tags.js +40 -0
- package/dist/rules/no-superfluous-tags.js.map +1 -0
- package/dist/rules/no-trailing-spaces.d.ts +4 -0
- package/dist/rules/no-trailing-spaces.d.ts.map +1 -0
- package/dist/rules/no-trailing-spaces.js +24 -0
- package/dist/rules/no-trailing-spaces.js.map +1 -0
- package/dist/rules/no-undeclared-variables.d.ts +4 -0
- package/dist/rules/no-undeclared-variables.d.ts.map +1 -0
- package/dist/rules/no-undeclared-variables.js +35 -0
- package/dist/rules/no-undeclared-variables.js.map +1 -0
- package/dist/rules/no-unnamed-features.d.ts +4 -0
- package/dist/rules/no-unnamed-features.d.ts.map +1 -0
- package/dist/rules/no-unnamed-features.js +19 -0
- package/dist/rules/no-unnamed-features.js.map +1 -0
- package/dist/rules/no-unnamed-scenarios.d.ts +4 -0
- package/dist/rules/no-unnamed-scenarios.d.ts.map +1 -0
- package/dist/rules/no-unnamed-scenarios.js +24 -0
- package/dist/rules/no-unnamed-scenarios.js.map +1 -0
- package/dist/rules/no-unused-variables.d.ts +4 -0
- package/dist/rules/no-unused-variables.d.ts.map +1 -0
- package/dist/rules/no-unused-variables.js +36 -0
- package/dist/rules/no-unused-variables.js.map +1 -0
- package/dist/rules/one-space-between-tags.d.ts +4 -0
- package/dist/rules/one-space-between-tags.d.ts.map +1 -0
- package/dist/rules/one-space-between-tags.js +36 -0
- package/dist/rules/one-space-between-tags.js.map +1 -0
- package/dist/rules/only-one-when.d.ts +4 -0
- package/dist/rules/only-one-when.d.ts.map +1 -0
- package/dist/rules/only-one-when.js +59 -0
- package/dist/rules/only-one-when.js.map +1 -0
- package/dist/rules/required-tags.d.ts +4 -0
- package/dist/rules/required-tags.d.ts.map +1 -0
- package/dist/rules/required-tags.js +36 -0
- package/dist/rules/required-tags.js.map +1 -0
- package/dist/rules/scenario-size.d.ts +4 -0
- package/dist/rules/scenario-size.d.ts.map +1 -0
- package/dist/rules/scenario-size.js +37 -0
- package/dist/rules/scenario-size.js.map +1 -0
- package/dist/rules/use-and.d.ts +4 -0
- package/dist/rules/use-and.d.ts.map +1 -0
- package/dist/rules/use-and.js +33 -0
- package/dist/rules/use-and.js.map +1 -0
- package/dist/rules.d.ts +24 -0
- package/dist/rules.d.ts.map +1 -0
- package/dist/rules.js +109 -0
- package/dist/rules.js.map +1 -0
- package/dist/suppressions.d.ts +33 -0
- package/dist/suppressions.d.ts.map +1 -0
- package/dist/suppressions.js +84 -0
- package/dist/suppressions.js.map +1 -0
- package/dist/types.d.ts +81 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/util/case.d.ts +21 -0
- package/dist/util/case.d.ts.map +1 -0
- package/dist/util/case.js +42 -0
- package/dist/util/case.js.map +1 -0
- package/dist/util/collections.d.ts +30 -0
- package/dist/util/collections.d.ts.map +1 -0
- package/dist/util/collections.js +87 -0
- package/dist/util/collections.js.map +1 -0
- package/dist/util/glob.d.ts +20 -0
- package/dist/util/glob.d.ts.map +1 -0
- package/dist/util/glob.js +203 -0
- package/dist/util/glob.js.map +1 -0
- package/dist/util/json.d.ts +14 -0
- package/dist/util/json.d.ts.map +1 -0
- package/dist/util/json.js +63 -0
- package/dist/util/json.js.map +1 -0
- package/dist/util/lines.d.ts +24 -0
- package/dist/util/lines.d.ts.map +1 -0
- package/dist/util/lines.js +45 -0
- package/dist/util/lines.js.map +1 -0
- package/dist/util/location.d.ts +15 -0
- package/dist/util/location.d.ts.map +1 -0
- package/dist/util/location.js +11 -0
- package/dist/util/location.js.map +1 -0
- package/dist/util/xml.d.ts +16 -0
- package/dist/util/xml.d.ts.map +1 -0
- package/dist/util/xml.js +36 -0
- package/dist/util/xml.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +24 -0
- package/dist/version.js.map +1 -0
- package/package.json +61 -0
package/dist/rules.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Assembling the set of rules available to a run, and running them.
|
|
11
|
+
*/
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { pathToFileURL } from 'node:url';
|
|
14
|
+
import { BUILT_IN_RULES } from './rules/index.js';
|
|
15
|
+
import { globSync } from './util/glob.js';
|
|
16
|
+
/** File extensions a custom rule may be written in. */
|
|
17
|
+
const RULE_EXTENSIONS = '{js,mjs,cjs,ts}';
|
|
18
|
+
function isRule(candidate) {
|
|
19
|
+
return (typeof candidate === 'object' &&
|
|
20
|
+
candidate !== null &&
|
|
21
|
+
typeof candidate.name === 'string' &&
|
|
22
|
+
typeof candidate.run === 'function');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Finds the rule in a loaded module. A rule may be the default export, a
|
|
26
|
+
* named `rule` export, or - for CommonJS custom rules - the module itself.
|
|
27
|
+
*/
|
|
28
|
+
function extractRule(loaded, source) {
|
|
29
|
+
for (const candidate of [loaded['default'], loaded['rule'], loaded]) {
|
|
30
|
+
if (isRule(candidate)) {
|
|
31
|
+
return candidate;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
throw new Error(`${source} does not export a rule. A rule module must export an object with a "name" and a "run" function.`);
|
|
35
|
+
}
|
|
36
|
+
async function loadRulesFrom(directory) {
|
|
37
|
+
const resolved = path.resolve(directory);
|
|
38
|
+
const files = globSync(`*.${RULE_EXTENSIONS}`, { cwd: resolved });
|
|
39
|
+
const loaded = [];
|
|
40
|
+
for (const file of files) {
|
|
41
|
+
const absolute = path.join(resolved, file);
|
|
42
|
+
const module = (await import(__rewriteRelativeImportExtension(pathToFileURL(absolute).href)));
|
|
43
|
+
loaded.push(extractRule(module, absolute));
|
|
44
|
+
}
|
|
45
|
+
return loaded;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The built-in rules, plus any found in the given directories. A custom rule
|
|
49
|
+
* with the same name as a built-in one replaces it.
|
|
50
|
+
*/
|
|
51
|
+
export async function loadRules(additionalRulesDirs = []) {
|
|
52
|
+
const registry = new Map();
|
|
53
|
+
for (const rule of BUILT_IN_RULES) {
|
|
54
|
+
registry.set(rule.name, rule);
|
|
55
|
+
}
|
|
56
|
+
for (const directory of additionalRulesDirs) {
|
|
57
|
+
for (const rule of await loadRulesFrom(directory)) {
|
|
58
|
+
registry.set(rule.name, rule);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return registry;
|
|
62
|
+
}
|
|
63
|
+
/** The state a configuration entry asks for. */
|
|
64
|
+
function stateOf(config) {
|
|
65
|
+
return Array.isArray(config) ? config[0] : typeof config === 'string' ? config : undefined;
|
|
66
|
+
}
|
|
67
|
+
/** True when the configuration switches this rule on, to warn or to fail. */
|
|
68
|
+
export function isRuleEnabled(config) {
|
|
69
|
+
const state = stateOf(config);
|
|
70
|
+
return state === 'on' || state === 'warn';
|
|
71
|
+
}
|
|
72
|
+
/** How loudly a rule reports: `warn` only warns, anything else fails the run. */
|
|
73
|
+
export function getRuleSeverity(config) {
|
|
74
|
+
return stateOf(config) === 'warn' ? 'warning' : 'error';
|
|
75
|
+
}
|
|
76
|
+
/** The rule's own settings, or `undefined` when only a state was given. */
|
|
77
|
+
export function getRuleSettings(config) {
|
|
78
|
+
return Array.isArray(config) ? config[1] : undefined;
|
|
79
|
+
}
|
|
80
|
+
/** Clears the state kept by rules that look for duplicates across files. */
|
|
81
|
+
export function resetRules(rules) {
|
|
82
|
+
for (const rule of rules.values()) {
|
|
83
|
+
rule.reset?.();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Runs every enabled rule against one feature file.
|
|
88
|
+
*
|
|
89
|
+
* Rules are awaited one at a time. Most return an array outright, in which
|
|
90
|
+
* case awaiting costs nothing; a rule that needs to wait for something can
|
|
91
|
+
* return a promise instead.
|
|
92
|
+
*/
|
|
93
|
+
export async function runEnabledRules(feature, file, configuration, rules) {
|
|
94
|
+
const errors = [];
|
|
95
|
+
for (const rule of rules.values()) {
|
|
96
|
+
const config = configuration[rule.name];
|
|
97
|
+
if (!isRuleEnabled(config)) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
const severity = getRuleSeverity(config);
|
|
101
|
+
for (const error of await rule.run(feature, file, getRuleSettings(config))) {
|
|
102
|
+
// The configuration decides how loudly a rule reports, so a custom rule
|
|
103
|
+
// needs no say in it - but one that sets a severity itself is respected.
|
|
104
|
+
errors.push({ severity, ...error });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return errors;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":";;;;;;;;AAAA;;GAEG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AACvC,OAAO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e,CAAC,MAA8B;IAC5D,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,UAAU,CAAC,KAAmB;IAC5C,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QAClC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAA4B,EAC5B,IAAiB,EACjB,aAA4B,EAC5B,KAAmB;IAEnB,MAAM,MAAM,GAAgB,EAAE,CAAC;IAE/B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3B,SAAS;QACX,CAAC;QACD,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACzC,KAAK,MAAM,KAAK,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;YAC3E,wEAAwE;YACxE,yEAAyE;YACzE,MAAM,CAAC,IAAI,CAAC,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Switching rules off from inside a feature file.
|
|
3
|
+
*
|
|
4
|
+
* Ignoring a whole file is often too blunt: one long step name should not
|
|
5
|
+
* cost you every other check in the file. These directives are written as
|
|
6
|
+
* Gherkin comments, following the shape eslint and golangci-lint use:
|
|
7
|
+
*
|
|
8
|
+
* # gurkencheck-disable-next-line name-length
|
|
9
|
+
* # gurkencheck-disable use-and, name-length
|
|
10
|
+
* # gurkencheck-enable use-and
|
|
11
|
+
* # gurkencheck-disable-file no-trailing-spaces
|
|
12
|
+
*
|
|
13
|
+
* With no rule names, a directive covers every rule. `disable` runs to the
|
|
14
|
+
* end of the file unless an `enable` closes it.
|
|
15
|
+
*
|
|
16
|
+
* Comments are read from the raw text rather than the parsed document, so a
|
|
17
|
+
* directive still works in a file the parser rejected. A `#` inside a doc
|
|
18
|
+
* string is content, not a comment, and is ignored.
|
|
19
|
+
*
|
|
20
|
+
* The rules the parser enforces cannot be switched off this way. A file that
|
|
21
|
+
* breaks one of them cannot be read at all, so hiding the message would leave
|
|
22
|
+
* nothing but silence.
|
|
23
|
+
*/
|
|
24
|
+
import type { RuleError } from './types.ts';
|
|
25
|
+
export interface Suppressions {
|
|
26
|
+
/** True when a directive in the file covers this error. */
|
|
27
|
+
isSuppressed(error: RuleError): boolean;
|
|
28
|
+
/** True when the file carries no directives at all. */
|
|
29
|
+
readonly isEmpty: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Reads the directives out of a feature file's lines. */
|
|
32
|
+
export declare function readSuppressions(lines: readonly string[]): Suppressions;
|
|
33
|
+
//# sourceMappingURL=suppressions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suppressions.d.ts","sourceRoot":"","sources":["../src/suppressions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAgB1C,MAAM,WAAW,YAAY;IAC3B,2DAA2D;IAC3D,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC;IACxC,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAUD,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,CA4EvE"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { markDocStrings } from './util/lines.js';
|
|
2
|
+
const DIRECTIVE = /^\s*#\s*gurkencheck-(disable-next-line|disable-file|disable|enable)\b(.*)$/;
|
|
3
|
+
/** Stands in for "every rule" when a directive names none. */
|
|
4
|
+
const ALL_RULES = '*';
|
|
5
|
+
function parseRuleNames(rest) {
|
|
6
|
+
const names = rest
|
|
7
|
+
.split(/[,\s]+/)
|
|
8
|
+
.map((name) => name.trim())
|
|
9
|
+
.filter((name) => name !== '');
|
|
10
|
+
return names.length > 0 ? names : [ALL_RULES];
|
|
11
|
+
}
|
|
12
|
+
/** Reads the directives out of a feature file's lines. */
|
|
13
|
+
export function readSuppressions(lines) {
|
|
14
|
+
const inDocString = markDocStrings(lines);
|
|
15
|
+
const wholeFile = new Set();
|
|
16
|
+
/** Line number -> the rules switched off on that line only. */
|
|
17
|
+
const nextLine = new Map();
|
|
18
|
+
const ranges = [];
|
|
19
|
+
/** Rule -> the line its still-open `disable` started on. */
|
|
20
|
+
const open = new Map();
|
|
21
|
+
let found = false;
|
|
22
|
+
lines.forEach((text, index) => {
|
|
23
|
+
if (inDocString[index] === true) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const directive = DIRECTIVE.exec(text);
|
|
27
|
+
if (directive === null) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
found = true;
|
|
31
|
+
const kind = directive[1];
|
|
32
|
+
const names = parseRuleNames(directive[2] ?? '');
|
|
33
|
+
const line = index + 1;
|
|
34
|
+
for (const name of names) {
|
|
35
|
+
if (kind === 'disable-file') {
|
|
36
|
+
wholeFile.add(name);
|
|
37
|
+
}
|
|
38
|
+
else if (kind === 'disable-next-line') {
|
|
39
|
+
const onLine = nextLine.get(line + 1) ?? new Set();
|
|
40
|
+
onLine.add(name);
|
|
41
|
+
nextLine.set(line + 1, onLine);
|
|
42
|
+
}
|
|
43
|
+
else if (kind === 'disable') {
|
|
44
|
+
if (!open.has(name)) {
|
|
45
|
+
open.set(name, line);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// enable
|
|
50
|
+
const from = open.get(name);
|
|
51
|
+
if (from !== undefined) {
|
|
52
|
+
ranges.push({ rule: name, from, to: line });
|
|
53
|
+
open.delete(name);
|
|
54
|
+
}
|
|
55
|
+
if (name === ALL_RULES) {
|
|
56
|
+
// `enable` with no names closes everything that is open.
|
|
57
|
+
for (const [openRule, openFrom] of open) {
|
|
58
|
+
ranges.push({ rule: openRule, from: openFrom, to: line });
|
|
59
|
+
}
|
|
60
|
+
open.clear();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
for (const [rule, from] of open) {
|
|
66
|
+
ranges.push({ rule, from, to: Infinity });
|
|
67
|
+
}
|
|
68
|
+
const covers = (rule, candidate) => candidate === ALL_RULES || candidate === rule;
|
|
69
|
+
return {
|
|
70
|
+
isEmpty: !found,
|
|
71
|
+
isSuppressed(error) {
|
|
72
|
+
for (const candidate of wholeFile) {
|
|
73
|
+
if (covers(error.rule, candidate))
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
for (const candidate of nextLine.get(error.line) ?? []) {
|
|
77
|
+
if (covers(error.rule, candidate))
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return ranges.some((range) => covers(error.rule, range.rule) && error.line >= range.from && error.line <= range.to);
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=suppressions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suppressions.js","sourceRoot":"","sources":["../src/suppressions.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAE/C,MAAM,SAAS,GAAG,4EAA4E,CAA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
4
|
+
import type { Feature } from '@cucumber/messages';
|
|
5
|
+
/** A feature file as handed to the rules. */
|
|
6
|
+
export interface FeatureFile {
|
|
7
|
+
/** Path as given on the command line, relative to the working directory. */
|
|
8
|
+
relativePath: string;
|
|
9
|
+
/** The file's content, split into lines. */
|
|
10
|
+
lines: string[];
|
|
11
|
+
}
|
|
12
|
+
/** A single rule violation. */
|
|
13
|
+
export interface RuleError {
|
|
14
|
+
/** Human readable description of what is wrong. */
|
|
15
|
+
message: string;
|
|
16
|
+
/** Name of the rule that produced this error. */
|
|
17
|
+
rule: string;
|
|
18
|
+
/** 1-based line the error points at, or 0 when it concerns the whole file. */
|
|
19
|
+
line: number;
|
|
20
|
+
/**
|
|
21
|
+
* 1-based column the error points at, when the rule knows one. Absent for
|
|
22
|
+
* errors about a whole file or a whole line, such as a missing new line at
|
|
23
|
+
* the end of the file.
|
|
24
|
+
*/
|
|
25
|
+
column?: number;
|
|
26
|
+
/**
|
|
27
|
+
* How much this finding matters, taken from the rule's state in the
|
|
28
|
+
* configuration. Absent means `error`; a rule need not set it itself.
|
|
29
|
+
*/
|
|
30
|
+
severity?: Severity;
|
|
31
|
+
}
|
|
32
|
+
/** Everything found in one feature file. */
|
|
33
|
+
export interface FileResult {
|
|
34
|
+
filePath: string;
|
|
35
|
+
errors: RuleError[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Whether a rule is turned on, and how loudly.
|
|
39
|
+
*
|
|
40
|
+
* `warn` reports the same findings as `on` but does not fail the run, for
|
|
41
|
+
* rules a team is working towards rather than enforcing.
|
|
42
|
+
*/
|
|
43
|
+
export type RuleState = 'on' | 'warn' | 'off';
|
|
44
|
+
/** How much a finding matters. */
|
|
45
|
+
export type Severity = 'error' | 'warning';
|
|
46
|
+
/**
|
|
47
|
+
* A rule's entry in the configuration file: either just a state, or a state
|
|
48
|
+
* plus the rule's own settings.
|
|
49
|
+
*/
|
|
50
|
+
export type RuleConfig = RuleState | readonly [RuleState, unknown];
|
|
51
|
+
/** The parsed contents of a `.gurkencheckrc` file. */
|
|
52
|
+
export type Configuration = Record<string, RuleConfig>;
|
|
53
|
+
/**
|
|
54
|
+
* A lint rule.
|
|
55
|
+
*
|
|
56
|
+
* `run` is called once per feature file. `feature` is `undefined` when the
|
|
57
|
+
* file could not be parsed into a feature (an empty file, for instance), so
|
|
58
|
+
* every rule has to cope with that.
|
|
59
|
+
*/
|
|
60
|
+
export interface LintRule {
|
|
61
|
+
/** The name used to switch the rule on in the configuration file. */
|
|
62
|
+
readonly name: string;
|
|
63
|
+
/**
|
|
64
|
+
* The settings this rule accepts, used to validate configuration files.
|
|
65
|
+
* An array lists the allowed values; an object lists the allowed keys.
|
|
66
|
+
*/
|
|
67
|
+
readonly availableConfigs?: unknown;
|
|
68
|
+
/**
|
|
69
|
+
* Returns the violations found in this file. A rule that needs to wait for
|
|
70
|
+
* something - reading a file, asking a service - may return a promise.
|
|
71
|
+
*/
|
|
72
|
+
run(feature: Feature | undefined, file: FeatureFile, configuration: unknown): RuleError[] | Promise<RuleError[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Clears any state kept between files. Implemented by the rules that look
|
|
75
|
+
* for duplicates across a whole run; called once before each lint run.
|
|
76
|
+
*/
|
|
77
|
+
reset?(): void;
|
|
78
|
+
}
|
|
79
|
+
/** All rules available to a run, keyed by name. */
|
|
80
|
+
export type RuleRegistry = ReadonlyMap<string, LintRule>;
|
|
81
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAEhD,6CAA6C;AAC7C,MAAM,WAAW,WAAW;IAC1B,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,+BA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+1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Word splitting and case conversion, as used by the `file-name` rule.
|
|
3
|
+
* Replaces lodash's `startCase`/`camelCase`/`kebabCase`/`snakeCase`.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Splits an identifier into words, breaking on separators, on lower-to-upper
|
|
7
|
+
* transitions and between a run of capitals and a following capitalised word
|
|
8
|
+
* (so `XMLHttpRequest` becomes `XML`, `Http`, `Request`).
|
|
9
|
+
*/
|
|
10
|
+
export declare function words(value: string): string[];
|
|
11
|
+
/** `my fancy feature` -> `My Fancy Feature` */
|
|
12
|
+
export declare function titleCase(value: string): string;
|
|
13
|
+
/** `my fancy feature` -> `MyFancyFeature` */
|
|
14
|
+
export declare function pascalCase(value: string): string;
|
|
15
|
+
/** `my fancy feature` -> `myFancyFeature` */
|
|
16
|
+
export declare function camelCase(value: string): string;
|
|
17
|
+
/** `my fancy feature` -> `my-fancy-feature` */
|
|
18
|
+
export declare function kebabCase(value: string): string;
|
|
19
|
+
/** `my fancy feature` -> `my_fancy_feature` */
|
|
20
|
+
export declare function snakeCase(value: string): string;
|
|
21
|
+
//# sourceMappingURL=case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../src/util/case.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE7C;AAMD,+CAA+C;AAC/C,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,6CAA6C;AAC7C,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,6CAA6C;AAC7C,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAI/C;AAED,+CAA+C;AAC/C,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAI/C;AAED,+CAA+C;AAC/C,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAI/C"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Word splitting and case conversion, as used by the `file-name` rule.
|
|
3
|
+
* Replaces lodash's `startCase`/`camelCase`/`kebabCase`/`snakeCase`.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Splits an identifier into words, breaking on separators, on lower-to-upper
|
|
7
|
+
* transitions and between a run of capitals and a following capitalised word
|
|
8
|
+
* (so `XMLHttpRequest` becomes `XML`, `Http`, `Request`).
|
|
9
|
+
*/
|
|
10
|
+
export function words(value) {
|
|
11
|
+
return value.match(/[A-Z]{2,}(?=[A-Z][a-z]+\d*|\b)|[A-Z]?[a-z]+\d*|[A-Z]+\d*|\d+/g) ?? [];
|
|
12
|
+
}
|
|
13
|
+
function upperFirst(word) {
|
|
14
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
15
|
+
}
|
|
16
|
+
/** `my fancy feature` -> `My Fancy Feature` */
|
|
17
|
+
export function titleCase(value) {
|
|
18
|
+
return words(value).map(upperFirst).join(' ');
|
|
19
|
+
}
|
|
20
|
+
/** `my fancy feature` -> `MyFancyFeature` */
|
|
21
|
+
export function pascalCase(value) {
|
|
22
|
+
return words(value).map(upperFirst).join('');
|
|
23
|
+
}
|
|
24
|
+
/** `my fancy feature` -> `myFancyFeature` */
|
|
25
|
+
export function camelCase(value) {
|
|
26
|
+
return words(value)
|
|
27
|
+
.map((word, index) => (index === 0 ? word.toLowerCase() : upperFirst(word.toLowerCase())))
|
|
28
|
+
.join('');
|
|
29
|
+
}
|
|
30
|
+
/** `my fancy feature` -> `my-fancy-feature` */
|
|
31
|
+
export function kebabCase(value) {
|
|
32
|
+
return words(value)
|
|
33
|
+
.map((word) => word.toLowerCase())
|
|
34
|
+
.join('-');
|
|
35
|
+
}
|
|
36
|
+
/** `my fancy feature` -> `my_fancy_feature` */
|
|
37
|
+
export function snakeCase(value) {
|
|
38
|
+
return words(value)
|
|
39
|
+
.map((word) => word.toLowerCase())
|
|
40
|
+
.join('_');
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case.js","sourceRoot":"","sources":["../../src/util/case.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,KAAK,CAAC,+DAA+D,CAAC,IAAI,EAAE,CAAC;AAC5F,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChD,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,KAAK,CAAC;SAChB,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;SACzF,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,KAAK,CAAC;SAChB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;SACjC,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,KAAK,CAAC;SAChB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;SACjC,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The handful of collection helpers this project used to pull in from lodash.
|
|
3
|
+
* Each one is a few lines of vanilla TypeScript.
|
|
4
|
+
*/
|
|
5
|
+
/** Removes duplicate values, keeping the first occurrence of each. */
|
|
6
|
+
export declare function uniq<T>(values: readonly T[]): T[];
|
|
7
|
+
/**
|
|
8
|
+
* Returns a new array sorted by the selected key. `Array.prototype.sort` is
|
|
9
|
+
* stable, so items with an equal key keep their original relative order.
|
|
10
|
+
*/
|
|
11
|
+
export declare function sortBy<T>(values: readonly T[], select: (value: T) => number | string): T[];
|
|
12
|
+
/** Buckets values by the selected key, preserving insertion order. */
|
|
13
|
+
export declare function groupBy<T, K>(values: readonly T[], select: (value: T) => K): Map<K, T[]>;
|
|
14
|
+
/** Values present in every one of the given groups, without duplicates. */
|
|
15
|
+
export declare function intersection<T>(groups: readonly (readonly T[])[]): T[];
|
|
16
|
+
/**
|
|
17
|
+
* Values from `values` whose selected key also appears in `other`, without
|
|
18
|
+
* duplicate keys.
|
|
19
|
+
*/
|
|
20
|
+
export declare function intersectionBy<T>(values: readonly T[], other: readonly T[], select: (value: T) => unknown): T[];
|
|
21
|
+
/**
|
|
22
|
+
* Recursively merges `override` onto a copy of `defaults`. Plain objects are
|
|
23
|
+
* merged key by key; everything else (including arrays) is replaced outright.
|
|
24
|
+
* `undefined` values in `override` never win over a default.
|
|
25
|
+
*
|
|
26
|
+
* Neither argument is mutated - the old lodash-based rules accidentally wrote
|
|
27
|
+
* their overrides back into the shared default config object.
|
|
28
|
+
*/
|
|
29
|
+
export declare function mergeDefaults<T>(defaults: T, override: unknown): T;
|
|
30
|
+
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/util/collections.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sEAAsE;AACtE,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,CAEjD;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE,CAQ1F;AAED,sEAAsE;AACtE,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAYxF;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAMtE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAC5B,CAAC,EAAE,CAWL;AAMD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,CAAC,CAYlE"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The handful of collection helpers this project used to pull in from lodash.
|
|
3
|
+
* Each one is a few lines of vanilla TypeScript.
|
|
4
|
+
*/
|
|
5
|
+
/** Removes duplicate values, keeping the first occurrence of each. */
|
|
6
|
+
export function uniq(values) {
|
|
7
|
+
return [...new Set(values)];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Returns a new array sorted by the selected key. `Array.prototype.sort` is
|
|
11
|
+
* stable, so items with an equal key keep their original relative order.
|
|
12
|
+
*/
|
|
13
|
+
export function sortBy(values, select) {
|
|
14
|
+
return [...values].sort((a, b) => {
|
|
15
|
+
const left = select(a);
|
|
16
|
+
const right = select(b);
|
|
17
|
+
if (left < right)
|
|
18
|
+
return -1;
|
|
19
|
+
if (left > right)
|
|
20
|
+
return 1;
|
|
21
|
+
return 0;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/** Buckets values by the selected key, preserving insertion order. */
|
|
25
|
+
export function groupBy(values, select) {
|
|
26
|
+
const groups = new Map();
|
|
27
|
+
for (const value of values) {
|
|
28
|
+
const key = select(value);
|
|
29
|
+
const group = groups.get(key);
|
|
30
|
+
if (group === undefined) {
|
|
31
|
+
groups.set(key, [value]);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
group.push(value);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return groups;
|
|
38
|
+
}
|
|
39
|
+
/** Values present in every one of the given groups, without duplicates. */
|
|
40
|
+
export function intersection(groups) {
|
|
41
|
+
const [first, ...rest] = groups;
|
|
42
|
+
if (first === undefined) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
return uniq(first).filter((value) => rest.every((group) => group.includes(value)));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Values from `values` whose selected key also appears in `other`, without
|
|
49
|
+
* duplicate keys.
|
|
50
|
+
*/
|
|
51
|
+
export function intersectionBy(values, other, select) {
|
|
52
|
+
const otherKeys = new Set(other.map(select));
|
|
53
|
+
const taken = new Set();
|
|
54
|
+
return values.filter((value) => {
|
|
55
|
+
const key = select(value);
|
|
56
|
+
if (!otherKeys.has(key) || taken.has(key)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
taken.add(key);
|
|
60
|
+
return true;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function isPlainObject(value) {
|
|
64
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Recursively merges `override` onto a copy of `defaults`. Plain objects are
|
|
68
|
+
* merged key by key; everything else (including arrays) is replaced outright.
|
|
69
|
+
* `undefined` values in `override` never win over a default.
|
|
70
|
+
*
|
|
71
|
+
* Neither argument is mutated - the old lodash-based rules accidentally wrote
|
|
72
|
+
* their overrides back into the shared default config object.
|
|
73
|
+
*/
|
|
74
|
+
export function mergeDefaults(defaults, override) {
|
|
75
|
+
if (!isPlainObject(defaults) || !isPlainObject(override)) {
|
|
76
|
+
return (override === undefined ? defaults : override);
|
|
77
|
+
}
|
|
78
|
+
const merged = { ...defaults };
|
|
79
|
+
for (const [key, value] of Object.entries(override)) {
|
|
80
|
+
if (value === undefined) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
merged[key] = isPlainObject(merged[key]) ? mergeDefaults(merged[key], value) : value;
|
|
84
|
+
}
|
|
85
|
+
return merged;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/util/collections.ts"],"names":[],"mappings":"AAA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,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAM,CAAC;IAC7D,CAAC;IACD,MAAM,MAAM,GAA4B,EAAC,GAAG,QAAQ,EAAC,CAAC;IACtD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,SAAS;QACX,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACvF,CAAC;IACD,OAAO,MAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translates a glob pattern into an anchored regular expression matching
|
|
3
|
+
* slash-separated paths.
|
|
4
|
+
*/
|
|
5
|
+
export declare function globToRegExp(pattern: string): RegExp;
|
|
6
|
+
export interface GlobOptions {
|
|
7
|
+
/** Directory that relative patterns and returned paths are relative to. */
|
|
8
|
+
cwd?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Patterns whose matches are dropped from the result. A pattern matching a
|
|
11
|
+
* directory drops everything below it, as in .gitignore and .eslintignore.
|
|
12
|
+
*/
|
|
13
|
+
ignore?: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns the files matching `pattern`, as paths relative to `cwd` using
|
|
17
|
+
* forward slashes. Directories are never returned. Results are sorted.
|
|
18
|
+
*/
|
|
19
|
+
export declare function globSync(pattern: string, options?: GlobOptions): string[];
|
|
20
|
+
//# sourceMappingURL=glob.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/util/glob.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA8DpD;AA0DD,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AAyBD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,EAAE,CAmC7E"}
|