@interlace/eslint-devkit 1.6.2 → 1.7.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interlace/eslint-devkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Toolkit for building ESLint plugins in TypeScript — AST helpers, type utilities, rule-creation scaffolding, security benchmarks, and SARIF output.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -4,3 +4,4 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
tslib_1.__exportStar(require("./rule-creator"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./mock-context"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./sql-injection-rule"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./unscoped-mutation-rule"), exports);
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
+
* MIT license that can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
|
|
7
|
+
/** Message ids every rule built by this factory reports. */
|
|
8
|
+
export type UnscopedMutationMessageIds = 'unscopedMutation' | 'explicitTruncate';
|
|
9
|
+
export interface UnscopedMutationRuleConfig {
|
|
10
|
+
/**
|
|
11
|
+
* The rule's own `meta.type` + `meta.docs`, spelled out by the caller.
|
|
12
|
+
*
|
|
13
|
+
* Deliberately NOT derived inside this factory: `scripts/audit-rule-meta-completeness.ts`
|
|
14
|
+
* reads rule metadata by *statically parsing the rule's source file*, so
|
|
15
|
+
* metadata hidden in here is invisible to it — a factory-built rule scores
|
|
16
|
+
* 0% and fails the strict gate. Keeping it at the call site also puts each
|
|
17
|
+
* driver's CWE/CVSS where a reader expects to find it.
|
|
18
|
+
*/
|
|
19
|
+
readonly meta: {
|
|
20
|
+
readonly type: 'problem';
|
|
21
|
+
readonly docs: {
|
|
22
|
+
readonly description: string;
|
|
23
|
+
readonly url: string;
|
|
24
|
+
readonly cwe: string;
|
|
25
|
+
readonly cvss: number;
|
|
26
|
+
readonly confidence: 'high' | 'medium' | 'low';
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/** Bulk-mutation sink methods, e.g. `['deleteMany', 'updateMany']`. */
|
|
30
|
+
readonly methods: readonly string[];
|
|
31
|
+
/**
|
|
32
|
+
* Modules whose exports are this driver's handles, e.g. `['drizzle-orm']`.
|
|
33
|
+
* A file that imports none of them is skipped entirely.
|
|
34
|
+
*
|
|
35
|
+
* Method names alone are hopeless discriminators — `delete` and `update` are
|
|
36
|
+
* also `Map.prototype.delete`, `Set.prototype.delete`, and the vocabulary of
|
|
37
|
+
* every store wrapper ever written. Without this gate the Drizzle and Knex
|
|
38
|
+
* instantiations report `map.delete(key)`. Same reasoning as
|
|
39
|
+
* `eslint-plugin-mongodb-security`'s `receiver.ts`.
|
|
40
|
+
*/
|
|
41
|
+
readonly modules: readonly string[];
|
|
42
|
+
/**
|
|
43
|
+
* Identifiers that read as a handle for this driver, matched against the
|
|
44
|
+
* base of the receiver chain (`db` in `db.delete(users)`, `prisma` in
|
|
45
|
+
* `prisma.user.deleteMany()`).
|
|
46
|
+
*
|
|
47
|
+
* Checked in addition to the import gate, because importing `knex` in a file
|
|
48
|
+
* does not make every `.delete()` in it a query. A handle assigned from an
|
|
49
|
+
* imported binding is accepted regardless of its name.
|
|
50
|
+
*/
|
|
51
|
+
readonly receiverPattern: RegExp;
|
|
52
|
+
/**
|
|
53
|
+
* What the sink's arguments mean for this driver. The same AST — a lone
|
|
54
|
+
* identifier argument — means opposite things per driver, so it cannot be
|
|
55
|
+
* inferred:
|
|
56
|
+
*
|
|
57
|
+
* - `'options'` (default) — the arguments may carry the filter
|
|
58
|
+
* (`deleteMany(opts)`, `destroy({ where })`). An argument that cannot be
|
|
59
|
+
* read is therefore treated as possible scope, and nothing is reported.
|
|
60
|
+
* - `'table'` — the argument names the table (`db.delete(users)`,
|
|
61
|
+
* `knex('users').update(values)`) and never carries a filter, so only
|
|
62
|
+
* chain scope counts.
|
|
63
|
+
*
|
|
64
|
+
* Reading `db.delete(users)` as `'options'` would suppress the headline
|
|
65
|
+
* Drizzle finding; reading `deleteMany(opts)` as `'table'` would invent a
|
|
66
|
+
* false positive on every dynamic filter.
|
|
67
|
+
*/
|
|
68
|
+
readonly argumentRole?: 'options' | 'table';
|
|
69
|
+
/**
|
|
70
|
+
* Only report when an options object is actually present but carries no
|
|
71
|
+
* filter — never on a bare `sink()` with no arguments. Defaults to `false`.
|
|
72
|
+
*
|
|
73
|
+
* Required by ORMs whose instance and static methods share a name.
|
|
74
|
+
* Sequelize's `instance.destroy()` deletes exactly one row and takes no
|
|
75
|
+
* arguments, while `Model.destroy({})` empties the table. Without this,
|
|
76
|
+
* every single-row `instance.destroy()` becomes a false positive — and a
|
|
77
|
+
* plugin that fires on correct code is the one users disable.
|
|
78
|
+
*
|
|
79
|
+
* The cost is a deliberate false negative on `Model.destroy()` written with
|
|
80
|
+
* no arguments, which Sequelize rejects at runtime anyway.
|
|
81
|
+
*/
|
|
82
|
+
readonly requireOptionsObject?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Top-level option keys that scope a mutation. Defaults to `['where']`.
|
|
85
|
+
* Only DIRECT properties count — a nested `{ data: { where } }` is data,
|
|
86
|
+
* not a filter.
|
|
87
|
+
*/
|
|
88
|
+
readonly scopeKeys?: readonly string[];
|
|
89
|
+
/**
|
|
90
|
+
* Chain methods that scope a mutation. Defaults to `['where']`; Knex-style
|
|
91
|
+
* drivers pass their variants (`whereIn`, `whereRaw`, ...).
|
|
92
|
+
*/
|
|
93
|
+
readonly scopeMethods?: readonly string[];
|
|
94
|
+
/**
|
|
95
|
+
* Option keys that mean "wipe the table" even though an options object was
|
|
96
|
+
* passed, e.g. Sequelize's `destroy({ truncate: true })`. Reported under
|
|
97
|
+
* `explicitTruncate` because the remediation differs: there is no clause to
|
|
98
|
+
* add, the call itself is the decision.
|
|
99
|
+
*/
|
|
100
|
+
readonly truncateKeys?: readonly string[];
|
|
101
|
+
/** Remediation line in the emitted message. */
|
|
102
|
+
readonly fix: string;
|
|
103
|
+
/** Reference link in the emitted message. */
|
|
104
|
+
readonly documentationLink: string;
|
|
105
|
+
}
|
|
106
|
+
/** Property-key name of an object member, or `undefined` for one we cannot read. */
|
|
107
|
+
export declare function propertyKeyName(prop: TSESTree.ObjectLiteralElement): string | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Does this object literal carry a truthy value under any of `keys`?
|
|
110
|
+
*
|
|
111
|
+
* `truncate: false` is not a truncate, so the value is checked rather than
|
|
112
|
+
* the key's presence.
|
|
113
|
+
*/
|
|
114
|
+
export declare function hasTruthyKey(obj: TSESTree.ObjectExpression, keys: readonly string[]): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Scope evidence inside the call's arguments, for `argumentRole: 'options'`.
|
|
117
|
+
*
|
|
118
|
+
* Returns `true` when scope is present OR cannot be ruled out. An argument we
|
|
119
|
+
* cannot see into — an identifier, a call, a conditional — is treated as
|
|
120
|
+
* scoped: this rule's value is that a finding is always real, so an
|
|
121
|
+
* unreadable filter is a deliberate false negative rather than a guess.
|
|
122
|
+
*
|
|
123
|
+
* A bare literal (`destroy(1)`) is readable and carries no filter, so it does
|
|
124
|
+
* not suppress.
|
|
125
|
+
*/
|
|
126
|
+
export declare function hasArgumentScope(args: readonly TSESTree.CallExpressionArgument[], scopeKeys: readonly string[]): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Every method name called anywhere in the member chain containing `node`.
|
|
129
|
+
*
|
|
130
|
+
* Ascends to the chain root first, so scope written after the sink
|
|
131
|
+
* (`db.delete(users).where(...)`) counts as much as scope written before it
|
|
132
|
+
* (`qb.where(...).delete()`).
|
|
133
|
+
*/
|
|
134
|
+
export declare function chainMethodNames(node: TSESTree.CallExpression): Set<string>;
|
|
135
|
+
/**
|
|
136
|
+
* Build a CWE-284 rule for the given bulk-mutation sinks.
|
|
137
|
+
*
|
|
138
|
+
* Reports a sink call only when BOTH scope channels come up empty: no
|
|
139
|
+
* readable filter in the arguments, and no scoping method anywhere in its
|
|
140
|
+
* chain.
|
|
141
|
+
*/
|
|
142
|
+
/**
|
|
143
|
+
* Local binding names introduced by importing any of `modules`.
|
|
144
|
+
*
|
|
145
|
+
* Covers both `import { drizzle } from 'drizzle-orm'` and
|
|
146
|
+
* `const knex = require('knex')`, including the destructured and namespace
|
|
147
|
+
* forms. An empty set means the file does not touch the driver at all.
|
|
148
|
+
*/
|
|
149
|
+
export declare function driverBindings(program: TSESTree.Program, modules: readonly string[]): Set<string>;
|
|
150
|
+
/**
|
|
151
|
+
* Name at the base of a receiver chain, or `undefined` when it is not an
|
|
152
|
+
* identifier.
|
|
153
|
+
*
|
|
154
|
+
* `db.delete(users)` → `db`; `prisma.user.deleteMany()` → `prisma`;
|
|
155
|
+
* `this.db.delete(t)` → `db`, since `this` carries no name of its own.
|
|
156
|
+
*/
|
|
157
|
+
export declare function receiverBaseName(node: TSESTree.MemberExpression): string | undefined;
|
|
158
|
+
export declare function createUnscopedMutationRule(config: UnscopedMutationRuleConfig): TSESLint.RuleModule<UnscopedMutationMessageIds, []>;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.propertyKeyName = propertyKeyName;
|
|
4
|
+
exports.hasTruthyKey = hasTruthyKey;
|
|
5
|
+
exports.hasArgumentScope = hasArgumentScope;
|
|
6
|
+
exports.chainMethodNames = chainMethodNames;
|
|
7
|
+
exports.driverBindings = driverBindings;
|
|
8
|
+
exports.receiverBaseName = receiverBaseName;
|
|
9
|
+
exports.createUnscopedMutationRule = createUnscopedMutationRule;
|
|
10
|
+
const ast_node_types_1 = require("../ast-node-types");
|
|
11
|
+
const messaging_1 = require("../messaging");
|
|
12
|
+
const DEFAULT_SCOPE_KEYS = ['where'];
|
|
13
|
+
const DEFAULT_SCOPE_METHODS = ['where'];
|
|
14
|
+
function propertyKeyName(prop) {
|
|
15
|
+
if (prop.type !== ast_node_types_1.AST_NODE_TYPES.Property)
|
|
16
|
+
return undefined;
|
|
17
|
+
if (prop.computed)
|
|
18
|
+
return undefined;
|
|
19
|
+
if (prop.key.type === ast_node_types_1.AST_NODE_TYPES.Identifier)
|
|
20
|
+
return prop.key.name;
|
|
21
|
+
if (prop.key.type === ast_node_types_1.AST_NODE_TYPES.Literal && typeof prop.key.value === 'string') {
|
|
22
|
+
return prop.key.value;
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
function hasTruthyKey(obj, keys) {
|
|
27
|
+
return obj.properties.some((prop) => {
|
|
28
|
+
if (prop.type !== ast_node_types_1.AST_NODE_TYPES.Property)
|
|
29
|
+
return false;
|
|
30
|
+
const name = propertyKeyName(prop);
|
|
31
|
+
if (name === undefined || !keys.includes(name))
|
|
32
|
+
return false;
|
|
33
|
+
return !(prop.value.type === ast_node_types_1.AST_NODE_TYPES.Literal && !prop.value.value);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function hasArgumentScope(args, scopeKeys) {
|
|
37
|
+
return args.some((arg) => {
|
|
38
|
+
if (arg.type === ast_node_types_1.AST_NODE_TYPES.ObjectExpression) {
|
|
39
|
+
return arg.properties.some((prop) => {
|
|
40
|
+
if (prop.type === ast_node_types_1.AST_NODE_TYPES.SpreadElement)
|
|
41
|
+
return true;
|
|
42
|
+
const name = propertyKeyName(prop);
|
|
43
|
+
if (name === undefined)
|
|
44
|
+
return true;
|
|
45
|
+
if (!scopeKeys.includes(name))
|
|
46
|
+
return false;
|
|
47
|
+
if (prop.type === ast_node_types_1.AST_NODE_TYPES.Property &&
|
|
48
|
+
prop.value.type === ast_node_types_1.AST_NODE_TYPES.ObjectExpression &&
|
|
49
|
+
prop.value.properties.length === 0) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return arg.type !== ast_node_types_1.AST_NODE_TYPES.Literal;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function chainMethodNames(node) {
|
|
59
|
+
let root = node;
|
|
60
|
+
for (;;) {
|
|
61
|
+
const parent = root.parent;
|
|
62
|
+
if (!parent)
|
|
63
|
+
break;
|
|
64
|
+
if (parent.type === ast_node_types_1.AST_NODE_TYPES.MemberExpression && parent.object === root) {
|
|
65
|
+
root = parent;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (parent.type === ast_node_types_1.AST_NODE_TYPES.CallExpression && parent.callee === root) {
|
|
69
|
+
root = parent;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
const names = new Set();
|
|
75
|
+
let cursor = root;
|
|
76
|
+
for (;;) {
|
|
77
|
+
if (cursor.type === ast_node_types_1.AST_NODE_TYPES.CallExpression) {
|
|
78
|
+
cursor = cursor.callee;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (cursor.type === ast_node_types_1.AST_NODE_TYPES.MemberExpression) {
|
|
82
|
+
if (!cursor.computed && cursor.property.type === ast_node_types_1.AST_NODE_TYPES.Identifier) {
|
|
83
|
+
names.add(cursor.property.name);
|
|
84
|
+
}
|
|
85
|
+
cursor = cursor.object;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
return names;
|
|
91
|
+
}
|
|
92
|
+
function driverBindings(program, modules) {
|
|
93
|
+
const names = new Set();
|
|
94
|
+
const isDriver = (source) => modules.some((m) => source === m || source.startsWith(`${m}/`));
|
|
95
|
+
for (const stmt of program.body) {
|
|
96
|
+
if (stmt.type === ast_node_types_1.AST_NODE_TYPES.ImportDeclaration) {
|
|
97
|
+
if (typeof stmt.source.value !== 'string' || !isDriver(stmt.source.value))
|
|
98
|
+
continue;
|
|
99
|
+
for (const spec of stmt.specifiers)
|
|
100
|
+
names.add(spec.local.name);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (stmt.type !== ast_node_types_1.AST_NODE_TYPES.VariableDeclaration)
|
|
104
|
+
continue;
|
|
105
|
+
for (const decl of stmt.declarations) {
|
|
106
|
+
const init = decl.init;
|
|
107
|
+
if (!init ||
|
|
108
|
+
init.type !== ast_node_types_1.AST_NODE_TYPES.CallExpression ||
|
|
109
|
+
init.callee.type !== ast_node_types_1.AST_NODE_TYPES.Identifier ||
|
|
110
|
+
init.callee.name !== 'require') {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const arg = init.arguments[0];
|
|
114
|
+
if (!arg ||
|
|
115
|
+
arg.type !== ast_node_types_1.AST_NODE_TYPES.Literal ||
|
|
116
|
+
typeof arg.value !== 'string' ||
|
|
117
|
+
!isDriver(arg.value)) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (decl.id.type === ast_node_types_1.AST_NODE_TYPES.Identifier)
|
|
121
|
+
names.add(decl.id.name);
|
|
122
|
+
if (decl.id.type === ast_node_types_1.AST_NODE_TYPES.ObjectPattern) {
|
|
123
|
+
for (const prop of decl.id.properties) {
|
|
124
|
+
if (prop.type === ast_node_types_1.AST_NODE_TYPES.Property && prop.value.type === ast_node_types_1.AST_NODE_TYPES.Identifier) {
|
|
125
|
+
names.add(prop.value.name);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return names;
|
|
132
|
+
}
|
|
133
|
+
function receiverBaseName(node) {
|
|
134
|
+
let cursor = node.object;
|
|
135
|
+
for (;;) {
|
|
136
|
+
if (cursor.type === ast_node_types_1.AST_NODE_TYPES.MemberExpression) {
|
|
137
|
+
if (cursor.object.type === ast_node_types_1.AST_NODE_TYPES.ThisExpression &&
|
|
138
|
+
!cursor.computed &&
|
|
139
|
+
cursor.property.type === ast_node_types_1.AST_NODE_TYPES.Identifier) {
|
|
140
|
+
return cursor.property.name;
|
|
141
|
+
}
|
|
142
|
+
cursor = cursor.object;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (cursor.type === ast_node_types_1.AST_NODE_TYPES.CallExpression) {
|
|
146
|
+
cursor = cursor.callee;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
return cursor.type === ast_node_types_1.AST_NODE_TYPES.Identifier ? cursor.name : undefined;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function createUnscopedMutationRule(config) {
|
|
153
|
+
const sinks = new Set(config.methods);
|
|
154
|
+
const scopeKeys = config.scopeKeys ?? DEFAULT_SCOPE_KEYS;
|
|
155
|
+
const scopeMethods = config.scopeMethods ?? DEFAULT_SCOPE_METHODS;
|
|
156
|
+
const truncateKeys = config.truncateKeys ?? [];
|
|
157
|
+
const argumentRole = config.argumentRole ?? 'options';
|
|
158
|
+
return {
|
|
159
|
+
meta: {
|
|
160
|
+
type: config.meta.type,
|
|
161
|
+
docs: { ...config.meta.docs },
|
|
162
|
+
messages: {
|
|
163
|
+
unscopedMutation: (0, messaging_1.formatLLMMessage)({
|
|
164
|
+
icon: messaging_1.MessageIcons.SECURITY,
|
|
165
|
+
issueName: 'Unscoped Bulk Mutation',
|
|
166
|
+
description: 'Bulk mutation with no filter detected. This rewrites or deletes every row in the table.',
|
|
167
|
+
severity: 'HIGH',
|
|
168
|
+
cwe: config.meta.docs.cwe,
|
|
169
|
+
owasp: 'A01:2021',
|
|
170
|
+
compliance: ['SOC2', 'NIST-CSF'],
|
|
171
|
+
effort: 'low',
|
|
172
|
+
fix: config.fix,
|
|
173
|
+
documentationLink: config.documentationLink,
|
|
174
|
+
}),
|
|
175
|
+
explicitTruncate: (0, messaging_1.formatLLMMessage)({
|
|
176
|
+
icon: messaging_1.MessageIcons.SECURITY,
|
|
177
|
+
issueName: 'Unscoped Bulk Mutation',
|
|
178
|
+
description: 'Table truncation detected. This ignores any filter and empties the whole table.',
|
|
179
|
+
severity: 'HIGH',
|
|
180
|
+
cwe: config.meta.docs.cwe,
|
|
181
|
+
owasp: 'A01:2021',
|
|
182
|
+
compliance: ['SOC2', 'NIST-CSF'],
|
|
183
|
+
effort: 'low',
|
|
184
|
+
fix: 'Remove the truncate flag and delete by filter, or move the truncation to an explicit maintenance script.',
|
|
185
|
+
documentationLink: config.documentationLink,
|
|
186
|
+
}),
|
|
187
|
+
},
|
|
188
|
+
schema: [],
|
|
189
|
+
},
|
|
190
|
+
defaultOptions: [],
|
|
191
|
+
create(context) {
|
|
192
|
+
let bindings = new Set();
|
|
193
|
+
return {
|
|
194
|
+
Program(program) {
|
|
195
|
+
bindings = driverBindings(program, config.modules);
|
|
196
|
+
},
|
|
197
|
+
CallExpression(node) {
|
|
198
|
+
if (bindings.size === 0)
|
|
199
|
+
return;
|
|
200
|
+
if (node.callee.type !== ast_node_types_1.AST_NODE_TYPES.MemberExpression ||
|
|
201
|
+
node.callee.computed ||
|
|
202
|
+
node.callee.property.type !== ast_node_types_1.AST_NODE_TYPES.Identifier ||
|
|
203
|
+
!sinks.has(node.callee.property.name)) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const base = receiverBaseName(node.callee);
|
|
207
|
+
if (base === undefined)
|
|
208
|
+
return;
|
|
209
|
+
if (!bindings.has(base) && !config.receiverPattern.test(base))
|
|
210
|
+
return;
|
|
211
|
+
if (truncateKeys.length > 0) {
|
|
212
|
+
const truncating = node.arguments.some((arg) => arg.type === ast_node_types_1.AST_NODE_TYPES.ObjectExpression && hasTruthyKey(arg, truncateKeys));
|
|
213
|
+
if (truncating) {
|
|
214
|
+
context.report({ node, messageId: 'explicitTruncate' });
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (argumentRole === 'options') {
|
|
219
|
+
if (config.requireOptionsObject === true &&
|
|
220
|
+
!node.arguments.some((arg) => arg.type === ast_node_types_1.AST_NODE_TYPES.ObjectExpression)) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (hasArgumentScope(node.arguments, scopeKeys))
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const chained = chainMethodNames(node);
|
|
227
|
+
if (scopeMethods.some((name) => chained.has(name)))
|
|
228
|
+
return;
|
|
229
|
+
context.report({ node, messageId: 'unscopedMutation' });
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
}
|