@bigbinary/eslint-plugin-neeto 1.0.57 → 1.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +33 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3820,6 +3820,8 @@
|
|
|
3820
3820
|
}
|
|
3821
3821
|
}
|
|
3822
3822
|
};
|
|
3823
|
+
|
|
3824
|
+
// { count: 10 }
|
|
3823
3825
|
var COUNT_PROPERTY_PATTERN = {
|
|
3824
3826
|
type: TYPES.PROPERTY,
|
|
3825
3827
|
key: {
|
|
@@ -3827,6 +3829,16 @@
|
|
|
3827
3829
|
name: "count"
|
|
3828
3830
|
}
|
|
3829
3831
|
};
|
|
3832
|
+
|
|
3833
|
+
// <Trans values={{ name: "order" }} />
|
|
3834
|
+
var OBJECT_ATTRIBUTE_PATTERN = {
|
|
3835
|
+
type: TYPES.JSX_ATTRIBUTE,
|
|
3836
|
+
value: {
|
|
3837
|
+
expression: {
|
|
3838
|
+
type: TYPES.OBJECT_EXPRESSION
|
|
3839
|
+
}
|
|
3840
|
+
}
|
|
3841
|
+
};
|
|
3830
3842
|
var NATURAL_LANGUAGE_REGEX = /^(?:(?:[a-z]+\s)+|\s(?:[a-z]+\s)+|[a-z]*(?:\s[a-z]+)+)$/i;
|
|
3831
3843
|
var EXCLUDED_KEYWORDS_REGEX = /^(.*classnames?|.*class|.*styles?|.*format|viewBox|d|keybinding|rel|sequence)$/i;
|
|
3832
3844
|
var INCLUDED_KEYWORDS_REGEX = /^(.*label|.*title|placeholder|helpText)$/i;
|
|
@@ -3967,16 +3979,34 @@
|
|
|
3967
3979
|
}], node);
|
|
3968
3980
|
};
|
|
3969
3981
|
var getCountNode = function getCountNode(node) {
|
|
3970
|
-
var _countAttribute$value, _findBy2, _valuesAttribute$
|
|
3982
|
+
var _countAttribute$value, _findBy2, _valuesAttribute$valu2, _valuesAttribute$valu3, _valuesAttribute$valu4, _valuesAttribute$valu5;
|
|
3971
3983
|
var countAttribute = findAttribute("count", node);
|
|
3984
|
+
|
|
3985
|
+
// count attribute is present
|
|
3972
3986
|
if (ramda.isNotNil(countAttribute)) return (_countAttribute$value = countAttribute.value) === null || _countAttribute$value === void 0 ? void 0 : _countAttribute$value.expression;
|
|
3973
3987
|
var valuesAttribute = findAttribute("values", node);
|
|
3988
|
+
var hasSpreadAttribute = existsBy$1({
|
|
3989
|
+
type: TYPES.JSX_SPREAD_ATTRIBUTE
|
|
3990
|
+
}, node.attributes);
|
|
3991
|
+
|
|
3992
|
+
// <Trans {...props} /> is valid
|
|
3993
|
+
if (hasSpreadAttribute) return {
|
|
3994
|
+
type: TYPES.JSX_SPREAD_ATTRIBUTE
|
|
3995
|
+
};
|
|
3996
|
+
|
|
3997
|
+
// values attribute and spread attribute not present
|
|
3974
3998
|
if (ramda.isNil(valuesAttribute)) return null;
|
|
3975
|
-
|
|
3999
|
+
|
|
4000
|
+
// values attribute is not an object expression
|
|
4001
|
+
if (!matches(OBJECT_ATTRIBUTE_PATTERN, valuesAttribute)) {
|
|
4002
|
+
var _valuesAttribute$valu;
|
|
4003
|
+
return valuesAttribute === null || valuesAttribute === void 0 ? void 0 : (_valuesAttribute$valu = valuesAttribute.value) === null || _valuesAttribute$valu === void 0 ? void 0 : _valuesAttribute$valu.expression;
|
|
4004
|
+
}
|
|
4005
|
+
var countPropertyValue = (_findBy2 = findBy$1(COUNT_PROPERTY_PATTERN, valuesAttribute === null || valuesAttribute === void 0 ? void 0 : (_valuesAttribute$valu2 = valuesAttribute.value) === null || _valuesAttribute$valu2 === void 0 ? void 0 : (_valuesAttribute$valu3 = _valuesAttribute$valu2.expression) === null || _valuesAttribute$valu3 === void 0 ? void 0 : _valuesAttribute$valu3.properties)) === null || _findBy2 === void 0 ? void 0 : _findBy2.value;
|
|
3976
4006
|
if (ramda.isNotNil(countPropertyValue)) return countPropertyValue;
|
|
3977
4007
|
var hasSpreadElement = existsBy$1({
|
|
3978
4008
|
type: TYPES.SPREAD_ELEMENT
|
|
3979
|
-
}, valuesAttribute === null || valuesAttribute === void 0 ? void 0 : (_valuesAttribute$
|
|
4009
|
+
}, valuesAttribute === null || valuesAttribute === void 0 ? void 0 : (_valuesAttribute$valu4 = valuesAttribute.value) === null || _valuesAttribute$valu4 === void 0 ? void 0 : (_valuesAttribute$valu5 = _valuesAttribute$valu4.expression) === null || _valuesAttribute$valu5 === void 0 ? void 0 : _valuesAttribute$valu5.properties);
|
|
3980
4010
|
if (hasSpreadElement) return {
|
|
3981
4011
|
type: TYPES.SPREAD_ELEMENT
|
|
3982
4012
|
};
|