@venizia/dev-configs 0.3.0 → 0.3.1-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -31
- package/dist/compilers/bun.d.ts.map +1 -1
- package/dist/compilers/bun.js +1 -0
- package/dist/compilers/bun.js.map +1 -1
- package/dist/formatters/oxfmt.d.ts +14 -0
- package/dist/formatters/oxfmt.d.ts.map +1 -1
- package/dist/formatters/oxfmt.js +19 -1
- package/dist/formatters/oxfmt.js.map +1 -1
- package/dist/linters/browser.d.ts +19 -0
- package/dist/linters/browser.d.ts.map +1 -0
- package/dist/linters/browser.js +32 -0
- package/dist/linters/browser.js.map +1 -0
- package/dist/linters/eslint.d.ts +1 -1
- package/dist/linters/eslint.js +1 -1
- package/dist/linters/house/common.d.ts +20 -0
- package/dist/linters/house/common.d.ts.map +1 -0
- package/dist/linters/house/common.js +29 -0
- package/dist/linters/house/common.js.map +1 -0
- package/dist/linters/house/configs.d.ts +16 -0
- package/dist/linters/house/configs.d.ts.map +1 -0
- package/dist/linters/house/configs.js +45 -0
- package/dist/linters/house/configs.js.map +1 -0
- package/dist/linters/house/index.d.ts +6 -0
- package/dist/linters/house/index.d.ts.map +1 -0
- package/dist/linters/house/index.js +22 -0
- package/dist/linters/house/index.js.map +1 -0
- package/dist/linters/house/max-params-own.rule.d.ts +19 -0
- package/dist/linters/house/max-params-own.rule.d.ts.map +1 -0
- package/dist/linters/house/max-params-own.rule.js +122 -0
- package/dist/linters/house/max-params-own.rule.js.map +1 -0
- package/dist/linters/house/no-new-error.rule.d.ts +15 -0
- package/dist/linters/house/no-new-error.rule.d.ts.map +1 -0
- package/dist/linters/house/no-new-error.rule.js +43 -0
- package/dist/linters/house/no-new-error.rule.js.map +1 -0
- package/dist/linters/house/plugin.d.ts +4 -0
- package/dist/linters/house/plugin.d.ts.map +1 -0
- package/dist/linters/house/plugin.js +15 -0
- package/dist/linters/house/plugin.js.map +1 -0
- package/dist/linters/index.d.ts +2 -0
- package/dist/linters/index.d.ts.map +1 -1
- package/dist/linters/index.js +2 -0
- package/dist/linters/index.js.map +1 -1
- package/dist/linters/oxlint.d.ts +25 -0
- package/dist/linters/oxlint.d.ts.map +1 -1
- package/dist/linters/oxlint.js +43 -1
- package/dist/linters/oxlint.js.map +1 -1
- package/dist/linters/react.d.ts +7 -5
- package/dist/linters/react.d.ts.map +1 -1
- package/dist/linters/react.js +27 -12
- package/dist/linters/react.js.map +1 -1
- package/dist/linters/rules/no-unused-vars.rule.d.ts +5 -0
- package/dist/linters/rules/no-unused-vars.rule.d.ts.map +1 -1
- package/dist/linters/rules/no-unused-vars.rule.js +2 -2
- package/dist/linters/rules/no-unused-vars.rule.js.map +1 -1
- package/dist/linters/rules/prefer-nullish-coalescing.rule.d.ts +7 -0
- package/dist/linters/rules/prefer-nullish-coalescing.rule.d.ts.map +1 -1
- package/dist/linters/rules/prefer-nullish-coalescing.rule.js.map +1 -1
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +18 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/rejection.helper.d.ts +21 -0
- package/dist/testing/rejection.helper.d.ts.map +1 -0
- package/dist/testing/rejection.helper.js +37 -0
- package/dist/testing/rejection.helper.js.map +1 -0
- package/package.json +7 -6
- package/src/tsconfig/tsconfig.browser.json +11 -0
- package/src/tsconfig/tsconfig.react.json +7 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MaxParamsOwnRule = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
const HOOK_NAME = /^use[A-Z]/;
|
|
6
|
+
const CALL_TYPES = new Set(['CallExpression', 'NewExpression']);
|
|
7
|
+
const isArrayContaining = (opts) => Array.isArray(opts.list) && opts.list.includes(opts.item);
|
|
8
|
+
/** `useX(...)`: a hook's callback is ours, so it counts. */
|
|
9
|
+
const isHookCall = (call) => {
|
|
10
|
+
const callee = (0, common_1.readField)({ node: call, key: 'callee' });
|
|
11
|
+
const name = (0, common_1.readField)({ node: callee, key: 'name' });
|
|
12
|
+
return ((0, common_1.nodeType)({ node: callee }) === 'Identifier' && typeof name === 'string' && HOOK_NAME.test(name));
|
|
13
|
+
};
|
|
14
|
+
/** `node` is an argument of a call or `new` that is not a hook. */
|
|
15
|
+
const isLibraryArgument = (opts) => CALL_TYPES.has((0, common_1.nodeType)({ node: opts.parent }) ?? '') &&
|
|
16
|
+
isArrayContaining({
|
|
17
|
+
list: (0, common_1.readField)({ node: opts.parent, key: 'arguments' }),
|
|
18
|
+
item: opts.node,
|
|
19
|
+
}) &&
|
|
20
|
+
!isHookCall(opts.parent);
|
|
21
|
+
/**
|
|
22
|
+
* An object literal whose shape something else declares: a typed variable, `satisfies`, or an argument
|
|
23
|
+
* of a non-hook call (a library option bag). A nested literal inherits it.
|
|
24
|
+
*/
|
|
25
|
+
const hasDeclaredShape = (object) => {
|
|
26
|
+
let current = object;
|
|
27
|
+
while (current) {
|
|
28
|
+
const parent = (0, common_1.readField)({ node: current, key: 'parent' });
|
|
29
|
+
const parentType = (0, common_1.nodeType)({ node: parent });
|
|
30
|
+
const isTypedVariable = parentType === 'VariableDeclarator' &&
|
|
31
|
+
Boolean((0, common_1.readField)({ node: (0, common_1.readField)({ node: parent, key: 'id' }), key: 'typeAnnotation' }));
|
|
32
|
+
if (isTypedVariable ||
|
|
33
|
+
parentType === 'TSSatisfiesExpression' ||
|
|
34
|
+
isLibraryArgument({ node: current, parent })) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
const isNestedValue = parentType === 'Property' && (0, common_1.readField)({ node: parent, key: 'value' }) === current;
|
|
38
|
+
current = isNestedValue ? (0, common_1.readField)({ node: parent, key: 'parent' }) : undefined;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* `venizia/max-params-own`. A function we write takes at most `max` (default 5) positional parameters;
|
|
44
|
+
* beyond that it takes one options object. A signature that belongs to someone else is not counted: an
|
|
45
|
+
* inline callback handed to a call (map, reduce, sort, a library handler) or to a JSX prop, a function a
|
|
46
|
+
* declared type fixes (`const x: TFn = (...)`, a member of a typed or `satisfies` object), and a
|
|
47
|
+
* constructor whose every parameter is injected (`@inject`). A hook's callback (`useCallback(...)`) is ours.
|
|
48
|
+
*/
|
|
49
|
+
class MaxParamsOwnRule {
|
|
50
|
+
static { this.NAME = `${common_1.HOUSE_PLUGIN_NAMESPACE}/max-params-own`; }
|
|
51
|
+
static { this.DEFAULT_MAX = 5; }
|
|
52
|
+
static { this.RULE = {
|
|
53
|
+
meta: {
|
|
54
|
+
type: 'suggestion',
|
|
55
|
+
schema: [{ type: 'integer', minimum: 0 }],
|
|
56
|
+
messages: {
|
|
57
|
+
tooMany: 'A function we write takes up to {{max}} positional parameters, not {{count}}: take one options object.',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
create: context => {
|
|
61
|
+
const max = typeof context.options[0] === 'number' ? context.options[0] : MaxParamsOwnRule.DEFAULT_MAX;
|
|
62
|
+
const isCallback = (node) => {
|
|
63
|
+
const parent = node.parent;
|
|
64
|
+
const isJsxProp = (0, common_1.nodeType)({ node: parent }) === 'JSXExpressionContainer' &&
|
|
65
|
+
(0, common_1.nodeType)({ node: (0, common_1.readField)({ node: parent, key: 'parent' }) }) === 'JSXAttribute';
|
|
66
|
+
return isJsxProp || isLibraryArgument({ node, parent });
|
|
67
|
+
};
|
|
68
|
+
const isInjectedConstructor = (opts) => {
|
|
69
|
+
const parent = opts.node.parent;
|
|
70
|
+
const isDecorated = (param) => {
|
|
71
|
+
const own = (0, common_1.readField)({ node: param, key: 'decorators' });
|
|
72
|
+
const property = (0, common_1.readField)({
|
|
73
|
+
node: (0, common_1.readField)({ node: param, key: 'parameter' }),
|
|
74
|
+
key: 'decorators',
|
|
75
|
+
});
|
|
76
|
+
return ((Array.isArray(own) && own.length > 0) ||
|
|
77
|
+
(Array.isArray(property) && property.length > 0));
|
|
78
|
+
};
|
|
79
|
+
return ((0, common_1.nodeType)({ node: parent }) === 'MethodDefinition' &&
|
|
80
|
+
(0, common_1.readField)({ node: parent, key: 'kind' }) === 'constructor' &&
|
|
81
|
+
opts.params.every(isDecorated));
|
|
82
|
+
};
|
|
83
|
+
const isTypedByContext = (node) => {
|
|
84
|
+
const parent = node.parent;
|
|
85
|
+
const parentType = (0, common_1.nodeType)({ node: parent });
|
|
86
|
+
const isTypedInit = parentType === 'VariableDeclarator' &&
|
|
87
|
+
(0, common_1.readField)({ node: parent, key: 'init' }) === node &&
|
|
88
|
+
Boolean((0, common_1.readField)({ node: (0, common_1.readField)({ node: parent, key: 'id' }), key: 'typeAnnotation' }));
|
|
89
|
+
const grandParent = (0, common_1.readField)({ node: parent, key: 'parent' });
|
|
90
|
+
const isMember = parentType === 'Property' &&
|
|
91
|
+
(0, common_1.readField)({ node: parent, key: 'value' }) === node &&
|
|
92
|
+
(0, common_1.nodeType)({ node: grandParent }) === 'ObjectExpression';
|
|
93
|
+
return isTypedInit || (isMember && hasDeclaredShape(grandParent));
|
|
94
|
+
};
|
|
95
|
+
const check = (node) => {
|
|
96
|
+
const params = (0, common_1.readField)({ node, key: 'params' });
|
|
97
|
+
if (!Array.isArray(params) || params.length <= max) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (isCallback(node) || isInjectedConstructor({ node, params }) || isTypedByContext(node)) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
context.report({
|
|
104
|
+
node,
|
|
105
|
+
messageId: 'tooMany',
|
|
106
|
+
data: { count: String(params.length), max: String(max) },
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
[common_1.AstNodeTypes.FUNCTION_DECLARATION]: check,
|
|
111
|
+
[common_1.AstNodeTypes.FUNCTION_EXPRESSION]: check,
|
|
112
|
+
[common_1.AstNodeTypes.ARROW_FUNCTION_EXPRESSION]: check,
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
}; }
|
|
116
|
+
static build(opts = {}) {
|
|
117
|
+
const { severity = 'error', max = MaxParamsOwnRule.DEFAULT_MAX } = opts;
|
|
118
|
+
return [severity, max];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.MaxParamsOwnRule = MaxParamsOwnRule;
|
|
122
|
+
//# sourceMappingURL=max-params-own.rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"max-params-own.rule.js","sourceRoot":"","sources":["../../../src/linters/house/max-params-own.rule.ts"],"names":[],"mappings":";;;AAEA,qCAAqF;AAErF,MAAM,SAAS,GAAG,WAAW,CAAC;AAC9B,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC;AAEhE,MAAM,iBAAiB,GAAG,CAAC,IAAsC,EAAE,EAAE,CACnE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAE5D,4DAA4D;AAC5D,MAAM,UAAU,GAAG,CAAC,IAAa,EAAE,EAAE;IACnC,MAAM,MAAM,GAAG,IAAA,kBAAS,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,IAAA,kBAAS,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;IACtD,OAAO,CACL,IAAA,iBAAQ,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,YAAY,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAChG,CAAC;AACJ,CAAC,CAAC;AAEF,mEAAmE;AAC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AC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE;iBACzD,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,OAAO;gBACL,CAAC,qBAAY,CAAC,oBAAoB,CAAC,EAAE,KAAK;gBAC1C,CAAC,qBAAY,CAAC,mBAAmB,CAAC,EAAE,KAAK;gBACzC,CAAC,qBAAY,CAAC,yBAAyB,CAAC,EAAE,KAAK;aAChD,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,MAAM,CAAC,KAAK,CAAC,OAAmD,EAAE;QAChE,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,GAAG,GAAG,gBAAgB,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;QACxE,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACzB,CAAC;;AA7FH,4CA8FC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import type { TRuleSeverity } from '../rules/common';
|
|
3
|
+
/**
|
|
4
|
+
* `venizia/no-new-error`. An error is thrown through `getError({ message })` (or an `ApplicationError`),
|
|
5
|
+
* never `new Error(...)` or `Error(...)`: only an ApplicationError carries the status, the message code and
|
|
6
|
+
* args, and the `extra` every IGNIS layer reads.
|
|
7
|
+
*/
|
|
8
|
+
export declare class NoNewErrorRule {
|
|
9
|
+
static readonly NAME = "venizia/no-new-error";
|
|
10
|
+
static readonly RULE: Rule.RuleModule;
|
|
11
|
+
static build(opts?: {
|
|
12
|
+
severity?: TRuleSeverity;
|
|
13
|
+
}): TRuleSeverity;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=no-new-error.rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-new-error.rule.d.ts","sourceRoot":"","sources":["../../../src/linters/house/no-new-error.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;;;GAIG;AACH,qBAAa,cAAc;IACzB,MAAM,CAAC,QAAQ,CAAC,IAAI,0BAA4C;IAEhE,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CA8BnC;IAEF,MAAM,CAAC,KAAK,CAAC,IAAI,GAAE;QAAE,QAAQ,CAAC,EAAE,aAAa,CAAA;KAAO,GAAG,aAAa;CAGrE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoNewErrorRule = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
/**
|
|
6
|
+
* `venizia/no-new-error`. An error is thrown through `getError({ message })` (or an `ApplicationError`),
|
|
7
|
+
* never `new Error(...)` or `Error(...)`: only an ApplicationError carries the status, the message code and
|
|
8
|
+
* args, and the `extra` every IGNIS layer reads.
|
|
9
|
+
*/
|
|
10
|
+
class NoNewErrorRule {
|
|
11
|
+
static { this.NAME = `${common_1.HOUSE_PLUGIN_NAMESPACE}/no-new-error`; }
|
|
12
|
+
static { this.RULE = {
|
|
13
|
+
meta: {
|
|
14
|
+
type: 'problem',
|
|
15
|
+
schema: [],
|
|
16
|
+
messages: {
|
|
17
|
+
newError: 'Throw through getError({ message }) (or an ApplicationError), not `{{form}}`: only an ApplicationError carries the status, code and args.',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
create: context => {
|
|
21
|
+
const report = (opts) => context.report({ node: opts.node, messageId: 'newError', data: { form: opts.form } });
|
|
22
|
+
const isErrorIdentifier = (callee) => (0, common_1.nodeType)({ node: callee }) === 'Identifier' &&
|
|
23
|
+
(0, common_1.readField)({ node: callee, key: 'name' }) === 'Error';
|
|
24
|
+
return {
|
|
25
|
+
[common_1.AstNodeTypes.NEW_EXPRESSION]: (node) => {
|
|
26
|
+
if (isErrorIdentifier((0, common_1.readField)({ node, key: 'callee' }))) {
|
|
27
|
+
report({ node, form: 'new Error(...)' });
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
[common_1.AstNodeTypes.CALL_EXPRESSION]: (node) => {
|
|
31
|
+
if (isErrorIdentifier((0, common_1.readField)({ node, key: 'callee' }))) {
|
|
32
|
+
report({ node, form: 'Error(...)' });
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
}; }
|
|
38
|
+
static build(opts = {}) {
|
|
39
|
+
return opts.severity ?? 'error';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.NoNewErrorRule = NoNewErrorRule;
|
|
43
|
+
//# sourceMappingURL=no-new-error.rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-new-error.rule.js","sourceRoot":"","sources":["../../../src/linters/house/no-new-error.rule.ts"],"names":[],"mappings":";;;AAEA,qCAAqF;AAErF;;;;GAIG;AACH,MAAa,cAAc;aACT,SAAI,GAAG,GAAG,+BAAsB,eAAe,CAAC;aAEhD,SAAI,GAAoB;QACtC,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE;gBACR,QAAQ,EACN,2IAA2I;aAC9I;SACF;QACD,MAAM,EAAE,OAAO,CAAC,EAAE;YAChB,MAAM,MAAM,GAAG,CAAC,IAAuC,EAAE,EAAE,CACzD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAExF,MAAM,iBAAiB,GAAG,CAAC,MAAe,EAAE,EAAE,CAC5C,IAAA,iBAAQ,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,YAAY;gBAC3C,IAAA,kBAAS,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC;YAEvD,OAAO;gBACL,CAAC,qBAAY,CAAC,cAAc,CAAC,EAAE,CAAC,IAAe,EAAE,EAAE;oBACjD,IAAI,iBAAiB,CAAC,IAAA,kBAAS,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC;wBAC1D,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;oBAC3C,CAAC;gBACH,CAAC;gBACD,CAAC,qBAAY,CAAC,eAAe,CAAC,EAAE,CAAC,IAAe,EAAE,EAAE;oBAClD,IAAI,iBAAiB,CAAC,IAAA,kBAAS,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC;wBAC1D,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;oBACvC,CAAC;gBACH,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,MAAM,CAAC,KAAK,CAAC,OAAqC,EAAE;QAClD,OAAO,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC;IAClC,CAAC;;AArCH,wCAsCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/linters/house/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKrC,qGAAqG;AACrG,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAMtC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.houseEslintPlugin = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
const max_params_own_rule_1 = require("./max-params-own.rule");
|
|
6
|
+
const no_new_error_rule_1 = require("./no-new-error.rule");
|
|
7
|
+
/** The ESLint plugin that carries the house rules oxlint cannot express, registered as `venizia`. */
|
|
8
|
+
exports.houseEslintPlugin = {
|
|
9
|
+
meta: { name: `eslint-plugin-${common_1.HOUSE_PLUGIN_NAMESPACE}` },
|
|
10
|
+
rules: {
|
|
11
|
+
'max-params-own': max_params_own_rule_1.MaxParamsOwnRule.RULE,
|
|
12
|
+
'no-new-error': no_new_error_rule_1.NoNewErrorRule.RULE,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/linters/house/plugin.ts"],"names":[],"mappings":";;;AACA,qCAAkD;AAClD,+DAAyD;AACzD,2DAAqD;AAErD,qGAAqG;AACxF,QAAA,iBAAiB,GAAkB;IAC9C,IAAI,EAAE,EAAE,IAAI,EAAE,iBAAiB,+BAAsB,EAAE,EAAE;IACzD,KAAK,EAAE;QACL,gBAAgB,EAAE,sCAAgB,CAAC,IAAI;QACvC,cAAc,EAAE,kCAAc,CAAC,IAAI;KACpC;CACF,CAAC"}
|
package/dist/linters/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/dist/linters/index.js
CHANGED
|
@@ -14,7 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./browser"), exports);
|
|
17
18
|
__exportStar(require("./eslint"), exports);
|
|
19
|
+
__exportStar(require("./house"), exports);
|
|
18
20
|
__exportStar(require("./oxlint"), exports);
|
|
19
21
|
__exportStar(require("./react"), exports);
|
|
20
22
|
__exportStar(require("./rules"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB"}
|
package/dist/linters/oxlint.d.ts
CHANGED
|
@@ -14,6 +14,31 @@ import type { OxlintConfig } from 'oxlint';
|
|
|
14
14
|
*
|
|
15
15
|
* export default defineConfig(oxlintConfigs);
|
|
16
16
|
* ```
|
|
17
|
+
*
|
|
18
|
+
* `OxlintConfigs.create({ lenientFallback: true })` is the same preset with `||` allowed on string
|
|
19
|
+
* and number operands.
|
|
17
20
|
*/
|
|
18
21
|
export declare const oxlintConfigs: OxlintConfig;
|
|
22
|
+
export interface IOxlintPresetOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Allow `||` / `||=` where the left side is a string or a number, so `name || 'guest'` and
|
|
25
|
+
* `limit || 20` pass: `''` and `0` fall back on purpose. Off by default - the base catches a real
|
|
26
|
+
* `''` or `0` swallowed by `||`.
|
|
27
|
+
*/
|
|
28
|
+
lenientFallback?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Builds `oxlintConfigs` with options. Without any it returns the base preset unchanged.
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* // .configs/oxlint.config.mts
|
|
35
|
+
* import { defineConfig } from 'oxlint';
|
|
36
|
+
* import { OxlintConfigs } from '@venizia/dev-configs/linters';
|
|
37
|
+
*
|
|
38
|
+
* export default defineConfig(OxlintConfigs.create({ lenientFallback: true }));
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare class OxlintConfigs {
|
|
42
|
+
static create(opts?: IOxlintPresetOptions): OxlintConfig;
|
|
43
|
+
}
|
|
19
44
|
//# sourceMappingURL=oxlint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxlint.d.ts","sourceRoot":"","sources":["../../src/linters/oxlint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAa3C
|
|
1
|
+
{"version":3,"file":"oxlint.d.ts","sourceRoot":"","sources":["../../src/linters/oxlint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAa3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,EAAE,YA2J3B,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IACxB,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE,oBAAyB,GAAG,YAAY;CAe7D"}
|
package/dist/linters/oxlint.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.oxlintConfigs = void 0;
|
|
3
|
+
exports.OxlintConfigs = exports.oxlintConfigs = void 0;
|
|
4
4
|
const rules_1 = require("./rules");
|
|
5
5
|
/** File globs the rules are scoped to. */
|
|
6
6
|
const TS_FILES = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];
|
|
@@ -20,6 +20,9 @@ const JS_TS_FILES = ['**/*.js', '**/*.cjs', '**/*.mjs', '**/*.jsx', ...TS_FILES]
|
|
|
20
20
|
*
|
|
21
21
|
* export default defineConfig(oxlintConfigs);
|
|
22
22
|
* ```
|
|
23
|
+
*
|
|
24
|
+
* `OxlintConfigs.create({ lenientFallback: true })` is the same preset with `||` allowed on string
|
|
25
|
+
* and number operands.
|
|
23
26
|
*/
|
|
24
27
|
exports.oxlintConfigs = {
|
|
25
28
|
plugins: ['typescript', 'unicorn'],
|
|
@@ -146,6 +149,17 @@ exports.oxlintConfigs = {
|
|
|
146
149
|
'prefer-const': 'error',
|
|
147
150
|
'prefer-rest-params': 'error',
|
|
148
151
|
'prefer-spread': 'error',
|
|
152
|
+
// A value import of a type becomes a runtime import when Bun runs a decorated class's source
|
|
153
|
+
// (emitDecoratorMetadata) and fails with `Export named 'X' not found`. `import('pkg').T` type
|
|
154
|
+
// annotations stay allowed: they are type-only by construction, and type an optional peer.
|
|
155
|
+
'typescript/consistent-type-imports': [
|
|
156
|
+
'error',
|
|
157
|
+
{
|
|
158
|
+
prefer: 'type-imports',
|
|
159
|
+
fixStyle: 'inline-type-imports',
|
|
160
|
+
disallowTypeAnnotations: false,
|
|
161
|
+
},
|
|
162
|
+
],
|
|
149
163
|
},
|
|
150
164
|
},
|
|
151
165
|
{
|
|
@@ -163,4 +177,32 @@ exports.oxlintConfigs = {
|
|
|
163
177
|
},
|
|
164
178
|
],
|
|
165
179
|
};
|
|
180
|
+
/**
|
|
181
|
+
* Builds `oxlintConfigs` with options. Without any it returns the base preset unchanged.
|
|
182
|
+
*
|
|
183
|
+
* ```ts
|
|
184
|
+
* // .configs/oxlint.config.mts
|
|
185
|
+
* import { defineConfig } from 'oxlint';
|
|
186
|
+
* import { OxlintConfigs } from '@venizia/dev-configs/linters';
|
|
187
|
+
*
|
|
188
|
+
* export default defineConfig(OxlintConfigs.create({ lenientFallback: true }));
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
class OxlintConfigs {
|
|
192
|
+
static create(opts = {}) {
|
|
193
|
+
if (!opts.lenientFallback) {
|
|
194
|
+
return exports.oxlintConfigs;
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
...exports.oxlintConfigs,
|
|
198
|
+
rules: {
|
|
199
|
+
...exports.oxlintConfigs.rules,
|
|
200
|
+
[rules_1.PreferNullishCoalescingRule.NAME]: rules_1.PreferNullishCoalescingRule.build({
|
|
201
|
+
ignorePrimitives: { string: true, number: true },
|
|
202
|
+
}),
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.OxlintConfigs = OxlintConfigs;
|
|
166
208
|
//# sourceMappingURL=oxlint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxlint.js","sourceRoot":"","sources":["../../src/linters/oxlint.ts"],"names":[],"mappings":";;;AACA,mCAMiB;AAEjB,0CAA0C;AAC1C,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACjE,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC,CAAC;AAEjF
|
|
1
|
+
{"version":3,"file":"oxlint.js","sourceRoot":"","sources":["../../src/linters/oxlint.ts"],"names":[],"mappings":";;;AACA,mCAMiB;AAEjB,0CAA0C;AAC1C,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACjE,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,UAA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;wBACE,MAAM,EAAE,cAAc;wBACtB,QAAQ,EAAE,qBAAqB;wBAC/B,uBAAuB,EAAE,KAAK;qBAC/B;iBACF;aACF;SACF;QACD;YACE,KAAK,EAAE,WAAW;YAClB,KAAK,EAAE;gBACL,uBAAuB,EAAE,KAAK;gBAC9B,cAAc,EAAE,OAAO;gBACvB,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;gBACvB,CAAC,+BAAuB,CAAC,IAAI,CAAC,EAAE,+BAAuB,CAAC,KAAK,EAAE;gBAC/D,oCAAoC,EAAE,KAAK;gBAC3C,0BAA0B,EAAE,KAAK;gBACjC,iCAAiC,EAAE,KAAK;aACzC;SACF;KACF;CACF,CAAC;AAWF;;;;;;;;;;GAUG;AACH,MAAa,aAAa;IACxB,MAAM,CAAC,MAAM,CAAC,OAA6B,EAAE;QAC3C,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1B,OAAO,qBAAa,CAAC;QACvB,CAAC;QAED,OAAO;YACL,GAAG,qBAAa;YAChB,KAAK,EAAE;gBACL,GAAG,qBAAa,CAAC,KAAK;gBACtB,CAAC,mCAA2B,CAAC,IAAI,CAAC,EAAE,mCAA2B,CAAC,KAAK,CAAC;oBACpE,gBAAgB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;iBACjD,CAAC;aACH;SACF,CAAC;IACJ,CAAC;CACF;AAhBD,sCAgBC"}
|
package/dist/linters/react.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ESLint, Linter } from 'eslint';
|
|
2
2
|
import type { OxlintConfig } from 'oxlint';
|
|
3
|
+
import type { IOxlintPresetOptions } from './oxlint';
|
|
3
4
|
/** Without `configs`: each plugin types its presets its own way, and only the rules are used here. */
|
|
4
5
|
type TRulesPlugin = Omit<ESLint.Plugin, 'configs'>;
|
|
5
6
|
export interface IReactEslintPlugins {
|
|
@@ -31,12 +32,13 @@ export declare class ReactEslintConfigs {
|
|
|
31
32
|
}): Linter.Config[];
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
|
-
* The oxlint counterpart of `ReactEslintConfigs`: `
|
|
35
|
-
* accessibility rules
|
|
36
|
-
* plugins natively, so nothing is passed in. `react/no-deprecated` has no oxlint
|
|
35
|
+
* The oxlint counterpart of `ReactEslintConfigs`: `BrowserOxlintConfigs` (the base rules plus the
|
|
36
|
+
* secure-context ban) plus the React, hooks and accessibility rules and `consistent-type-imports`.
|
|
37
|
+
* oxlint runs these plugins natively, so nothing is passed in. `react/no-deprecated` has no oxlint
|
|
38
|
+
* port and is left out.
|
|
37
39
|
*
|
|
38
40
|
* Nothing in the base is relaxed - frontend code meets the backend's standard - and
|
|
39
|
-
* `exhaustive-deps` is an error.
|
|
41
|
+
* `exhaustive-deps` is an error. Takes the same options as `OxlintConfigs`.
|
|
40
42
|
*
|
|
41
43
|
* ```ts
|
|
42
44
|
* // .configs/oxlint.config.mts
|
|
@@ -47,7 +49,7 @@ export declare class ReactEslintConfigs {
|
|
|
47
49
|
* ```
|
|
48
50
|
*/
|
|
49
51
|
export declare class ReactOxlintConfigs {
|
|
50
|
-
static create(): OxlintConfig;
|
|
52
|
+
static create(opts?: IOxlintPresetOptions): OxlintConfig;
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
53
55
|
* `namingConventionConfigs` for a React project: the base rule plus PascalCase functions in .jsx and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/linters/react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/linters/react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIrD,sGAAsG;AACtG,KAAK,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,EAAE,YAAY,CAAC;IACzB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,mBAAmB,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE;CAqE9F;AAQD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE,oBAAyB,GAAG,YAAY;CAwD7D;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAYvD,CAAC"}
|
package/dist/linters/react.js
CHANGED
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.reactNamingConventionConfigs = exports.ReactOxlintConfigs = exports.ReactEslintConfigs = void 0;
|
|
7
7
|
const typescript_eslint_1 = __importDefault(require("typescript-eslint"));
|
|
8
|
+
const browser_1 = require("./browser");
|
|
8
9
|
const eslint_1 = require("./eslint");
|
|
9
|
-
const oxlint_1 = require("./oxlint");
|
|
10
10
|
const rules_1 = require("./rules");
|
|
11
11
|
/**
|
|
12
12
|
* The base preset plus what a React frontend needs on top: the React, hooks and accessibility rules.
|
|
@@ -79,7 +79,14 @@ class ReactEslintConfigs {
|
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
rules: {
|
|
82
|
-
'@typescript-eslint/consistent-type-imports': [
|
|
82
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
83
|
+
'error',
|
|
84
|
+
{
|
|
85
|
+
prefer: 'type-imports',
|
|
86
|
+
fixStyle: 'inline-type-imports',
|
|
87
|
+
disallowTypeAnnotations: false,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
83
90
|
[rules_1.NoRestrictedPropertiesRule.NAME]: rules_1.NoRestrictedPropertiesRule.build(),
|
|
84
91
|
},
|
|
85
92
|
},
|
|
@@ -92,12 +99,13 @@ const SOURCE_FILES = ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '**/*.mts',
|
|
|
92
99
|
/** A component is declared as `function App()`, so functions may be PascalCase too. */
|
|
93
100
|
const COMPONENT_FUNCTION_SELECTOR = { selector: 'function', format: ['camelCase', 'PascalCase'] };
|
|
94
101
|
/**
|
|
95
|
-
* The oxlint counterpart of `ReactEslintConfigs`: `
|
|
96
|
-
* accessibility rules
|
|
97
|
-
* plugins natively, so nothing is passed in. `react/no-deprecated` has no oxlint
|
|
102
|
+
* The oxlint counterpart of `ReactEslintConfigs`: `BrowserOxlintConfigs` (the base rules plus the
|
|
103
|
+
* secure-context ban) plus the React, hooks and accessibility rules and `consistent-type-imports`.
|
|
104
|
+
* oxlint runs these plugins natively, so nothing is passed in. `react/no-deprecated` has no oxlint
|
|
105
|
+
* port and is left out.
|
|
98
106
|
*
|
|
99
107
|
* Nothing in the base is relaxed - frontend code meets the backend's standard - and
|
|
100
|
-
* `exhaustive-deps` is an error.
|
|
108
|
+
* `exhaustive-deps` is an error. Takes the same options as `OxlintConfigs`.
|
|
101
109
|
*
|
|
102
110
|
* ```ts
|
|
103
111
|
* // .configs/oxlint.config.mts
|
|
@@ -108,12 +116,13 @@ const COMPONENT_FUNCTION_SELECTOR = { selector: 'function', format: ['camelCase'
|
|
|
108
116
|
* ```
|
|
109
117
|
*/
|
|
110
118
|
class ReactOxlintConfigs {
|
|
111
|
-
static create() {
|
|
119
|
+
static create(opts = {}) {
|
|
120
|
+
const browserConfigs = browser_1.BrowserOxlintConfigs.create(opts);
|
|
112
121
|
return {
|
|
113
|
-
...
|
|
114
|
-
plugins: [...new Set([...(
|
|
122
|
+
...browserConfigs,
|
|
123
|
+
plugins: [...new Set([...(browserConfigs.plugins ?? []), 'react', 'jsx-a11y'])],
|
|
115
124
|
overrides: [
|
|
116
|
-
...(
|
|
125
|
+
...(browserConfigs.overrides ?? []),
|
|
117
126
|
{
|
|
118
127
|
files: JSX_FILES,
|
|
119
128
|
rules: {
|
|
@@ -148,8 +157,14 @@ class ReactOxlintConfigs {
|
|
|
148
157
|
rules: {
|
|
149
158
|
'react/rules-of-hooks': 'error',
|
|
150
159
|
'react/exhaustive-deps': 'error',
|
|
151
|
-
'typescript/consistent-type-imports': [
|
|
152
|
-
|
|
160
|
+
'typescript/consistent-type-imports': [
|
|
161
|
+
'error',
|
|
162
|
+
{
|
|
163
|
+
prefer: 'type-imports',
|
|
164
|
+
fixStyle: 'inline-type-imports',
|
|
165
|
+
disallowTypeAnnotations: false,
|
|
166
|
+
},
|
|
167
|
+
],
|
|
153
168
|
},
|
|
154
169
|
},
|
|
155
170
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/linters/react.ts"],"names":[],"mappings":";;;;;;AAEA,0EAAyC;AACzC,qCAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/linters/react.ts"],"names":[],"mappings":";;;;;;AAEA,0EAAyC;AACzC,uCAAiD;AAEjD,qCAAkE;AAClE,mCAA2E;AAW3E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAA6D;QACzE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,I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B,CAAC,IAAI,CAAC,EAAE,4BAAoB,CAAC,KAAK,CAAC;gBACtD,cAAc,EAAE,CAAC,2BAA2B,CAAC;aAC9C,CAAC;SACH;KACF;CACF,CAAC"}
|
|
@@ -7,6 +7,11 @@ export declare class NoUnusedVarsRule {
|
|
|
7
7
|
vars?: 'all' | 'local';
|
|
8
8
|
args?: 'all' | 'after-used' | 'none';
|
|
9
9
|
ignoreRestSiblings?: boolean;
|
|
10
|
+
/** Names that may stay unused, e.g. `^_` - a placeholder a signature needs. */
|
|
11
|
+
argsIgnorePattern?: string;
|
|
12
|
+
varsIgnorePattern?: string;
|
|
13
|
+
caughtErrorsIgnorePattern?: string;
|
|
14
|
+
destructuredArrayIgnorePattern?: string;
|
|
10
15
|
}): TOxlintRuleEntry<'no-unused-vars'>;
|
|
11
16
|
}
|
|
12
17
|
//# sourceMappingURL=no-unused-vars.rule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-unused-vars.rule.d.ts","sourceRoot":"","sources":["../../../src/linters/rules/no-unused-vars.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhE,2FAA2F;AAC3F,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,IAAI,oBAAoB;IAExC,MAAM,CAAC,KAAK,CACV,IAAI,GAAE;QACJ,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE,KAAK,GAAG,YAAY,GAAG,MAAM,CAAC;QACrC,kBAAkB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"no-unused-vars.rule.d.ts","sourceRoot":"","sources":["../../../src/linters/rules/no-unused-vars.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhE,2FAA2F;AAC3F,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,IAAI,oBAAoB;IAExC,MAAM,CAAC,KAAK,CACV,IAAI,GAAE;QACJ,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE,KAAK,GAAG,YAAY,GAAG,MAAM,CAAC;QACrC,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,+EAA+E;QAC/E,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,yBAAyB,CAAC,EAAE,MAAM,CAAC;QACnC,8BAA8B,CAAC,EAAE,MAAM,CAAC;KACpC,GACL,gBAAgB,CAAC,gBAAgB,CAAC;CAUtC"}
|
|
@@ -5,8 +5,8 @@ exports.NoUnusedVarsRule = void 0;
|
|
|
5
5
|
class NoUnusedVarsRule {
|
|
6
6
|
static { this.NAME = 'no-unused-vars'; }
|
|
7
7
|
static build(opts = {}) {
|
|
8
|
-
const { severity = 'error', vars = 'all', args = 'none', ignoreRestSiblings = false } = opts;
|
|
9
|
-
return [severity, { vars, args, ignoreRestSiblings }];
|
|
8
|
+
const { severity = 'error', vars = 'all', args = 'none', ignoreRestSiblings = false, ...patterns } = opts;
|
|
9
|
+
return [severity, { vars, args, ignoreRestSiblings, ...patterns }];
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
exports.NoUnusedVarsRule = NoUnusedVarsRule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-unused-vars.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/no-unused-vars.rule.ts"],"names":[],"mappings":";;;AAEA,2FAA2F;AAC3F,MAAa,gBAAgB;aACX,SAAI,GAAG,gBAAgB,CAAC;IAExC,MAAM,CAAC,KAAK,CACV,
|
|
1
|
+
{"version":3,"file":"no-unused-vars.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/no-unused-vars.rule.ts"],"names":[],"mappings":";;;AAEA,2FAA2F;AAC3F,MAAa,gBAAgB;aACX,SAAI,GAAG,gBAAgB,CAAC;IAExC,MAAM,CAAC,KAAK,CACV,OAUI,EAAE;QAEN,MAAM,EACJ,QAAQ,GAAG,OAAO,EAClB,IAAI,GAAG,KAAK,EACZ,IAAI,GAAG,MAAM,EACb,kBAAkB,GAAG,KAAK,EAC1B,GAAG,QAAQ,EACZ,GAAG,IAAI,CAAC;QACT,OAAO,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;IACrE,CAAC;;AAxBH,4CAyBC"}
|
|
@@ -7,6 +7,13 @@ export declare class PreferNullishCoalescingRule {
|
|
|
7
7
|
ignoreConditionalTests?: boolean;
|
|
8
8
|
ignoreMixedLogicalExpressions?: boolean;
|
|
9
9
|
ignoreTernaryTests?: boolean;
|
|
10
|
+
/** Allow `||` / `||=` where the left side is this primitive, e.g. `{ string: true, number: true }`. */
|
|
11
|
+
ignorePrimitives?: {
|
|
12
|
+
bigint?: boolean;
|
|
13
|
+
boolean?: boolean;
|
|
14
|
+
number?: boolean;
|
|
15
|
+
string?: boolean;
|
|
16
|
+
};
|
|
10
17
|
}): TOxlintRuleEntry<'typescript/prefer-nullish-coalescing'>;
|
|
11
18
|
}
|
|
12
19
|
//# sourceMappingURL=prefer-nullish-coalescing.rule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-nullish-coalescing.rule.d.ts","sourceRoot":"","sources":["../../../src/linters/rules/prefer-nullish-coalescing.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhE,gGAAgG;AAChG,qBAAa,2BAA2B;IACtC,MAAM,CAAC,QAAQ,CAAC,IAAI,0CAA0C;IAE9D,MAAM,CAAC,KAAK,CACV,IAAI,GAAE;QACJ,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,6BAA6B,CAAC,EAAE,OAAO,CAAC;QACxC,kBAAkB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"prefer-nullish-coalescing.rule.d.ts","sourceRoot":"","sources":["../../../src/linters/rules/prefer-nullish-coalescing.rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhE,gGAAgG;AAChG,qBAAa,2BAA2B;IACtC,MAAM,CAAC,QAAQ,CAAC,IAAI,0CAA0C;IAE9D,MAAM,CAAC,KAAK,CACV,IAAI,GAAE;QACJ,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,6BAA6B,CAAC,EAAE,OAAO,CAAC;QACxC,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,uGAAuG;QACvG,gBAAgB,CAAC,EAAE;YACjB,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,OAAO,CAAC,EAAE,OAAO,CAAC;YAClB,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,MAAM,CAAC,EAAE,OAAO,CAAC;SAClB,CAAC;KACE,GACL,gBAAgB,CAAC,sCAAsC,CAAC;CAI5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-nullish-coalescing.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/prefer-nullish-coalescing.rule.ts"],"names":[],"mappings":";;;AAEA,gGAAgG;AAChG,MAAa,2BAA2B;aACtB,SAAI,GAAG,sCAAsC,CAAC;IAE9D,MAAM,CAAC,KAAK,CACV,
|
|
1
|
+
{"version":3,"file":"prefer-nullish-coalescing.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/prefer-nullish-coalescing.rule.ts"],"names":[],"mappings":";;;AAEA,gGAAgG;AAChG,MAAa,2BAA2B;aACtB,SAAI,GAAG,sCAAsC,CAAC;IAE9D,MAAM,CAAC,KAAK,CACV,OAYI,EAAE;QAEN,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;QAChD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;;AApBH,kEAqBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|