@dcf-micro/eslint-config 5.0.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/dist/chunks/eslint-plugin-prettier.mjs +1716 -0
- package/dist/chunks/index.mjs +1341 -0
- package/dist/chunks/index10.mjs +39595 -0
- package/dist/chunks/index11.mjs +24 -0
- package/dist/chunks/index12.mjs +75273 -0
- package/dist/chunks/index13.mjs +55129 -0
- package/dist/chunks/index14.mjs +24 -0
- package/dist/chunks/index15.mjs +1441 -0
- package/dist/chunks/index2.mjs +31864 -0
- package/dist/chunks/index3.mjs +8154 -0
- package/dist/chunks/index4.mjs +24 -0
- package/dist/chunks/index5.mjs +44093 -0
- package/dist/chunks/index6.mjs +10371 -0
- package/dist/chunks/index7.mjs +21890 -0
- package/dist/chunks/index8.mjs +14424 -0
- package/dist/chunks/index9.mjs +194 -0
- package/dist/chunks/jiti.mjs +320 -0
- package/dist/index.d.mts +3897 -0
- package/dist/index.d.ts +3897 -0
- package/dist/index.mjs +4 -0
- package/dist/shared/eslint-config.BDBLGvXj.mjs +5282 -0
- package/dist/shared/eslint-config.BEdqg1el.mjs +12256 -0
- package/dist/shared/eslint-config.BKmXKm8B.mjs +5533 -0
- package/dist/shared/eslint-config.BjUMgISS.mjs +9012 -0
- package/dist/shared/eslint-config.Bk-3rH6Y.mjs +1355 -0
- package/dist/shared/eslint-config.BytuZ0Ec.mjs +20 -0
- package/dist/shared/eslint-config.C1V0I4Np.mjs +16900 -0
- package/dist/shared/eslint-config.CGxZQKHV.mjs +2091 -0
- package/dist/shared/eslint-config.COweQ1RR.mjs +5 -0
- package/dist/shared/eslint-config.CSnk9Q4w.mjs +9339 -0
- package/dist/shared/eslint-config.CWvTq0mr.mjs +2914 -0
- package/dist/shared/eslint-config.Ca4PTK8E.mjs +646 -0
- package/dist/shared/eslint-config.CmPTszkJ.mjs +3583 -0
- package/dist/shared/eslint-config.CqEANaNA.mjs +139622 -0
- package/dist/shared/eslint-config.CsePEcYJ.mjs +71 -0
- package/dist/shared/eslint-config.Cw6mETSZ.mjs +2580 -0
- package/dist/shared/eslint-config.DTVnsecK.mjs +1751 -0
- package/dist/shared/eslint-config.DWoU09EE.mjs +6958 -0
- package/dist/shared/eslint-config.DZvqTQUU.mjs +3818 -0
- package/dist/shared/eslint-config.Dhg7lT0g.mjs +1807 -0
- package/dist/shared/eslint-config.Du5y5qmf.mjs +200673 -0
- package/dist/shared/eslint-config.FKVuBSa4.mjs +394 -0
- package/dist/shared/eslint-config.I8d-HnmI.mjs +2654 -0
- package/dist/shared/eslint-config.YntqsQY1.mjs +40 -0
- package/dist/shared/eslint-config.uGTBNMD0.mjs +687 -0
- package/package.json +56 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { g as getDefaultExportFromCjs } from '../shared/eslint-config.BDBLGvXj.mjs';
|
|
2
|
+
|
|
3
|
+
function _mergeNamespaces(n, m) {
|
|
4
|
+
for (var i = 0; i < m.length; i++) {
|
|
5
|
+
const e = m[i];
|
|
6
|
+
if (typeof e !== 'string' && !Array.isArray(e)) { for (const k in e) {
|
|
7
|
+
if (k !== 'default' && !(k in n)) {
|
|
8
|
+
n[k] = e[k];
|
|
9
|
+
}
|
|
10
|
+
} }
|
|
11
|
+
}
|
|
12
|
+
return n;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @fileoverview Rule to flag use of .only in tests, preventing focused tests being committed accidentally
|
|
17
|
+
* @author Levi Buzolic
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
var noOnlyTests;
|
|
21
|
+
var hasRequiredNoOnlyTests;
|
|
22
|
+
|
|
23
|
+
function requireNoOnlyTests () {
|
|
24
|
+
if (hasRequiredNoOnlyTests) return noOnlyTests;
|
|
25
|
+
hasRequiredNoOnlyTests = 1;
|
|
26
|
+
/** @typedef {{block?: string[], focus?: string[], functions?: string[], fix?: boolean}} Options */
|
|
27
|
+
|
|
28
|
+
/** @type {Options} */
|
|
29
|
+
const defaultOptions = {
|
|
30
|
+
block: [
|
|
31
|
+
"describe",
|
|
32
|
+
"it",
|
|
33
|
+
"context",
|
|
34
|
+
"test",
|
|
35
|
+
"tape",
|
|
36
|
+
"fixture",
|
|
37
|
+
"serial",
|
|
38
|
+
"Feature",
|
|
39
|
+
"Scenario",
|
|
40
|
+
"Given",
|
|
41
|
+
"And",
|
|
42
|
+
"When",
|
|
43
|
+
"Then",
|
|
44
|
+
],
|
|
45
|
+
focus: ["only"],
|
|
46
|
+
functions: [],
|
|
47
|
+
fix: false,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
51
|
+
noOnlyTests = {
|
|
52
|
+
meta: {
|
|
53
|
+
docs: {
|
|
54
|
+
description: "disallow .only blocks in tests",
|
|
55
|
+
category: "Possible Errors",
|
|
56
|
+
recommended: true,
|
|
57
|
+
url: "https://github.com/levibuzolic/eslint-plugin-no-only-tests",
|
|
58
|
+
},
|
|
59
|
+
fixable: "code",
|
|
60
|
+
schema: [
|
|
61
|
+
{
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
block: {
|
|
65
|
+
type: "array",
|
|
66
|
+
items: {
|
|
67
|
+
type: "string",
|
|
68
|
+
},
|
|
69
|
+
uniqueItems: true,
|
|
70
|
+
default: defaultOptions.block,
|
|
71
|
+
},
|
|
72
|
+
focus: {
|
|
73
|
+
type: "array",
|
|
74
|
+
items: {
|
|
75
|
+
type: "string",
|
|
76
|
+
},
|
|
77
|
+
uniqueItems: true,
|
|
78
|
+
default: defaultOptions.focus,
|
|
79
|
+
},
|
|
80
|
+
functions: {
|
|
81
|
+
type: "array",
|
|
82
|
+
items: {
|
|
83
|
+
type: "string",
|
|
84
|
+
},
|
|
85
|
+
uniqueItems: true,
|
|
86
|
+
default: defaultOptions.functions,
|
|
87
|
+
},
|
|
88
|
+
fix: {
|
|
89
|
+
type: "boolean",
|
|
90
|
+
default: defaultOptions.fix,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
additionalProperties: false,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
create(context) {
|
|
98
|
+
/** @type {Options} */
|
|
99
|
+
const options = Object.assign({}, defaultOptions, context.options[0]);
|
|
100
|
+
const blocks = options.block || [];
|
|
101
|
+
const focus = options.focus || [];
|
|
102
|
+
const functions = options.functions || [];
|
|
103
|
+
const fix = !!options.fix;
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
Identifier(node) {
|
|
107
|
+
if (functions.length && functions.indexOf(node.name) > -1) {
|
|
108
|
+
context.report({
|
|
109
|
+
node,
|
|
110
|
+
message: `${node.name} not permitted`,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const parentObject =
|
|
115
|
+
"object" in node.parent ? node.parent.object : undefined;
|
|
116
|
+
if (parentObject == null) return;
|
|
117
|
+
if (focus.indexOf(node.name) === -1) return;
|
|
118
|
+
|
|
119
|
+
const callPath = getCallPath(node.parent).join(".");
|
|
120
|
+
|
|
121
|
+
// comparison guarantees that matching is done with the beginning of call path
|
|
122
|
+
if (
|
|
123
|
+
blocks.find((block) => {
|
|
124
|
+
// Allow wildcard tail matching of blocks when ending in a `*`
|
|
125
|
+
if (block.endsWith("*"))
|
|
126
|
+
return callPath.startsWith(block.replace(/\*$/, ""));
|
|
127
|
+
return callPath.startsWith(`${block}.`);
|
|
128
|
+
})
|
|
129
|
+
) {
|
|
130
|
+
const rangeStart = node.range?.[0];
|
|
131
|
+
const rangeEnd = node.range?.[1];
|
|
132
|
+
|
|
133
|
+
context.report({
|
|
134
|
+
node,
|
|
135
|
+
message: `${callPath} not permitted`,
|
|
136
|
+
fix:
|
|
137
|
+
fix && rangeStart != null && rangeEnd != null
|
|
138
|
+
? (fixer) => fixer.removeRange([rangeStart - 1, rangeEnd])
|
|
139
|
+
: undefined,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
*
|
|
149
|
+
* @param {import('estree').Node} node
|
|
150
|
+
* @param {string[]} path
|
|
151
|
+
* @returns
|
|
152
|
+
*/
|
|
153
|
+
function getCallPath(node, path = []) {
|
|
154
|
+
if (node) {
|
|
155
|
+
const nodeName =
|
|
156
|
+
"name" in node && node.name
|
|
157
|
+
? node.name
|
|
158
|
+
: "property" in node && node.property && "name" in node.property
|
|
159
|
+
? node.property?.name
|
|
160
|
+
: undefined;
|
|
161
|
+
if ("object" in node && node.object && nodeName)
|
|
162
|
+
return getCallPath(node.object, [nodeName, ...path]);
|
|
163
|
+
if ("callee" in node && node.callee) return getCallPath(node.callee, path);
|
|
164
|
+
if (nodeName) return [nodeName, ...path];
|
|
165
|
+
return path;
|
|
166
|
+
}
|
|
167
|
+
return path;
|
|
168
|
+
}
|
|
169
|
+
return noOnlyTests;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
var eslintPluginNoOnlyTests;
|
|
173
|
+
var hasRequiredEslintPluginNoOnlyTests;
|
|
174
|
+
|
|
175
|
+
function requireEslintPluginNoOnlyTests () {
|
|
176
|
+
if (hasRequiredEslintPluginNoOnlyTests) return eslintPluginNoOnlyTests;
|
|
177
|
+
hasRequiredEslintPluginNoOnlyTests = 1;
|
|
178
|
+
eslintPluginNoOnlyTests = {
|
|
179
|
+
rules: {
|
|
180
|
+
"no-only-tests": requireNoOnlyTests(),
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
return eslintPluginNoOnlyTests;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
var eslintPluginNoOnlyTestsExports = requireEslintPluginNoOnlyTests();
|
|
187
|
+
const index = /*@__PURE__*/getDefaultExportFromCjs(eslintPluginNoOnlyTestsExports);
|
|
188
|
+
|
|
189
|
+
const index$1 = /*#__PURE__*/_mergeNamespaces({
|
|
190
|
+
__proto__: null,
|
|
191
|
+
default: index
|
|
192
|
+
}, [eslintPluginNoOnlyTestsExports]);
|
|
193
|
+
|
|
194
|
+
export { index$1 as i };
|