@bigbinary/eslint-plugin-neeto 1.1.8 → 1.1.10
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 +1 -0
- package/dist/index.js +199 -30
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -81,6 +81,7 @@ module.exports = {
|
|
|
81
81
|
- [use-array-methods](./docs/src/rules/use-array-methods.md)
|
|
82
82
|
- [use-axios-config-for-passing-query-parameters](./docs/src/rules/use-axios-config-for-passing-query-parameters.md)
|
|
83
83
|
- [use-camel-case-or-pascal-case-for-function-names](./docs/src/rules/use-camel-case-or-pascal-case-for-function-names.md)
|
|
84
|
+
- [use-common-constants](./docs/src/rules/use-common-constants.md)
|
|
84
85
|
- [use-common-routes](./docs/src/rules/use-common-routes.md)
|
|
85
86
|
- [use-components-children-prop-in-trans](./docs/src/rules/use-components-children-prop-in-trans.md)
|
|
86
87
|
- [use-create-subscription-util-function](./docs/src/rules/use-create-subscription-util-function.md)
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('path'), require('ramda'), require('@bigbinary/neeto-commons-frontend/pure'), require('fs')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['path', 'ramda', '@bigbinary/neeto-commons-frontend/pure', 'fs'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["@bigbinary/eslint-plugin-neeto"] = factory(global.path$2, global.ramda, global.pure, global.fs));
|
|
5
|
-
})(this, (function (path$2, ramda, pure, fs) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('path'), require('ramda'), require('@bigbinary/neeto-commons-frontend/pure'), require('fs'), require('@bigbinary/neeto-commons-frontend/constants')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['path', 'ramda', '@bigbinary/neeto-commons-frontend/pure', 'fs', '@bigbinary/neeto-commons-frontend/constants'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["@bigbinary/eslint-plugin-neeto"] = factory(global.path$2, global.ramda, global.pure, global.fs, global.neetoCommonsConstants));
|
|
5
|
+
})(this, (function (path$2, ramda, pure, fs, neetoCommonsConstants) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n["default"] = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
9
27
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path$2);
|
|
10
28
|
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
29
|
+
var neetoCommonsConstants__namespace = /*#__PURE__*/_interopNamespace(neetoCommonsConstants);
|
|
11
30
|
|
|
12
31
|
var absolutePath = function absolutePath(jsPath) {
|
|
13
32
|
return path__default["default"].resolve(__dirname, "../../../..", jsPath);
|
|
@@ -82,7 +101,8 @@
|
|
|
82
101
|
"@bigbinary/neeto/no-globalProps-reassignment": "error",
|
|
83
102
|
"@bigbinary/neeto/no-missing-localization": ["error", {
|
|
84
103
|
translationsDir: absolutePath("app/javascript/src/translations"),
|
|
85
|
-
languages: ["en"]
|
|
104
|
+
languages: ["en"],
|
|
105
|
+
nanosTranslationDir: [absolutePath("node_modules/@bigbinary/neeto-team-members-frontend/src/translations")]
|
|
86
106
|
}],
|
|
87
107
|
"@bigbinary/neeto/no-multiple-components-in-a-file": "error",
|
|
88
108
|
"@bigbinary/neeto/no-multiple-translation-functions-under-same-parent": "error",
|
|
@@ -126,7 +146,8 @@
|
|
|
126
146
|
"@bigbinary/neeto/no-repetition-in-prop-key-value-names": "error",
|
|
127
147
|
"@bigbinary/neeto/merge-spread-attributes": "error",
|
|
128
148
|
"@bigbinary/neeto/props-inside-spread-attributes-should-be-sorted": "error",
|
|
129
|
-
"@bigbinary/neeto/props-with-different-key-value-should-be-outside-spread-attribute": "error"
|
|
149
|
+
"@bigbinary/neeto/props-with-different-key-value-should-be-outside-spread-attribute": "error",
|
|
150
|
+
"@bigbinary/neeto/use-common-constants": "warn"
|
|
130
151
|
};
|
|
131
152
|
|
|
132
153
|
var recommended = {
|
|
@@ -438,6 +459,9 @@
|
|
|
438
459
|
var suggestNeetoCommonsFunctionsAndHooks = function suggestNeetoCommonsFunctionsAndHooks(functionName, utilType, url) {
|
|
439
460
|
return "Use \"".concat(functionName, "\" from \"@bigbinary/neeto-commons-frontend/").concat(utilType, "\" instead. Refer: ").concat(url);
|
|
440
461
|
};
|
|
462
|
+
var suggestCommonConstants = function suggestCommonConstants(constantName, repository) {
|
|
463
|
+
return "Use \"".concat(constantName, "\" from \"@bigbinary/").concat(repository, "/constants\"");
|
|
464
|
+
};
|
|
441
465
|
var addRequiredPeerDependencies$1 = function addRequiredPeerDependencies(packageName) {
|
|
442
466
|
return "".concat(packageName, " should be added to peerDependencies");
|
|
443
467
|
};
|
|
@@ -1251,7 +1275,7 @@
|
|
|
1251
1275
|
}
|
|
1252
1276
|
};
|
|
1253
1277
|
|
|
1254
|
-
var checkAndReport$
|
|
1278
|
+
var checkAndReport$6 = function checkAndReport(context, node) {
|
|
1255
1279
|
if (!isInsideApisDirectory(context)) return;
|
|
1256
1280
|
context.report({
|
|
1257
1281
|
node: node,
|
|
@@ -1269,11 +1293,11 @@
|
|
|
1269
1293
|
create: function create(context) {
|
|
1270
1294
|
return {
|
|
1271
1295
|
ExportNamedDeclaration: function ExportNamedDeclaration(node) {
|
|
1272
|
-
checkAndReport$
|
|
1296
|
+
checkAndReport$6(context, node);
|
|
1273
1297
|
},
|
|
1274
1298
|
ExportDefaultDeclaration: function ExportDefaultDeclaration(node) {
|
|
1275
1299
|
if (node.declaration.type !== TYPES.OBJECT_EXPRESSION) return;
|
|
1276
|
-
checkAndReport$
|
|
1300
|
+
checkAndReport$6(context, node);
|
|
1277
1301
|
}
|
|
1278
1302
|
};
|
|
1279
1303
|
}
|
|
@@ -1375,7 +1399,7 @@
|
|
|
1375
1399
|
}
|
|
1376
1400
|
});
|
|
1377
1401
|
};
|
|
1378
|
-
var checkAndReport$
|
|
1402
|
+
var checkAndReport$5 = function checkAndReport(context, node) {
|
|
1379
1403
|
if (!node.async) return;
|
|
1380
1404
|
var subsequentAwaits = getIndependentAwaits(node);
|
|
1381
1405
|
if (subsequentAwaits.length === 0) return;
|
|
@@ -1396,15 +1420,15 @@
|
|
|
1396
1420
|
return {
|
|
1397
1421
|
// const sum = (a, b) => a + b;
|
|
1398
1422
|
ArrowFunctionExpression: function ArrowFunctionExpression(node) {
|
|
1399
|
-
checkAndReport$
|
|
1423
|
+
checkAndReport$5(context, node);
|
|
1400
1424
|
},
|
|
1401
1425
|
// const sum = function (a, b) { return a + b };
|
|
1402
1426
|
FunctionExpression: function FunctionExpression(node) {
|
|
1403
|
-
checkAndReport$
|
|
1427
|
+
checkAndReport$5(context, node);
|
|
1404
1428
|
},
|
|
1405
1429
|
// function sum (a, b) { return a + b };
|
|
1406
1430
|
FunctionDeclaration: function FunctionDeclaration(node) {
|
|
1407
|
-
checkAndReport$
|
|
1431
|
+
checkAndReport$5(context, node);
|
|
1408
1432
|
}
|
|
1409
1433
|
};
|
|
1410
1434
|
}
|
|
@@ -3987,7 +4011,7 @@
|
|
|
3987
4011
|
}
|
|
3988
4012
|
return false;
|
|
3989
4013
|
};
|
|
3990
|
-
var checkAndReport$
|
|
4014
|
+
var checkAndReport$4 = function checkAndReport(node, context) {
|
|
3991
4015
|
var nodeValue = node.type === TYPES.TEMPLATE_ELEMENT ? node.value.raw : node.value;
|
|
3992
4016
|
if (!shouldReport(node, nodeValue, context)) return;
|
|
3993
4017
|
context.report({
|
|
@@ -4006,13 +4030,13 @@
|
|
|
4006
4030
|
create: function create(context) {
|
|
4007
4031
|
return {
|
|
4008
4032
|
Literal: function Literal(node) {
|
|
4009
|
-
checkAndReport$
|
|
4033
|
+
checkAndReport$4(node, context);
|
|
4010
4034
|
},
|
|
4011
4035
|
TemplateLiteral: function TemplateLiteral(node) {
|
|
4012
|
-
checkAndReport$
|
|
4036
|
+
checkAndReport$4(node, context);
|
|
4013
4037
|
},
|
|
4014
4038
|
JSXText: function JSXText(node) {
|
|
4015
|
-
checkAndReport$
|
|
4039
|
+
checkAndReport$4(node, context);
|
|
4016
4040
|
}
|
|
4017
4041
|
};
|
|
4018
4042
|
}
|
|
@@ -4117,6 +4141,7 @@
|
|
|
4117
4141
|
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4118
4142
|
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4119
4143
|
var translationFiles = [];
|
|
4144
|
+
var nanosContent = {};
|
|
4120
4145
|
var previousOptions = null;
|
|
4121
4146
|
var watcher$1 = null;
|
|
4122
4147
|
var watchTranslationsDir = function watchTranslationsDir(translationsDirPath) {
|
|
@@ -4126,10 +4151,10 @@
|
|
|
4126
4151
|
var lng = changedFileName.split(".")[0];
|
|
4127
4152
|
translationFiles = pure.modifyBy({
|
|
4128
4153
|
lng: lng
|
|
4129
|
-
}, ramda.assoc("content", parseJsonData(path$2.join(translationsDirPath, changedFileName))), translationFiles);
|
|
4154
|
+
}, ramda.assoc("content", _objectSpread$3(_objectSpread$3({}, parseJsonData(path$2.join(translationsDirPath, changedFileName))), nanosContent[lng])), translationFiles);
|
|
4130
4155
|
});
|
|
4131
4156
|
};
|
|
4132
|
-
var checkAndReport$
|
|
4157
|
+
var checkAndReport$3 = function checkAndReport(_ref) {
|
|
4133
4158
|
var _config$context, _config$count;
|
|
4134
4159
|
var context = _ref.context,
|
|
4135
4160
|
node = _ref.node,
|
|
@@ -4181,10 +4206,19 @@
|
|
|
4181
4206
|
},
|
|
4182
4207
|
create: function create(context) {
|
|
4183
4208
|
if (pure.isNot(previousOptions, context.options[0])) {
|
|
4209
|
+
var nanosTranslationOption = context.options[0].nanosTranslationDir;
|
|
4184
4210
|
translationFiles = context.options[0].languages.map(function (lng) {
|
|
4211
|
+
nanosContent[lng] = nanosTranslationOption ? nanosTranslationOption.map(function (filePath) {
|
|
4212
|
+
return path$2.join(filePath, "".concat(lng, ".json"));
|
|
4213
|
+
}).reduce(function (mergedObj, filePath) {
|
|
4214
|
+
return _objectSpread$3(_objectSpread$3({}, mergedObj), parseJsonData(filePath));
|
|
4215
|
+
}, {}) : {};
|
|
4216
|
+
var translationsFilePath = path$2.join(context.options[0].translationsDir, "".concat(lng, ".json"));
|
|
4217
|
+
var translationsContent = parseJsonData(translationsFilePath);
|
|
4218
|
+
var combinedContent = _objectSpread$3(_objectSpread$3({}, translationsContent), nanosContent[lng]);
|
|
4185
4219
|
return {
|
|
4186
4220
|
lng: lng,
|
|
4187
|
-
content:
|
|
4221
|
+
content: combinedContent
|
|
4188
4222
|
};
|
|
4189
4223
|
});
|
|
4190
4224
|
previousOptions = context.options[0];
|
|
@@ -4203,7 +4237,7 @@
|
|
|
4203
4237
|
config.count = getObjectPropValue(node.arguments[1], "count");
|
|
4204
4238
|
config.context = getObjectPropValue(node.arguments[1], "context");
|
|
4205
4239
|
}
|
|
4206
|
-
checkAndReport$
|
|
4240
|
+
checkAndReport$3({
|
|
4207
4241
|
key: node.arguments[0].value,
|
|
4208
4242
|
context: context,
|
|
4209
4243
|
node: node,
|
|
@@ -4221,7 +4255,7 @@
|
|
|
4221
4255
|
count: getCountNode(node),
|
|
4222
4256
|
context: contextAttribute === null || contextAttribute === void 0 ? void 0 : contextAttribute.value
|
|
4223
4257
|
};
|
|
4224
|
-
checkAndReport$
|
|
4258
|
+
checkAndReport$3({
|
|
4225
4259
|
key: keyNode.value,
|
|
4226
4260
|
context: context,
|
|
4227
4261
|
node: node,
|
|
@@ -5870,7 +5904,7 @@
|
|
|
5870
5904
|
return getCode$1(context, param);
|
|
5871
5905
|
}).join(", ");
|
|
5872
5906
|
};
|
|
5873
|
-
var checkAndReport$
|
|
5907
|
+
var checkAndReport$2 = function checkAndReport(context, params) {
|
|
5874
5908
|
var isApiAction = isInsideApisDirectory(context);
|
|
5875
5909
|
if (!containsExcessArguments(params, isApiAction)) return;
|
|
5876
5910
|
var loc = {
|
|
@@ -5902,15 +5936,15 @@
|
|
|
5902
5936
|
return {
|
|
5903
5937
|
// const sum = (a, b) => a + b;
|
|
5904
5938
|
ArrowFunctionExpression: function ArrowFunctionExpression(node) {
|
|
5905
|
-
checkAndReport$
|
|
5939
|
+
checkAndReport$2(context, node.params);
|
|
5906
5940
|
},
|
|
5907
5941
|
// const sum = function (a, b) { return a + b };
|
|
5908
5942
|
FunctionExpression: function FunctionExpression(node) {
|
|
5909
|
-
checkAndReport$
|
|
5943
|
+
checkAndReport$2(context, node.params);
|
|
5910
5944
|
},
|
|
5911
5945
|
// function sum (a, b) { return a + b };
|
|
5912
5946
|
FunctionDeclaration: function FunctionDeclaration(node) {
|
|
5913
|
-
checkAndReport$
|
|
5947
|
+
checkAndReport$2(context, node.params);
|
|
5914
5948
|
}
|
|
5915
5949
|
};
|
|
5916
5950
|
}
|
|
@@ -7834,7 +7868,7 @@
|
|
|
7834
7868
|
return key.name === name;
|
|
7835
7869
|
})) === null || _configNode$propertie === void 0 ? void 0 : _configNode$propertie.value;
|
|
7836
7870
|
};
|
|
7837
|
-
var checkAndReport = function checkAndReport(_ref6) {
|
|
7871
|
+
var checkAndReport$1 = function checkAndReport(_ref6) {
|
|
7838
7872
|
var context = _ref6.context,
|
|
7839
7873
|
node = _ref6.node,
|
|
7840
7874
|
urlNode = _ref6.urlNode;
|
|
@@ -7871,7 +7905,7 @@
|
|
|
7871
7905
|
return {
|
|
7872
7906
|
CallExpression: function CallExpression(node) {
|
|
7873
7907
|
if (pure.matches(AXIOS_GET_PATTERN, node)) {
|
|
7874
|
-
checkAndReport({
|
|
7908
|
+
checkAndReport$1({
|
|
7875
7909
|
context: context,
|
|
7876
7910
|
node: node,
|
|
7877
7911
|
urlNode: node.arguments[0]
|
|
@@ -7889,7 +7923,7 @@
|
|
|
7889
7923
|
methodNode = getPropValue(node.arguments[1], "method");
|
|
7890
7924
|
}
|
|
7891
7925
|
if (((_methodNode = methodNode) === null || _methodNode === void 0 ? void 0 : _methodNode.value.toLowerCase()) !== "get") return;
|
|
7892
|
-
checkAndReport({
|
|
7926
|
+
checkAndReport$1({
|
|
7893
7927
|
context: context,
|
|
7894
7928
|
node: node,
|
|
7895
7929
|
urlNode: urlNode
|
|
@@ -7952,6 +7986,140 @@
|
|
|
7952
7986
|
}
|
|
7953
7987
|
};
|
|
7954
7988
|
|
|
7989
|
+
var IMPORT_SOURCES = {
|
|
7990
|
+
"neeto-commons-frontend": "neetocommons/constants",
|
|
7991
|
+
"neeto-team-members-frontend": "neetoteam/constants"
|
|
7992
|
+
};
|
|
7993
|
+
var TRANSLATION_VERBS_PATTERN = {
|
|
7994
|
+
type: TYPES.OBJECT_EXPRESSION,
|
|
7995
|
+
properties: [{
|
|
7996
|
+
type: TYPES.PROPERTY,
|
|
7997
|
+
key: {
|
|
7998
|
+
type: TYPES.IDENTIFIER,
|
|
7999
|
+
name: "count"
|
|
8000
|
+
},
|
|
8001
|
+
value: {
|
|
8002
|
+
type: TYPES.LITERAL,
|
|
8003
|
+
value: function value(_value) {
|
|
8004
|
+
return ramda.includes(_value, [1, 2]);
|
|
8005
|
+
}
|
|
8006
|
+
}
|
|
8007
|
+
}]
|
|
8008
|
+
};
|
|
8009
|
+
var constantImportPattern = function constantImportPattern(constantName, repository) {
|
|
8010
|
+
return {
|
|
8011
|
+
specifiers: function specifiers(_specifiers) {
|
|
8012
|
+
return pure.findBy(pure.matches({
|
|
8013
|
+
type: TYPES.IMPORT_SPECIFIER,
|
|
8014
|
+
local: {
|
|
8015
|
+
type: TYPES.IDENTIFIER,
|
|
8016
|
+
name: constantName
|
|
8017
|
+
}
|
|
8018
|
+
}), _specifiers);
|
|
8019
|
+
},
|
|
8020
|
+
source: {
|
|
8021
|
+
type: TYPES.LITERAL,
|
|
8022
|
+
value: IMPORT_SOURCES[repository]
|
|
8023
|
+
}
|
|
8024
|
+
};
|
|
8025
|
+
};
|
|
8026
|
+
var NEETO_TEAM_MEMBERS_CONSTANTS = {
|
|
8027
|
+
MANAGE_MEMBERS_PERMISSION: "members.manage_members",
|
|
8028
|
+
MANAGE_ROLES_PERMISSION: "settings.manage_roles",
|
|
8029
|
+
VIEW_MEMBERS_PERMISSION: "members.view_members",
|
|
8030
|
+
VIEW_ROLES_PERMISSION: "settings.view_roles"
|
|
8031
|
+
};
|
|
8032
|
+
|
|
8033
|
+
var getKeyByValue = function getKeyByValue(object, targetValue) {
|
|
8034
|
+
return Object.keys(object).find(function (key) {
|
|
8035
|
+
return object[key] === targetValue;
|
|
8036
|
+
});
|
|
8037
|
+
};
|
|
8038
|
+
var reportIssue = function reportIssue(_ref) {
|
|
8039
|
+
var node = _ref.node,
|
|
8040
|
+
repository = _ref.repository,
|
|
8041
|
+
context = _ref.context,
|
|
8042
|
+
constantName = _ref.constantName;
|
|
8043
|
+
context.report({
|
|
8044
|
+
node: node,
|
|
8045
|
+
message: suggestCommonConstants(constantName, repository)
|
|
8046
|
+
});
|
|
8047
|
+
};
|
|
8048
|
+
var checkAndReport = function checkAndReport(_ref2) {
|
|
8049
|
+
var _parentNode$init;
|
|
8050
|
+
var node = _ref2.node,
|
|
8051
|
+
constants = _ref2.constants,
|
|
8052
|
+
repository = _ref2.repository,
|
|
8053
|
+
context = _ref2.context;
|
|
8054
|
+
var nodeName = node.name;
|
|
8055
|
+
var parentNode = node.parent;
|
|
8056
|
+
var parentNodeValue = (_parentNode$init = parentNode.init) === null || _parentNode$init === void 0 ? void 0 : _parentNode$init.value;
|
|
8057
|
+
if (Object.prototype.hasOwnProperty.call(constants, nodeName) && (parentNode.type === TYPES.VARIABLE_DECLARATOR && constants[nodeName] === parentNodeValue || parentNode.type !== TYPES.IMPORT_SPECIFIER && !pure.existsBy(constantImportPattern(nodeName, repository), getAllImports(node)))) {
|
|
8058
|
+
reportIssue({
|
|
8059
|
+
node: node,
|
|
8060
|
+
repository: repository,
|
|
8061
|
+
context: context,
|
|
8062
|
+
constantName: nodeName
|
|
8063
|
+
});
|
|
8064
|
+
} else if (parentNode.type === TYPES.VARIABLE_DECLARATOR && !Number.isInteger(parentNodeValue)) {
|
|
8065
|
+
var key = getKeyByValue(constants, parentNodeValue);
|
|
8066
|
+
if (key) {
|
|
8067
|
+
reportIssue({
|
|
8068
|
+
node: node,
|
|
8069
|
+
repository: repository,
|
|
8070
|
+
context: context,
|
|
8071
|
+
constantName: key
|
|
8072
|
+
});
|
|
8073
|
+
}
|
|
8074
|
+
}
|
|
8075
|
+
};
|
|
8076
|
+
var checkTranslationVerbs = function checkTranslationVerbs(node, context) {
|
|
8077
|
+
var _parentNode$callee;
|
|
8078
|
+
var parentNode = node.parent;
|
|
8079
|
+
var repository = "neeto-commons-frontend";
|
|
8080
|
+
var isCommonConstant = parentNode.type === TYPES.VARIABLE_DECLARATOR ? pure.matches(TRANSLATION_VERBS_PATTERN, parentNode.init) : ((_parentNode$callee = parentNode.callee) === null || _parentNode$callee === void 0 ? void 0 : _parentNode$callee.name) === "t" && !pure.existsBy(constantImportPattern(node.name, repository), getAllImports(node));
|
|
8081
|
+
if (isCommonConstant) {
|
|
8082
|
+
reportIssue({
|
|
8083
|
+
node: node,
|
|
8084
|
+
repository: repository,
|
|
8085
|
+
context: context,
|
|
8086
|
+
constantName: "TRANSLATION_".concat(node.name)
|
|
8087
|
+
});
|
|
8088
|
+
}
|
|
8089
|
+
};
|
|
8090
|
+
|
|
8091
|
+
var useCommonConstants = {
|
|
8092
|
+
meta: {
|
|
8093
|
+
type: "suggestion",
|
|
8094
|
+
docs: {
|
|
8095
|
+
url: "",
|
|
8096
|
+
description: "Suggests using common constants from neeto-team-members and neeto-commons-frontend repos"
|
|
8097
|
+
}
|
|
8098
|
+
},
|
|
8099
|
+
create: function create(context) {
|
|
8100
|
+
return {
|
|
8101
|
+
Identifier: function Identifier(node) {
|
|
8102
|
+
var nodeName = node.name;
|
|
8103
|
+
if (nodeName === "SINGULAR" || nodeName === "PLURAL") {
|
|
8104
|
+
checkTranslationVerbs(node, context);
|
|
8105
|
+
}
|
|
8106
|
+
checkAndReport({
|
|
8107
|
+
node: node,
|
|
8108
|
+
constants: neetoCommonsConstants__namespace,
|
|
8109
|
+
repository: "neeto-commons-frontend",
|
|
8110
|
+
context: context
|
|
8111
|
+
});
|
|
8112
|
+
checkAndReport({
|
|
8113
|
+
node: node,
|
|
8114
|
+
constants: NEETO_TEAM_MEMBERS_CONSTANTS,
|
|
8115
|
+
repository: "neeto-team-members-frontend",
|
|
8116
|
+
context: context
|
|
8117
|
+
});
|
|
8118
|
+
}
|
|
8119
|
+
};
|
|
8120
|
+
}
|
|
8121
|
+
};
|
|
8122
|
+
|
|
7955
8123
|
// createSubscription();
|
|
7956
8124
|
var CUSTOM_CREATE_SUBSCRIPTION_PATTERN = {
|
|
7957
8125
|
type: TYPES.CALL_EXPRESSION,
|
|
@@ -26319,7 +26487,8 @@
|
|
|
26319
26487
|
"use-functions-and-hooks-from-neeto-commons-frontend": useFunctionsAndHooksFromNeetoCommonsFrontend,
|
|
26320
26488
|
"no-unnecessary-if-condition": noUnnecessaryIfCondition,
|
|
26321
26489
|
"zustand-use-with-immutable-actions-wrapper-inside-create": useWithImmutableActionsWrapperInsideCreate,
|
|
26322
|
-
"add-required-peer-dependencies": addRequiredPeerDependencies
|
|
26490
|
+
"add-required-peer-dependencies": addRequiredPeerDependencies,
|
|
26491
|
+
"use-common-constants": useCommonConstants
|
|
26323
26492
|
},
|
|
26324
26493
|
configs: {
|
|
26325
26494
|
recommended: recommended,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/eslint-plugin-neeto",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"scripts": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@babel/preset-typescript": "^7.18.6",
|
|
36
36
|
"@babel/runtime": "^7.19.0",
|
|
37
37
|
"@bigbinary/babel-preset-neeto": "^1.0.3",
|
|
38
|
-
"@bigbinary/eslint-plugin-neeto": "^1.
|
|
39
|
-
"@bigbinary/neeto-commons-frontend": "^2.0.
|
|
38
|
+
"@bigbinary/eslint-plugin-neeto": "^1.1.9",
|
|
39
|
+
"@bigbinary/neeto-commons-frontend": "^2.0.114",
|
|
40
40
|
"@rollup/plugin-alias": "^3.1.9",
|
|
41
41
|
"@rollup/plugin-babel": "^5.3.1",
|
|
42
42
|
"@rollup/plugin-commonjs": "^22.0.0",
|