@boringnode/tooling 0.0.0-stage → 0.1.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/LICENSE.md +9 -0
- package/README.md +96 -2
- package/THIRD_PARTY_LICENSES.md +58 -0
- package/build/anti_slop.d.ts +6 -0
- package/build/anti_slop.js +2403 -0
- package/build/anti_slop.js.map +1 -0
- package/build/chunk-ICJABKYN.js +19 -0
- package/build/chunk-ICJABKYN.js.map +1 -0
- package/build/oxfmt.d.ts +6 -0
- package/build/oxfmt.js +33 -0
- package/build/oxfmt.js.map +1 -0
- package/build/oxlint.d.ts +9 -0
- package/build/oxlint.js +81 -0
- package/build/oxlint.js.map +1 -0
- package/build/oxlint_plugin.d.ts +5 -0
- package/build/oxlint_plugin.js +393 -0
- package/build/oxlint_plugin.js.map +1 -0
- package/package.json +103 -5
package/build/oxlint.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IGNORE_PATTERNS
|
|
3
|
+
} from "./chunk-ICJABKYN.js";
|
|
4
|
+
|
|
5
|
+
// src/oxlint.ts
|
|
6
|
+
import { defineConfig } from "oxlint";
|
|
7
|
+
function boringnodePreset(options = {}) {
|
|
8
|
+
const { react, vue, ...config } = options;
|
|
9
|
+
const rules = {
|
|
10
|
+
"anti-slop/no-array-filter-map": "error",
|
|
11
|
+
"anti-slop/no-chained-type-assertions": "error",
|
|
12
|
+
"anti-slop/no-conditional-empty-object-spread": "error",
|
|
13
|
+
"anti-slop/no-known-value-widening": "error",
|
|
14
|
+
"anti-slop/no-module-mocking": "error",
|
|
15
|
+
"anti-slop/no-object-parameters": "error",
|
|
16
|
+
"anti-slop/no-reduce-accumulator-copy": "error",
|
|
17
|
+
"anti-slop/no-reflect-apply": "error",
|
|
18
|
+
"anti-slop/no-reflect-get": "error",
|
|
19
|
+
"anti-slop/no-runtime-typeof": "error",
|
|
20
|
+
"anti-slop/no-shape-in-symbol-names": "error",
|
|
21
|
+
"anti-slop/no-unknown-parameters": "error",
|
|
22
|
+
"anti-slop/no-unknown-returns": "error",
|
|
23
|
+
"anti-slop/no-unknown-type-aliases": "error",
|
|
24
|
+
"anti-slop/no-unsafe-dictionary-type": "error",
|
|
25
|
+
"anti-slop/no-widen-then-assert": "error",
|
|
26
|
+
"anti-slop/require-readable-spacing": "error",
|
|
27
|
+
"anti-slop/require-safety-comment-for-type-assertion": "error",
|
|
28
|
+
"boringnode/blank-line-after-imports": "error",
|
|
29
|
+
"boringnode/max-logical-operands": "warn",
|
|
30
|
+
"boringnode/max-params": "error",
|
|
31
|
+
"boringnode/no-await-in-call-arguments": "error",
|
|
32
|
+
"boringnode/no-await-in-call-targets": "error",
|
|
33
|
+
"boringnode/no-await-in-conditions": "error",
|
|
34
|
+
"boringnode/no-constructor-defaults": "error",
|
|
35
|
+
"boringnode/no-typescript-private": "error",
|
|
36
|
+
"complexity": "error",
|
|
37
|
+
"curly": ["error", "all"],
|
|
38
|
+
"eqeqeq": ["error", "always"],
|
|
39
|
+
"max-depth": ["error", 3],
|
|
40
|
+
"oxc/no-accumulating-spread": "error",
|
|
41
|
+
"no-else-return": "error",
|
|
42
|
+
"no-nested-ternary": "error",
|
|
43
|
+
"prefer-const": "error",
|
|
44
|
+
"typescript/consistent-type-definitions": ["error", "interface"],
|
|
45
|
+
"typescript/no-explicit-any": "error",
|
|
46
|
+
"typescript/no-non-null-assertion": "error"
|
|
47
|
+
};
|
|
48
|
+
if (react) {
|
|
49
|
+
rules["react/react-in-jsx-scope"] = "off";
|
|
50
|
+
}
|
|
51
|
+
if (vue) {
|
|
52
|
+
rules["typescript/no-namespace"] = "off";
|
|
53
|
+
}
|
|
54
|
+
return defineConfig({
|
|
55
|
+
...config,
|
|
56
|
+
ignorePatterns: config.ignorePatterns ?? IGNORE_PATTERNS,
|
|
57
|
+
jsPlugins: [
|
|
58
|
+
{
|
|
59
|
+
name: "boringnode",
|
|
60
|
+
specifier: "@boringnode/tooling/oxlint/plugin"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "anti-slop",
|
|
64
|
+
specifier: "@boringnode/tooling/oxlint/anti-slop"
|
|
65
|
+
},
|
|
66
|
+
...config.jsPlugins ?? []
|
|
67
|
+
],
|
|
68
|
+
plugins: [
|
|
69
|
+
"typescript",
|
|
70
|
+
"oxc",
|
|
71
|
+
...react ? ["react", "jsx-a11y", "react-perf"] : [],
|
|
72
|
+
...vue ? ["vue"] : [],
|
|
73
|
+
...config.plugins ?? []
|
|
74
|
+
],
|
|
75
|
+
rules: { ...rules, ...config.rules }
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
boringnodePreset
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=oxlint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/oxlint.ts"],"sourcesContent":["import { defineConfig } from 'oxlint';\nimport { IGNORE_PATTERNS } from './shared.ts';\nimport type { OxlintConfig } from 'oxlint';\n\ntype BoringnodeOxlintOptions = OxlintConfig & {\n\treact?: boolean;\n\tvue?: boolean;\n};\n\nexport function boringnodePreset(options: BoringnodeOxlintOptions = {}): OxlintConfig {\n\tconst { react, vue, ...config } = options;\n\n\tconst rules: NonNullable<OxlintConfig['rules']> = {\n\t\t'anti-slop/no-array-filter-map': 'error',\n\t\t'anti-slop/no-chained-type-assertions': 'error',\n\t\t'anti-slop/no-conditional-empty-object-spread': 'error',\n\t\t'anti-slop/no-known-value-widening': 'error',\n\t\t'anti-slop/no-module-mocking': 'error',\n\t\t'anti-slop/no-object-parameters': 'error',\n\t\t'anti-slop/no-reduce-accumulator-copy': 'error',\n\t\t'anti-slop/no-reflect-apply': 'error',\n\t\t'anti-slop/no-reflect-get': 'error',\n\t\t'anti-slop/no-runtime-typeof': 'error',\n\t\t'anti-slop/no-shape-in-symbol-names': 'error',\n\t\t'anti-slop/no-unknown-parameters': 'error',\n\t\t'anti-slop/no-unknown-returns': 'error',\n\t\t'anti-slop/no-unknown-type-aliases': 'error',\n\t\t'anti-slop/no-unsafe-dictionary-type': 'error',\n\t\t'anti-slop/no-widen-then-assert': 'error',\n\t\t'anti-slop/require-readable-spacing': 'error',\n\t\t'anti-slop/require-safety-comment-for-type-assertion': 'error',\n\t\t'boringnode/blank-line-after-imports': 'error',\n\t\t'boringnode/max-logical-operands': 'warn',\n\t\t'boringnode/max-params': 'error',\n\t\t'boringnode/no-await-in-call-arguments': 'error',\n\t\t'boringnode/no-await-in-call-targets': 'error',\n\t\t'boringnode/no-await-in-conditions': 'error',\n\t\t'boringnode/no-constructor-defaults': 'error',\n\t\t'boringnode/no-typescript-private': 'error',\n\t\t'complexity': 'error',\n\t\t'curly': ['error', 'all'],\n\t\t'eqeqeq': ['error', 'always'],\n\t\t'max-depth': ['error', 3],\n\t\t'oxc/no-accumulating-spread': 'error',\n\t\t'no-else-return': 'error',\n\t\t'no-nested-ternary': 'error',\n\t\t'prefer-const': 'error',\n\t\t'typescript/consistent-type-definitions': ['error', 'interface'],\n\t\t'typescript/no-explicit-any': 'error',\n\t\t'typescript/no-non-null-assertion': 'error',\n\t};\n\n\tif (react) {\n\t\trules['react/react-in-jsx-scope'] = 'off';\n\t}\n\n\tif (vue) {\n\t\trules['typescript/no-namespace'] = 'off';\n\t}\n\n\treturn defineConfig({\n\t\t...config,\n\t\tignorePatterns: config.ignorePatterns ?? IGNORE_PATTERNS,\n\t\tjsPlugins: [\n\t\t\t{\n\t\t\t\tname: 'boringnode',\n\t\t\t\tspecifier: '@boringnode/tooling/oxlint/plugin',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'anti-slop',\n\t\t\t\tspecifier: '@boringnode/tooling/oxlint/anti-slop',\n\t\t\t},\n\t\t\t...(config.jsPlugins ?? []),\n\t\t],\n\t\tplugins: [\n\t\t\t'typescript',\n\t\t\t'oxc',\n\t\t\t...(react ? (['react', 'jsx-a11y', 'react-perf'] as const) : []),\n\t\t\t...(vue ? (['vue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AO,kBAAkB;AAAA,IACzC,WAAW;AAAA,MACV;AAAA,QACC,MAAM;AAAA,QACN,WAAW;AAAA,MACZ;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,WAAW;AAAA,MACZ;AAAA,MACA,GAAI,OAAO,aAAa,CAAC;AAAA,IAC1B;AAAA,IACA,SAAS;AAAA,MACR;AAAA,MACA;AAAA,MACA,GAAI,QAAS,CAAC,SAAS,YAAY,YAAY,IAAc,CAAC;AAAA,MAC9D,GAAI,MAAO,CAAC,KAAK,IAAc,CAAC;AAAA,MAChC,GAAI,OAAO,WAAW,CAAC;AAAA,IACxB;AAAA,IACA,OAAO,EAAE,GAAG,OAAO,GAAG,OAAO,MAAM;AAAA,EACpC,CAAC;AACF;","names":[]}
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
// src/oxlint_plugin.ts
|
|
2
|
+
import { eslintCompatPlugin } from "@oxlint/plugins";
|
|
3
|
+
|
|
4
|
+
// src/rules/blank_line_after_imports.ts
|
|
5
|
+
import { defineRule } from "@oxlint/plugins";
|
|
6
|
+
function hasBlankLineBetween(sourceText, previous, next) {
|
|
7
|
+
const linesBetween = sourceText.slice(previous.end, next.start).split(/\r?\n/u).slice(1, -1);
|
|
8
|
+
return linesBetween.some((line) => line.trim() === "");
|
|
9
|
+
}
|
|
10
|
+
var blankLineAfterImportsRule = defineRule({
|
|
11
|
+
meta: {
|
|
12
|
+
type: "layout",
|
|
13
|
+
fixable: "whitespace",
|
|
14
|
+
docs: {
|
|
15
|
+
description: "Require a blank line between the import block and the module body."
|
|
16
|
+
},
|
|
17
|
+
messages: {
|
|
18
|
+
missing: "Add a blank line after the import block."
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
createOnce(context) {
|
|
22
|
+
return {
|
|
23
|
+
Program(node) {
|
|
24
|
+
const lastImportIndex = node.body.findLastIndex((statement) => statement.type === "ImportDeclaration");
|
|
25
|
+
if (lastImportIndex === -1 || lastImportIndex === node.body.length - 1) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const lastImport = node.body[lastImportIndex];
|
|
29
|
+
const nextStatement = node.body[lastImportIndex + 1];
|
|
30
|
+
if (hasBlankLineBetween(context.sourceCode.text, lastImport, nextStatement)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
context.report({
|
|
34
|
+
node: nextStatement,
|
|
35
|
+
messageId: "missing",
|
|
36
|
+
fix(fixer) {
|
|
37
|
+
return fixer.insertTextBefore(nextStatement, "\n");
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// src/rules/max_logical_operands.ts
|
|
46
|
+
import { defineRule as defineRule2 } from "@oxlint/plugins";
|
|
47
|
+
|
|
48
|
+
// src/rules/shared/typescript_wrapper.ts
|
|
49
|
+
var TYPESCRIPT_WRAPPERS = /* @__PURE__ */ new Set([
|
|
50
|
+
"TSNonNullExpression",
|
|
51
|
+
"TSAsExpression",
|
|
52
|
+
"TSSatisfiesExpression",
|
|
53
|
+
"TSTypeAssertion"
|
|
54
|
+
]);
|
|
55
|
+
function isTypeScriptWrapper(node) {
|
|
56
|
+
return TYPESCRIPT_WRAPPERS.has(node.type);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/rules/max_logical_operands.ts
|
|
60
|
+
var MAX_LOGICAL_OPERANDS = 3;
|
|
61
|
+
var FUNCTIONS = /* @__PURE__ */ new Set(["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"]);
|
|
62
|
+
var FUNCTION_NAMERS = /* @__PURE__ */ new Set([
|
|
63
|
+
"VariableDeclarator",
|
|
64
|
+
"Property",
|
|
65
|
+
"PropertyDefinition",
|
|
66
|
+
"MethodDefinition",
|
|
67
|
+
"TSAbstractMethodDefinition"
|
|
68
|
+
]);
|
|
69
|
+
function isBooleanLogic(node) {
|
|
70
|
+
return node.type === "LogicalExpression" && node.operator !== "??";
|
|
71
|
+
}
|
|
72
|
+
function countLogicalOperands(node) {
|
|
73
|
+
if (node.type === "JSXElement" || node.type === "JSXFragment") {
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
if (!isBooleanLogic(node)) {
|
|
77
|
+
return 1;
|
|
78
|
+
}
|
|
79
|
+
return countLogicalOperands(node.left) + countLogicalOperands(node.right);
|
|
80
|
+
}
|
|
81
|
+
function isNamedFunction(node) {
|
|
82
|
+
if (node?.type === "FunctionDeclaration") {
|
|
83
|
+
return node.id !== null;
|
|
84
|
+
}
|
|
85
|
+
const isFunctionValue = node?.type === "FunctionExpression" || node?.type === "ArrowFunctionExpression";
|
|
86
|
+
return isFunctionValue && FUNCTION_NAMERS.has(node.parent.type);
|
|
87
|
+
}
|
|
88
|
+
function enclosingFunction(node) {
|
|
89
|
+
let parent = node.parent;
|
|
90
|
+
while (parent && !FUNCTIONS.has(parent.type)) {
|
|
91
|
+
parent = parent.parent;
|
|
92
|
+
}
|
|
93
|
+
return parent;
|
|
94
|
+
}
|
|
95
|
+
function hasName(node) {
|
|
96
|
+
let value = node;
|
|
97
|
+
let parent = node.parent;
|
|
98
|
+
while (isTypeScriptWrapper(parent)) {
|
|
99
|
+
value = parent;
|
|
100
|
+
parent = value.parent;
|
|
101
|
+
}
|
|
102
|
+
switch (parent.type) {
|
|
103
|
+
case "VariableDeclarator":
|
|
104
|
+
return parent.init === value && parent.id.type === "Identifier";
|
|
105
|
+
case "Property":
|
|
106
|
+
case "PropertyDefinition":
|
|
107
|
+
return parent.value === value && !parent.computed;
|
|
108
|
+
case "ArrowFunctionExpression":
|
|
109
|
+
return parent.body === value && isNamedFunction(parent);
|
|
110
|
+
case "ReturnStatement":
|
|
111
|
+
return isNamedFunction(enclosingFunction(parent));
|
|
112
|
+
default:
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
var maxLogicalOperandsRule = defineRule2({
|
|
117
|
+
meta: {
|
|
118
|
+
type: "suggestion",
|
|
119
|
+
docs: { description: "Name `&&` and `||` chains of more than three operands." },
|
|
120
|
+
messages: {
|
|
121
|
+
tooMany: [
|
|
122
|
+
"This condition chains {{count}} operands; the maximum inline is 3.",
|
|
123
|
+
"Name what it means: move the complete condition into a `const` or a method",
|
|
124
|
+
"whose name states the domain concept, such as `const changeAlreadyScheduled = ...` or `#canRetryDeletion()`.",
|
|
125
|
+
"Do not split it into several `if` statements with the same outcome,",
|
|
126
|
+
"and do not name its parts after their operands."
|
|
127
|
+
].join(" ")
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
createOnce(context) {
|
|
131
|
+
return {
|
|
132
|
+
LogicalExpression(node) {
|
|
133
|
+
if (!isBooleanLogic(node) || isBooleanLogic(node.parent) || hasName(node)) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const count = countLogicalOperands(node);
|
|
137
|
+
if (count > MAX_LOGICAL_OPERANDS) {
|
|
138
|
+
context.report({ node, messageId: "tooMany", data: { count } });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// src/rules/max_params.ts
|
|
146
|
+
import { defineRule as defineRule3 } from "@oxlint/plugins";
|
|
147
|
+
var MAX_PARAMETERS = 4;
|
|
148
|
+
function parameterCount(node) {
|
|
149
|
+
return node.params.filter((parameter) => parameter.type !== "TSThisParameter" && parameter.name !== "this").length;
|
|
150
|
+
}
|
|
151
|
+
function isInjectDecorator(decorator) {
|
|
152
|
+
const expression = decorator.expression;
|
|
153
|
+
return expression.type === "CallExpression" && expression.callee.type === "Identifier" && expression.callee.name === "inject";
|
|
154
|
+
}
|
|
155
|
+
var maxParamsRule = defineRule3({
|
|
156
|
+
meta: {
|
|
157
|
+
type: "suggestion",
|
|
158
|
+
docs: { description: "Limit functions and methods to four parameters." },
|
|
159
|
+
messages: {
|
|
160
|
+
tooMany: "Use a named argument object instead of {{count}} parameters. The maximum is 4."
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
createOnce(context) {
|
|
164
|
+
function check(node) {
|
|
165
|
+
const count = parameterCount(node);
|
|
166
|
+
if (count > MAX_PARAMETERS) {
|
|
167
|
+
context.report({ node, messageId: "tooMany", data: { count } });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function checkFunction(node) {
|
|
171
|
+
if (node.parent?.type !== "MethodDefinition" && node.parent?.type !== "TSAbstractMethodDefinition") {
|
|
172
|
+
check(node);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function checkMethod(node) {
|
|
176
|
+
if (node.kind === "constructor") {
|
|
177
|
+
const classNode = node.parent?.parent;
|
|
178
|
+
if ((classNode?.type === "ClassDeclaration" || classNode?.type === "ClassExpression") && classNode.decorators?.some(isInjectDecorator)) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
check(node.value);
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
FunctionDeclaration: checkFunction,
|
|
186
|
+
FunctionExpression: checkFunction,
|
|
187
|
+
ArrowFunctionExpression: check,
|
|
188
|
+
TSDeclareFunction: checkFunction,
|
|
189
|
+
TSEmptyBodyFunctionExpression: checkFunction,
|
|
190
|
+
MethodDefinition: checkMethod,
|
|
191
|
+
TSAbstractMethodDefinition: checkMethod,
|
|
192
|
+
TSMethodSignature: check,
|
|
193
|
+
TSCallSignatureDeclaration: check,
|
|
194
|
+
TSConstructSignatureDeclaration: check,
|
|
195
|
+
TSFunctionType: check,
|
|
196
|
+
TSConstructorType: check
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// src/rules/no_await_in_call_arguments.ts
|
|
202
|
+
import { defineRule as defineRule4 } from "@oxlint/plugins";
|
|
203
|
+
var noAwaitInCallArgumentsRule = defineRule4({
|
|
204
|
+
meta: {
|
|
205
|
+
type: "suggestion",
|
|
206
|
+
docs: { description: "Store awaited results before using them in call or constructor arguments." },
|
|
207
|
+
messages: { extract: "Store this awaited result in a variable before passing it to another call." }
|
|
208
|
+
},
|
|
209
|
+
createOnce(context) {
|
|
210
|
+
return {
|
|
211
|
+
AwaitExpression(node) {
|
|
212
|
+
let child = node;
|
|
213
|
+
let parent = child.parent;
|
|
214
|
+
while (parent) {
|
|
215
|
+
if (parent.type === "ArrowFunctionExpression" || parent.type === "FunctionExpression" || parent.type === "FunctionDeclaration") {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (parent.type === "Property" && !parent.computed && parent.value === child) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
if ((parent.type === "CallExpression" || parent.type === "NewExpression") && parent.arguments.some((argument) => argument === child)) {
|
|
222
|
+
context.report({ node, messageId: "extract" });
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
child = parent;
|
|
226
|
+
parent = child.parent;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// src/rules/no_await_in_call_targets.ts
|
|
234
|
+
import { defineRule as defineRule5 } from "@oxlint/plugins";
|
|
235
|
+
function isCallTargetWrapper(node) {
|
|
236
|
+
return node.type === "ChainExpression" || isTypeScriptWrapper(node);
|
|
237
|
+
}
|
|
238
|
+
var noAwaitInCallTargetsRule = defineRule5({
|
|
239
|
+
meta: {
|
|
240
|
+
type: "suggestion",
|
|
241
|
+
docs: { description: "Store awaited results before calling them or their methods." },
|
|
242
|
+
messages: { extract: "Store this awaited result in a variable before calling it or its methods." }
|
|
243
|
+
},
|
|
244
|
+
createOnce(context) {
|
|
245
|
+
return {
|
|
246
|
+
AwaitExpression(node) {
|
|
247
|
+
let child = node;
|
|
248
|
+
let parent = child.parent;
|
|
249
|
+
while (parent.type === "MemberExpression" && parent.object === child || isCallTargetWrapper(parent)) {
|
|
250
|
+
child = parent;
|
|
251
|
+
parent = child.parent;
|
|
252
|
+
}
|
|
253
|
+
if ((parent.type === "CallExpression" || parent.type === "NewExpression") && parent.callee === child) {
|
|
254
|
+
context.report({ node, messageId: "extract" });
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
// src/rules/no_await_in_conditions.ts
|
|
262
|
+
import { defineRule as defineRule6 } from "@oxlint/plugins";
|
|
263
|
+
var CONDITIONALS = /* @__PURE__ */ new Set([
|
|
264
|
+
"IfStatement",
|
|
265
|
+
"WhileStatement",
|
|
266
|
+
"DoWhileStatement",
|
|
267
|
+
"ForStatement",
|
|
268
|
+
"ConditionalExpression"
|
|
269
|
+
]);
|
|
270
|
+
function isConditional(node) {
|
|
271
|
+
return CONDITIONALS.has(node.type);
|
|
272
|
+
}
|
|
273
|
+
var noAwaitInConditionsRule = defineRule6({
|
|
274
|
+
meta: {
|
|
275
|
+
type: "suggestion",
|
|
276
|
+
docs: { description: "Store awaited results before testing them in control-flow conditions." },
|
|
277
|
+
messages: { extract: "Store this awaited result in a variable before using it in a condition." }
|
|
278
|
+
},
|
|
279
|
+
createOnce(context) {
|
|
280
|
+
return {
|
|
281
|
+
AwaitExpression(node) {
|
|
282
|
+
let child = node;
|
|
283
|
+
let parent = child.parent;
|
|
284
|
+
while (parent) {
|
|
285
|
+
if (parent.type === "ArrowFunctionExpression" || parent.type === "FunctionExpression" || parent.type === "FunctionDeclaration") {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if (isConditional(parent) && parent.test === child) {
|
|
289
|
+
context.report({ node, messageId: "extract" });
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
child = parent;
|
|
293
|
+
parent = child.parent;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// src/rules/no_constructor_defaults.ts
|
|
301
|
+
import { defineRule as defineRule7 } from "@oxlint/plugins";
|
|
302
|
+
var EMPTY_CONTAINERS = /* @__PURE__ */ new Set(["Array", "Map", "Set"]);
|
|
303
|
+
function buildsDependency(value) {
|
|
304
|
+
if (isTypeScriptWrapper(value)) {
|
|
305
|
+
return buildsDependency(value.expression);
|
|
306
|
+
}
|
|
307
|
+
if (value.type === "NewExpression") {
|
|
308
|
+
const emptyContainer = value.arguments.length === 0 && value.callee.type === "Identifier" && EMPTY_CONTAINERS.has(value.callee.name);
|
|
309
|
+
return !emptyContainer;
|
|
310
|
+
}
|
|
311
|
+
if (value.type === "MemberExpression") {
|
|
312
|
+
return value.object.type === "Identifier" && value.object.name === "globalThis";
|
|
313
|
+
}
|
|
314
|
+
return value.type === "ArrowFunctionExpression" || value.type === "FunctionExpression";
|
|
315
|
+
}
|
|
316
|
+
var noConstructorDefaultsRule = defineRule7({
|
|
317
|
+
meta: {
|
|
318
|
+
type: "problem",
|
|
319
|
+
docs: { description: "Forbid constructor parameters whose default value builds or captures a dependency." },
|
|
320
|
+
messages: {
|
|
321
|
+
injected: "Inject this dependency instead of building it in a default value: `new`, `globalThis` and functions are refused."
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
createOnce(context) {
|
|
325
|
+
return {
|
|
326
|
+
MethodDefinition(node) {
|
|
327
|
+
if (node.kind !== "constructor") {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
for (const parameter of node.value.params) {
|
|
331
|
+
const declared = parameter.type === "TSParameterProperty" ? parameter.parameter : parameter;
|
|
332
|
+
if (declared.type === "AssignmentPattern" && buildsDependency(declared.right)) {
|
|
333
|
+
context.report({ node: declared, messageId: "injected" });
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
// src/rules/no_typescript_private.ts
|
|
342
|
+
import { defineRule as defineRule8 } from "@oxlint/plugins";
|
|
343
|
+
var noTypescriptPrivateRule = defineRule8({
|
|
344
|
+
meta: {
|
|
345
|
+
type: "problem",
|
|
346
|
+
docs: {
|
|
347
|
+
description: "Require native JavaScript private members, except constructors and readonly constructor parameter properties."
|
|
348
|
+
},
|
|
349
|
+
messages: {
|
|
350
|
+
preferNative: "Use a native JavaScript #private member instead of the TypeScript private modifier."
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
createOnce(context) {
|
|
354
|
+
const reportPrivateMember = (node) => {
|
|
355
|
+
if (node.accessibility === "private") {
|
|
356
|
+
context.report({ node, messageId: "preferNative" });
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
return {
|
|
360
|
+
// A private constructor lets a factory enforce construction invariants; JavaScript has no `#constructor`.
|
|
361
|
+
MethodDefinition(node) {
|
|
362
|
+
if (node.kind !== "constructor") {
|
|
363
|
+
reportPrivateMember(node);
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
PropertyDefinition: reportPrivateMember,
|
|
367
|
+
TSParameterProperty(node) {
|
|
368
|
+
if (node.accessibility === "private" && !node.readonly) {
|
|
369
|
+
context.report({ node, messageId: "preferNative" });
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
// src/oxlint_plugin.ts
|
|
377
|
+
var oxlint_plugin_default = eslintCompatPlugin({
|
|
378
|
+
meta: { name: "boringnode" },
|
|
379
|
+
rules: {
|
|
380
|
+
"blank-line-after-imports": blankLineAfterImportsRule,
|
|
381
|
+
"max-logical-operands": maxLogicalOperandsRule,
|
|
382
|
+
"max-params": maxParamsRule,
|
|
383
|
+
"no-await-in-call-arguments": noAwaitInCallArgumentsRule,
|
|
384
|
+
"no-await-in-call-targets": noAwaitInCallTargetsRule,
|
|
385
|
+
"no-await-in-conditions": noAwaitInConditionsRule,
|
|
386
|
+
"no-constructor-defaults": noConstructorDefaultsRule,
|
|
387
|
+
"no-typescript-private": noTypescriptPrivateRule
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
export {
|
|
391
|
+
oxlint_plugin_default as default
|
|
392
|
+
};
|
|
393
|
+
//# sourceMappingURL=oxlint_plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/oxlint_plugin.ts","../src/rules/blank_line_after_imports.ts","../src/rules/max_logical_operands.ts","../src/rules/shared/typescript_wrapper.ts","../src/rules/max_params.ts","../src/rules/no_await_in_call_arguments.ts","../src/rules/no_await_in_call_targets.ts","../src/rules/no_await_in_conditions.ts","../src/rules/no_constructor_defaults.ts","../src/rules/no_typescript_private.ts"],"sourcesContent":["import { eslintCompatPlugin } from '@oxlint/plugins';\nimport { blankLineAfterImportsRule } from './rules/blank_line_after_imports.ts';\nimport { maxLogicalOperandsRule } from './rules/max_logical_operands.ts';\nimport { maxParamsRule } from './rules/max_params.ts';\nimport { noAwaitInCallArgumentsRule } from './rules/no_await_in_call_arguments.ts';\nimport { noAwaitInCallTargetsRule } from './rules/no_await_in_call_targets.ts';\nimport { noAwaitInConditionsRule } from './rules/no_await_in_conditions.ts';\nimport { noConstructorDefaultsRule } from './rules/no_constructor_defaults.ts';\nimport { noTypescriptPrivateRule } from './rules/no_typescript_private.ts';\n\nexport default eslintCompatPlugin({\n\tmeta: { name: 'boringnode' },\n\trules: {\n\t\t'blank-line-after-imports': blankLineAfterImportsRule,\n\t\t'max-logical-operands': maxLogicalOperandsRule,\n\t\t'max-params': maxParamsRule,\n\t\t'no-await-in-call-arguments': noAwaitInCallArgumentsRule,\n\t\t'no-await-in-call-targets': noAwaitInCallTargetsRule,\n\t\t'no-await-in-conditions': noAwaitInConditionsRule,\n\t\t'no-constructor-defaults': noConstructorDefaultsRule,\n\t\t'no-typescript-private': noTypescriptPrivateRule,\n\t},\n});\n","import { defineRule } from '@oxlint/plugins';\nimport type { ESTree } from '@oxlint/plugins';\n\nfunction hasBlankLineBetween(sourceText: string, previous: ESTree.Node, next: ESTree.Node) {\n\tconst linesBetween = sourceText.slice(previous.end, next.start).split(/\\r?\\n/u).slice(1, -1);\n\n\treturn linesBetween.some((line) => line.trim() === '');\n}\n\nexport const blankLineAfterImportsRule = defineRule({\n\tmeta: {\n\t\ttype: 'layout',\n\t\tfixable: 'whitespace',\n\t\tdocs: {\n\t\t\tdescription: 'Require a blank line between the import block and the module body.',\n\t\t},\n\t\tmessages: {\n\t\t\tmissing: 'Add a blank line after the import block.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tProgram(node) {\n\t\t\t\tconst lastImportIndex = node.body.findLastIndex((statement) => statement.type === 'ImportDeclaration');\n\n\t\t\t\tif (lastImportIndex === -1 || lastImportIndex === node.body.length - 1) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst lastImport = node.body[lastImportIndex];\n\t\t\t\tconst nextStatement = node.body[lastImportIndex + 1];\n\n\t\t\t\tif (hasBlankLineBetween(context.sourceCode.text, lastImport, nextStatement)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: nextStatement,\n\t\t\t\t\tmessageId: 'missing',\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\treturn fixer.insertTextBefore(nextStatement, '\\n');\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n});\n","import { defineRule } from '@oxlint/plugins';\nimport { isTypeScriptWrapper } from './shared/typescript_wrapper.ts';\nimport type { ESTree } from '@oxlint/plugins';\n\nconst MAX_LOGICAL_OPERANDS = 3;\n\nconst FUNCTIONS = new Set(['FunctionDeclaration', 'FunctionExpression', 'ArrowFunctionExpression']);\n\nconst FUNCTION_NAMERS = new Set([\n\t'VariableDeclarator',\n\t'Property',\n\t'PropertyDefinition',\n\t'MethodDefinition',\n\t'TSAbstractMethodDefinition',\n]);\n\nfunction isBooleanLogic(node: ESTree.Node): node is ESTree.LogicalExpression {\n\treturn node.type === 'LogicalExpression' && node.operator !== '??';\n}\n\n/** An element rendered by `condition && <Element />` is not part of the condition. */\nfunction countLogicalOperands(node: ESTree.Expression): number {\n\tif (node.type === 'JSXElement' || node.type === 'JSXFragment') {\n\t\treturn 0;\n\t}\n\n\tif (!isBooleanLogic(node)) {\n\t\treturn 1;\n\t}\n\n\treturn countLogicalOperands(node.left) + countLogicalOperands(node.right);\n}\n\n/** A function declared with a name, or bound to a variable, a property or a method. */\nfunction isNamedFunction(node: ESTree.Node | null) {\n\tif (node?.type === 'FunctionDeclaration') {\n\t\treturn node.id !== null;\n\t}\n\n\tconst isFunctionValue = node?.type === 'FunctionExpression' || node?.type === 'ArrowFunctionExpression';\n\n\treturn isFunctionValue && FUNCTION_NAMERS.has(node.parent.type);\n}\n\nfunction enclosingFunction(node: ESTree.Node) {\n\tlet parent = node.parent;\n\n\twhile (parent && !FUNCTIONS.has(parent.type)) {\n\t\tparent = parent.parent;\n\t}\n\n\treturn parent;\n}\n\n/**\n * The chain is the complete value of a name: a variable, a property, or the result of a named function. A type\n * assertion around it keeps that name.\n */\nfunction hasName(node: ESTree.LogicalExpression) {\n\tlet value: ESTree.Node = node;\n\tlet parent = node.parent;\n\n\twhile (isTypeScriptWrapper(parent)) {\n\t\tvalue = parent;\n\t\tparent = value.parent;\n\t}\n\n\tswitch (parent.type) {\n\t\tcase 'VariableDeclarator':\n\t\t\treturn parent.init === value && parent.id.type === 'Identifier';\n\t\tcase 'Property':\n\t\tcase 'PropertyDefinition':\n\t\t\treturn parent.value === value && !parent.computed;\n\t\tcase 'ArrowFunctionExpression':\n\t\t\treturn parent.body === value && isNamedFunction(parent);\n\t\tcase 'ReturnStatement':\n\t\t\treturn isNamedFunction(enclosingFunction(parent));\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\n/**\n * Asks to name an inline `&&`/`||` chain of more than three operands. `??` does not count, and a chain that is the\n * complete value of a variable, property or named function is accepted.\n */\nexport const maxLogicalOperandsRule = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: { description: 'Name `&&` and `||` chains of more than three operands.' },\n\t\tmessages: {\n\t\t\ttooMany: [\n\t\t\t\t'This condition chains {{count}} operands; the maximum inline is 3.',\n\t\t\t\t'Name what it means: move the complete condition into a `const` or a method',\n\t\t\t\t'whose name states the domain concept, such as `const changeAlreadyScheduled = ...` or `#canRetryDeletion()`.',\n\t\t\t\t'Do not split it into several `if` statements with the same outcome,',\n\t\t\t\t'and do not name its parts after their operands.',\n\t\t\t].join(' '),\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tLogicalExpression(node) {\n\t\t\t\tif (!isBooleanLogic(node) || isBooleanLogic(node.parent) || hasName(node)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst count = countLogicalOperands(node);\n\n\t\t\t\tif (count > MAX_LOGICAL_OPERANDS) {\n\t\t\t\t\tcontext.report({ node, messageId: 'tooMany', data: { count } });\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n});\n","import type { ESTree } from '@oxlint/plugins';\n\ntype TypeScriptWrapper =\n\t| ESTree.TSNonNullExpression\n\t| ESTree.TSAsExpression\n\t| ESTree.TSSatisfiesExpression\n\t| ESTree.TSTypeAssertion;\n\n/** TypeScript syntax that wraps an expression without changing its value. */\nconst TYPESCRIPT_WRAPPERS = new Set([\n\t'TSNonNullExpression',\n\t'TSAsExpression',\n\t'TSSatisfiesExpression',\n\t'TSTypeAssertion',\n]);\n\n/** Whether a node is `x!`, `x as T`, `x satisfies T` or `<T>x`. */\nexport function isTypeScriptWrapper(node: ESTree.Node): node is TypeScriptWrapper {\n\treturn TYPESCRIPT_WRAPPERS.has(node.type);\n}\n","import { defineRule } from '@oxlint/plugins';\nimport type { ESTree } from '@oxlint/plugins';\n\nconst MAX_PARAMETERS = 4;\n\ntype ParameterizedNode = ESTree.Node & { params: Array<{ type: string; name?: string }> };\n\n/** TypeScript's explicit `this` parameter does not count. */\nfunction parameterCount(node: ParameterizedNode) {\n\treturn node.params.filter((parameter) => parameter.type !== 'TSThisParameter' && parameter.name !== 'this').length;\n}\n\nfunction isInjectDecorator(decorator: ESTree.Decorator) {\n\tconst expression = decorator.expression;\n\n\treturn (\n\t\texpression.type === 'CallExpression' &&\n\t\texpression.callee.type === 'Identifier' &&\n\t\texpression.callee.name === 'inject'\n\t);\n}\n\n/**\n * Limits functions, methods and signatures to four parameters. The constructor of an `@inject()` class is exempt,\n * because AdonisJS dependency injection needs positional constructor dependencies.\n */\nexport const maxParamsRule = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: { description: 'Limit functions and methods to four parameters.' },\n\t\tmessages: {\n\t\t\ttooMany: 'Use a named argument object instead of {{count}} parameters. The maximum is 4.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\tfunction check(node: ParameterizedNode) {\n\t\t\tconst count = parameterCount(node);\n\n\t\t\tif (count > MAX_PARAMETERS) {\n\t\t\t\tcontext.report({ node, messageId: 'tooMany', data: { count } });\n\t\t\t}\n\t\t}\n\n\t\tfunction checkFunction(node: ParameterizedNode) {\n\t\t\tif (node.parent?.type !== 'MethodDefinition' && node.parent?.type !== 'TSAbstractMethodDefinition') {\n\t\t\t\tcheck(node);\n\t\t\t}\n\t\t}\n\n\t\tfunction checkMethod(node: ESTree.MethodDefinition) {\n\t\t\tif (node.kind === 'constructor') {\n\t\t\t\tconst classNode = node.parent?.parent;\n\n\t\t\t\tif (\n\t\t\t\t\t(classNode?.type === 'ClassDeclaration' || classNode?.type === 'ClassExpression') &&\n\t\t\t\t\tclassNode.decorators?.some(isInjectDecorator)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcheck(node.value);\n\t\t}\n\n\t\treturn {\n\t\t\tFunctionDeclaration: checkFunction,\n\t\t\tFunctionExpression: checkFunction,\n\t\t\tArrowFunctionExpression: check,\n\t\t\tTSDeclareFunction: checkFunction,\n\t\t\tTSEmptyBodyFunctionExpression: checkFunction,\n\t\t\tMethodDefinition: checkMethod,\n\t\t\tTSAbstractMethodDefinition: checkMethod,\n\t\t\tTSMethodSignature: check,\n\t\t\tTSCallSignatureDeclaration: check,\n\t\t\tTSConstructSignatureDeclaration: check,\n\t\t\tTSFunctionType: check,\n\t\t\tTSConstructorType: check,\n\t\t};\n\t},\n});\n","import { defineRule } from '@oxlint/plugins';\nimport type { ESTree } from '@oxlint/plugins';\n\n/**\n * Rejects `call(await x)`. A non-computed object property may await inline because its key names the result, and an\n * async callback starts its own boundary.\n */\nexport const noAwaitInCallArgumentsRule = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: { description: 'Store awaited results before using them in call or constructor arguments.' },\n\t\tmessages: { extract: 'Store this awaited result in a variable before passing it to another call.' },\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tAwaitExpression(node) {\n\t\t\t\tlet child: ESTree.Node = node;\n\t\t\t\tlet parent: ESTree.Node | null = child.parent;\n\n\t\t\t\twhile (parent) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tparent.type === 'ArrowFunctionExpression' ||\n\t\t\t\t\t\tparent.type === 'FunctionExpression' ||\n\t\t\t\t\t\tparent.type === 'FunctionDeclaration'\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (parent.type === 'Property' && !parent.computed && parent.value === child) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t(parent.type === 'CallExpression' || parent.type === 'NewExpression') &&\n\t\t\t\t\t\tparent.arguments.some((argument) => argument === child)\n\t\t\t\t\t) {\n\t\t\t\t\t\tcontext.report({ node, messageId: 'extract' });\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tchild = parent;\n\t\t\t\t\tparent = child.parent;\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n});\n","import { defineRule } from '@oxlint/plugins';\nimport { isTypeScriptWrapper } from './shared/typescript_wrapper.ts';\nimport type { ESTree } from '@oxlint/plugins';\n\n/** `x?.`, `x!`, `x as T`, `x satisfies T` and `<T>x` keep the awaited value as the call target. */\nfunction isCallTargetWrapper(node: ESTree.Node) {\n\treturn node.type === 'ChainExpression' || isTypeScriptWrapper(node);\n}\n\n/** Rejects `(await x).method()` and `(await x)()`, also through `?.` and type assertions. */\nexport const noAwaitInCallTargetsRule = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: { description: 'Store awaited results before calling them or their methods.' },\n\t\tmessages: { extract: 'Store this awaited result in a variable before calling it or its methods.' },\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tAwaitExpression(node) {\n\t\t\t\tlet child: ESTree.Node = node;\n\t\t\t\tlet parent = child.parent;\n\n\t\t\t\twhile ((parent.type === 'MemberExpression' && parent.object === child) || isCallTargetWrapper(parent)) {\n\t\t\t\t\tchild = parent;\n\t\t\t\t\tparent = child.parent;\n\t\t\t\t}\n\n\t\t\t\tif ((parent.type === 'CallExpression' || parent.type === 'NewExpression') && parent.callee === child) {\n\t\t\t\t\tcontext.report({ node, messageId: 'extract' });\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n});\n","import { defineRule } from '@oxlint/plugins';\nimport type { ESTree } from '@oxlint/plugins';\n\ntype Conditional =\n\t| ESTree.IfStatement\n\t| ESTree.WhileStatement\n\t| ESTree.DoWhileStatement\n\t| ESTree.ForStatement\n\t| ESTree.ConditionalExpression;\n\nconst CONDITIONALS = new Set([\n\t'IfStatement',\n\t'WhileStatement',\n\t'DoWhileStatement',\n\t'ForStatement',\n\t'ConditionalExpression',\n]);\n\nfunction isConditional(node: ESTree.Node): node is Conditional {\n\treturn CONDITIONALS.has(node.type);\n}\n\n/** Rejects an `await` in the test of an `if`, a loop or a ternary. Branches and loop bodies may still await. */\nexport const noAwaitInConditionsRule = defineRule({\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: { description: 'Store awaited results before testing them in control-flow conditions.' },\n\t\tmessages: { extract: 'Store this awaited result in a variable before using it in a condition.' },\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tAwaitExpression(node) {\n\t\t\t\tlet child: ESTree.Node = node;\n\t\t\t\tlet parent: ESTree.Node | null = child.parent;\n\n\t\t\t\twhile (parent) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tparent.type === 'ArrowFunctionExpression' ||\n\t\t\t\t\t\tparent.type === 'FunctionExpression' ||\n\t\t\t\t\t\tparent.type === 'FunctionDeclaration'\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (isConditional(parent) && parent.test === child) {\n\t\t\t\t\t\tcontext.report({ node, messageId: 'extract' });\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tchild = parent;\n\t\t\t\t\tparent = child.parent;\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n});\n","import { defineRule } from '@oxlint/plugins';\nimport { isTypeScriptWrapper } from './shared/typescript_wrapper.ts';\nimport type { ESTree } from '@oxlint/plugins';\n\nconst EMPTY_CONTAINERS = new Set(['Array', 'Map', 'Set']);\n\n/** Whether a default value builds or captures a collaborator: an instance, a global, or a function. */\nfunction buildsDependency(value: ESTree.Node): boolean {\n\tif (isTypeScriptWrapper(value)) {\n\t\treturn buildsDependency(value.expression);\n\t}\n\n\tif (value.type === 'NewExpression') {\n\t\tconst emptyContainer =\n\t\t\tvalue.arguments.length === 0 && value.callee.type === 'Identifier' && EMPTY_CONTAINERS.has(value.callee.name);\n\n\t\treturn !emptyContainer;\n\t}\n\n\tif (value.type === 'MemberExpression') {\n\t\treturn value.object.type === 'Identifier' && value.object.name === 'globalThis';\n\t}\n\n\treturn value.type === 'ArrowFunctionExpression' || value.type === 'FunctionExpression';\n}\n\n/**\n * A constructor receives its collaborators from its caller: a default such as `scheduler = new RuntimeScheduler()`\n * builds one that the container and the tests never see.\n */\nexport const noConstructorDefaultsRule = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: { description: 'Forbid constructor parameters whose default value builds or captures a dependency.' },\n\t\tmessages: {\n\t\t\tinjected:\n\t\t\t\t'Inject this dependency instead of building it in a default value: `new`, `globalThis` and functions are refused.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tMethodDefinition(node) {\n\t\t\t\tif (node.kind !== 'constructor') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfor (const parameter of node.value.params) {\n\t\t\t\t\tconst declared = parameter.type === 'TSParameterProperty' ? parameter.parameter : parameter;\n\n\t\t\t\t\tif (declared.type === 'AssignmentPattern' && buildsDependency(declared.right)) {\n\t\t\t\t\t\tcontext.report({ node: declared, messageId: 'injected' });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n});\n","import { defineRule } from '@oxlint/plugins';\nimport type { ESTree } from '@oxlint/plugins';\n\nexport const noTypescriptPrivateRule = defineRule({\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t'Require native JavaScript private members, except constructors and readonly constructor parameter properties.',\n\t\t},\n\t\tmessages: {\n\t\t\tpreferNative: 'Use a native JavaScript #private member instead of the TypeScript private modifier.',\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\tconst reportPrivateMember = (node: ESTree.MethodDefinition | ESTree.PropertyDefinition) => {\n\t\t\tif (node.accessibility === 'private') {\n\t\t\t\tcontext.report({ node, messageId: 'preferNative' });\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\t// A private constructor lets a factory enforce construction invariants; JavaScript has no `#constructor`.\n\t\t\tMethodDefinition(node) {\n\t\t\t\tif (node.kind !== 'constructor') {\n\t\t\t\t\treportPrivateMember(node);\n\t\t\t\t}\n\t\t\t},\n\t\t\tPropertyDefinition: reportPrivateMember,\n\t\t\tTSParameterProperty(node) {\n\t\t\t\tif (node.accessibility === 'private' && !node.readonly) {\n\t\t\t\t\t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AAAA,IAC1B,2BAA2B;AAAA,IAC3B,yBAAyB;AAAA,EAC1B;AACD,CAAC;","names":["defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,104 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@boringnode/tooling",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared OXLint and OXFmt configurations",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"oxc",
|
|
7
|
+
"oxfmt",
|
|
8
|
+
"oxlint"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "Romain Lanz <romain.lanz@pm.me>",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/boringnode/tooling.git"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/boringnode/tooling#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/boringnode/tooling/issues"
|
|
19
|
+
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"files": [
|
|
22
|
+
"build",
|
|
23
|
+
"THIRD_PARTY_LICENSES.md"
|
|
24
|
+
],
|
|
25
|
+
"exports": {
|
|
26
|
+
"./oxfmt": {
|
|
27
|
+
"types": "./build/oxfmt.d.ts",
|
|
28
|
+
"import": "./build/oxfmt.js"
|
|
29
|
+
},
|
|
30
|
+
"./oxlint": {
|
|
31
|
+
"types": "./build/oxlint.d.ts",
|
|
32
|
+
"import": "./build/oxlint.js"
|
|
33
|
+
},
|
|
34
|
+
"./oxlint/plugin": {
|
|
35
|
+
"types": "./build/oxlint_plugin.d.ts",
|
|
36
|
+
"import": "./build/oxlint_plugin.js"
|
|
37
|
+
},
|
|
38
|
+
"./oxlint/anti-slop": {
|
|
39
|
+
"types": "./build/anti_slop.d.ts",
|
|
40
|
+
"import": "./build/anti_slop.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "yarn clean && tsup-node",
|
|
45
|
+
"clean": "del-cli build",
|
|
46
|
+
"format": "oxfmt --check .",
|
|
47
|
+
"format:fix": "oxfmt --write .",
|
|
48
|
+
"lint": "oxlint",
|
|
49
|
+
"lint:fix": "oxlint --fix",
|
|
50
|
+
"prepublishOnly": "yarn build",
|
|
51
|
+
"release": "yarn dlx release-it",
|
|
52
|
+
"test": "node --test tests/*.test.ts",
|
|
53
|
+
"typecheck": "tsc --noEmit"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@adonisjs/tsconfig": "^2.0.0",
|
|
57
|
+
"@types/node": "^26.0.0",
|
|
58
|
+
"del-cli": "^8.0.1",
|
|
59
|
+
"oxfmt": "^0.77.0",
|
|
60
|
+
"oxlint": "^1.92.0",
|
|
61
|
+
"release-it": "^21.1.2",
|
|
62
|
+
"tsup": "^9.0.0",
|
|
63
|
+
"typescript": "^6.0.3"
|
|
64
|
+
},
|
|
65
|
+
"dependencies": {
|
|
66
|
+
"@oxlint/plugins": "^1.92.0"
|
|
67
|
+
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"oxfmt": ">=0.66.0",
|
|
70
|
+
"oxlint": "^1.78.0"
|
|
71
|
+
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"oxfmt": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"oxlint": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"publishConfig": {
|
|
81
|
+
"access": "public",
|
|
82
|
+
"tag": "latest",
|
|
83
|
+
"provenance": true
|
|
84
|
+
},
|
|
85
|
+
"release-it": {
|
|
86
|
+
"git": {
|
|
87
|
+
"commitMessage": "chore(release): ${version}",
|
|
88
|
+
"tagAnnotation": "v${version}",
|
|
89
|
+
"tagName": "v${version}"
|
|
90
|
+
},
|
|
91
|
+
"github": {
|
|
92
|
+
"release": true,
|
|
93
|
+
"releaseName": "v${version}"
|
|
94
|
+
},
|
|
95
|
+
"npm": {
|
|
96
|
+
"publish": true,
|
|
97
|
+
"skipChecks": true
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"packageManager": "yarn@4.17.1",
|
|
101
|
+
"engines": {
|
|
102
|
+
"node": ">=22.18.0"
|
|
103
|
+
}
|
|
104
|
+
}
|