eslint-plugin-mobx 0.0.6 → 0.0.7
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/CHANGELOG.md +6 -0
- package/dist/index.js +4 -2
- package/package.json +1 -1
- package/src/missing-make-observable.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# eslint-plugin-mobx
|
|
2
2
|
|
|
3
|
+
## 0.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0aaf1831`](https://github.com/mobxjs/mobx/commit/0aaf183131f3eadd40c05ccc94139282bd8d7d56) [#3231](https://github.com/mobxjs/mobx/pull/3231) Thanks [@ahoisl](https://github.com/ahoisl)! - fix(lint): fix 'missing-make-observable' rule with constructor overloads
|
|
8
|
+
|
|
3
9
|
## 0.0.6
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -285,7 +285,7 @@ function create$2(context) {
|
|
|
285
285
|
var sourceCode = context.getSourceCode();
|
|
286
286
|
return {
|
|
287
287
|
'Decorator': function Decorator(decorator) {
|
|
288
|
-
var _constructor$value$bo, _constructor$value$bo2;
|
|
288
|
+
var _clazz$body$body$find, _constructor$value$bo, _constructor$value$bo2;
|
|
289
289
|
|
|
290
290
|
if (!isMobxDecorator(decorator)) return;
|
|
291
291
|
var clazz = findAncestor(decorator, function (node) {
|
|
@@ -293,7 +293,9 @@ function create$2(context) {
|
|
|
293
293
|
});
|
|
294
294
|
if (!clazz) return; // ClassDeclaration > ClassBody > []
|
|
295
295
|
|
|
296
|
-
var constructor = clazz.body.body.find(function (node) {
|
|
296
|
+
var constructor = (_clazz$body$body$find = clazz.body.body.find(function (node) {
|
|
297
|
+
return node.kind === 'constructor' && node.value.type === 'FunctionExpression';
|
|
298
|
+
})) !== null && _clazz$body$body$find !== void 0 ? _clazz$body$body$find : clazz.body.body.find(function (node) {
|
|
297
299
|
return node.kind === 'constructor';
|
|
298
300
|
}); // MethodDefinition > FunctionExpression > BlockStatement > []
|
|
299
301
|
|
package/package.json
CHANGED
|
@@ -11,7 +11,8 @@ function create(context) {
|
|
|
11
11
|
const clazz = findAncestor(decorator, node => node.type === 'ClassDeclaration' || node.type === 'ClassExpression');
|
|
12
12
|
if (!clazz) return;
|
|
13
13
|
// ClassDeclaration > ClassBody > []
|
|
14
|
-
const constructor = clazz.body.body.find(node => node.kind === 'constructor')
|
|
14
|
+
const constructor = clazz.body.body.find(node => node.kind === 'constructor' && node.value.type === 'FunctionExpression') ??
|
|
15
|
+
clazz.body.body.find(node => node.kind === 'constructor');
|
|
15
16
|
// MethodDefinition > FunctionExpression > BlockStatement > []
|
|
16
17
|
const isMakeObservable = node => node.expression?.callee?.name === 'makeObservable' && node.expression?.arguments[0]?.type === 'ThisExpression';
|
|
17
18
|
const makeObservable = constructor?.value.body?.body.find(isMakeObservable)?.expression;
|