@bigbinary/eslint-plugin-neeto 1.1.5 → 1.1.6
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 +354 -248
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,6 +105,7 @@ module.exports = {
|
|
|
105
105
|
- [no-repetition-in-prop-key-value-names](./docs/src/rules/no-repetition-in-prop-key-value-names.md)
|
|
106
106
|
- [use-functions-and-hooks-from-neeto-commons-frontend.md](./docs/src/rules/use-functions-and-hooks-from-neeto-commons-frontend.md)
|
|
107
107
|
- [zustand-use-with-immutable-actions-wrapper-inside-create](./docs/src/rules/zustand-use-with-immutable-actions-wrapper-inside-create.md)
|
|
108
|
+
- [add-required-peer-dependencies](./docs/src/rules/add-required-peer-dependencies.md)
|
|
108
109
|
|
|
109
110
|
## Other references
|
|
110
111
|
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('path'), require('ramda'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['path', 'ramda', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["@bigbinary/eslint-plugin-neeto"] = factory(global.path$2, global.ramda, global.
|
|
5
|
-
})(this, (function (path$2, ramda,
|
|
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';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -204,7 +204,8 @@
|
|
|
204
204
|
"@bigbinary/neeto/webpack-aliases-and-jsconfig-paths-should-be-in-sync": ["error", {
|
|
205
205
|
jsconfigFilePath: path__default["default"].join(rootOfTheProject$1, pathToJsConfigFile),
|
|
206
206
|
aliasFilePath: path__default["default"].join(rootOfTheProject$1, pathToResolveFile$1)
|
|
207
|
-
}]
|
|
207
|
+
}],
|
|
208
|
+
"@bigbinary/neeto/add-required-peer-dependencies": "error"
|
|
208
209
|
}
|
|
209
210
|
});
|
|
210
211
|
|
|
@@ -234,6 +235,342 @@
|
|
|
234
235
|
}
|
|
235
236
|
});
|
|
236
237
|
|
|
238
|
+
function _typeof$1(obj) {
|
|
239
|
+
"@babel/helpers - typeof";
|
|
240
|
+
|
|
241
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
242
|
+
return typeof obj;
|
|
243
|
+
} : function (obj) {
|
|
244
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
245
|
+
}, _typeof$1(obj);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function _toPrimitive(input, hint) {
|
|
249
|
+
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
250
|
+
var prim = input[Symbol.toPrimitive];
|
|
251
|
+
if (prim !== undefined) {
|
|
252
|
+
var res = prim.call(input, hint || "default");
|
|
253
|
+
if (_typeof$1(res) !== "object") return res;
|
|
254
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
255
|
+
}
|
|
256
|
+
return (hint === "string" ? String : Number)(input);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function _toPropertyKey(arg) {
|
|
260
|
+
var key = _toPrimitive(arg, "string");
|
|
261
|
+
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function _defineProperty(obj, key, value) {
|
|
265
|
+
key = _toPropertyKey(key);
|
|
266
|
+
if (key in obj) {
|
|
267
|
+
Object.defineProperty(obj, key, {
|
|
268
|
+
value: value,
|
|
269
|
+
enumerable: true,
|
|
270
|
+
configurable: true,
|
|
271
|
+
writable: true
|
|
272
|
+
});
|
|
273
|
+
} else {
|
|
274
|
+
obj[key] = value;
|
|
275
|
+
}
|
|
276
|
+
return obj;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function ownKeys$6(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; }
|
|
280
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
281
|
+
var prefix = "export default ";
|
|
282
|
+
var jsonProcessor = {
|
|
283
|
+
_prefix: prefix,
|
|
284
|
+
preprocess: function preprocess(text) {
|
|
285
|
+
return ["".concat(prefix).concat(text)];
|
|
286
|
+
},
|
|
287
|
+
postprocess: function postprocess(messages) {
|
|
288
|
+
return messages.reduce(function (total, next) {
|
|
289
|
+
return total.concat(next.filter(function (error) {
|
|
290
|
+
return error.ruleId && error.ruleId.startsWith("@bigbinary/neeto/");
|
|
291
|
+
}));
|
|
292
|
+
}, []).map(function (message) {
|
|
293
|
+
return message.fix ? _objectSpread$6(_objectSpread$6({}, message), {}, {
|
|
294
|
+
fix: _objectSpread$6(_objectSpread$6({}, message.fix), {}, {
|
|
295
|
+
range: message.fix.range.map(function (rangePart) {
|
|
296
|
+
return Math.max(0, rangePart - prefix.length);
|
|
297
|
+
})
|
|
298
|
+
})
|
|
299
|
+
}) : message;
|
|
300
|
+
});
|
|
301
|
+
},
|
|
302
|
+
supportsAutofix: true
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
var APIS_DIRECTORY = "app/javascript/src/apis";
|
|
306
|
+
var REACT_QUERY_DIRECTORY = "app/javascript/src/hooks/reactQuery";
|
|
307
|
+
var ROUTES_FILE_PATH = "app/javascript/src/routes.js";
|
|
308
|
+
var COMPONENTS_DIRECTORY = "app/javascript/src/components";
|
|
309
|
+
var BLACKLISTED_PACKAGES = ["moment", "bootstrap", "blueprint", "react-spinners", "react-table", "remixicon", "mjml", "react-select", "@bigbinary/neeto-utils"];
|
|
310
|
+
var TYPES = {
|
|
311
|
+
ARRAY_EXPRESSION: "ArrayExpression",
|
|
312
|
+
ARROW_FUNCTION_EXPRESSION: "ArrowFunctionExpression",
|
|
313
|
+
ASSIGNMENT_EXPRESSION: "AssignmentExpression",
|
|
314
|
+
ASSIGNMENT_PATTERN: "AssignmentPattern",
|
|
315
|
+
AWAIT_EXPRESSION: "AwaitExpression",
|
|
316
|
+
BINARY_EXPRESSION: "BinaryExpression",
|
|
317
|
+
BLOCK_STATEMENT: "BlockStatement",
|
|
318
|
+
BREAK_STATEMENT: "BreakStatement",
|
|
319
|
+
CALL_EXPRESSION: "CallExpression",
|
|
320
|
+
CHAIN_EXPRESSION: "ChainExpression",
|
|
321
|
+
CONDITIONAL_EXPRESSION: "ConditionalExpression",
|
|
322
|
+
EXPORT_NAMED_DECLARATION: "ExportNamedDeclaration",
|
|
323
|
+
EXPORT_DEFAULT_DECLARATION: "ExportDefaultDeclaration",
|
|
324
|
+
EXPRESSION_STATEMENT: "ExpressionStatement",
|
|
325
|
+
FUNCTION_DECLARATION: "FunctionDeclaration",
|
|
326
|
+
FUNCTION_EXPRESSION: "FunctionExpression",
|
|
327
|
+
IDENTIFIER: "Identifier",
|
|
328
|
+
IF_STATEMENT: "IfStatement",
|
|
329
|
+
IMPORT_DECLARATION: "ImportDeclaration",
|
|
330
|
+
IMPORT_DEFAULT_SPECIFIER: "ImportDefaultSpecifier",
|
|
331
|
+
IMPORT_SPECIFIER: "ImportSpecifier",
|
|
332
|
+
JSX_ATTRIBUTE: "JSXAttribute",
|
|
333
|
+
JSX_ELEMENT: "JSXElement",
|
|
334
|
+
JSX_EXPRESSION_CONTAINER: "JSXExpressionContainer",
|
|
335
|
+
JSX_IDENTIFIER: "JSXIdentifier",
|
|
336
|
+
JSX_OPENING_ELEMENT: "JSXOpeningElement",
|
|
337
|
+
JSX_SPREAD_ATTRIBUTE: "JSXSpreadAttribute",
|
|
338
|
+
JSX_TEXT: "JSXText",
|
|
339
|
+
LITERAL: "Literal",
|
|
340
|
+
LOGICAL_EXPRESSION: "LogicalExpression",
|
|
341
|
+
MEMBER_EXPRESSION: "MemberExpression",
|
|
342
|
+
OBJECT_EXPRESSION: "ObjectExpression",
|
|
343
|
+
OBJECT_PATTERN: "ObjectPattern",
|
|
344
|
+
PROGRAM: "Program",
|
|
345
|
+
PROPERTY: "Property",
|
|
346
|
+
RETURN_STATEMENT: "ReturnStatement",
|
|
347
|
+
SPREAD_ELEMENT: "SpreadElement",
|
|
348
|
+
TEMPLATE_ELEMENT: "TemplateElement",
|
|
349
|
+
TEMPLATE_LITERAL: "TemplateLiteral",
|
|
350
|
+
UNARY_EXPRESSION: "UnaryExpression",
|
|
351
|
+
VARIABLE_DECLARATION: "VariableDeclaration",
|
|
352
|
+
VARIABLE_DECLARATOR: "VariableDeclarator",
|
|
353
|
+
WHILE_STATEMENT: "WhileStatement",
|
|
354
|
+
NEW_EXPRESSION: "NewExpression"
|
|
355
|
+
};
|
|
356
|
+
var IMPORT_DECLARATION = {
|
|
357
|
+
type: TYPES.IMPORT_DECLARATION,
|
|
358
|
+
source: {
|
|
359
|
+
type: TYPES.LITERAL
|
|
360
|
+
},
|
|
361
|
+
specifiers: [{
|
|
362
|
+
type: TYPES.IMPORT_SPECIFIER
|
|
363
|
+
}]
|
|
364
|
+
};
|
|
365
|
+
var CAMEL_CASE_REGEX = /^[a-z][A-Za-z0-9]*$/;
|
|
366
|
+
var CONSTANT_CASE_REGEX = /^[A-Z0-9_]+$/;
|
|
367
|
+
var PASCAL_CASE_REGEX = /^(?:[A-Z]+[a-z0-9]+[A-Z]*)+$/;
|
|
368
|
+
var SNAKE_CASE_REGEX = /^[a-z0-9_]+$/;
|
|
369
|
+
|
|
370
|
+
// const TestComponent = () => {}
|
|
371
|
+
var COMPONENT_PATTERN = {
|
|
372
|
+
type: TYPES.VARIABLE_DECLARATION,
|
|
373
|
+
kind: "const",
|
|
374
|
+
declarations: [{
|
|
375
|
+
type: TYPES.VARIABLE_DECLARATOR,
|
|
376
|
+
init: {
|
|
377
|
+
type: TYPES.ARROW_FUNCTION_EXPRESSION
|
|
378
|
+
},
|
|
379
|
+
id: {
|
|
380
|
+
type: TYPES.IDENTIFIER,
|
|
381
|
+
name: ramda.test(PASCAL_CASE_REGEX)
|
|
382
|
+
}
|
|
383
|
+
}]
|
|
384
|
+
};
|
|
385
|
+
var NO_OF_LINES_ALLOWED_FOR_MULTIPLE_COMPONENTS_IN_A_FILE = 20;
|
|
386
|
+
|
|
387
|
+
var ARGUMENT_LIMIT = 3;
|
|
388
|
+
var API_ACTIONS_ARGUMENT_LIMIT = 2;
|
|
389
|
+
var FIXABLE_PARAMETER_TYPES = [TYPES.IDENTIFIER, TYPES.ASSIGNMENT_PATTERN];
|
|
390
|
+
|
|
391
|
+
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
392
|
+
var addInJsconfig = function addInJsconfig(aliasName) {
|
|
393
|
+
return "Add path for \"".concat(aliasName, "\" in jsconfig.json. Refer https://bit.ly/sync-webpack-alias-and-jsconfig-paths for more details.");
|
|
394
|
+
};
|
|
395
|
+
var canBeReplacedWith = function canBeReplacedWith(fix) {
|
|
396
|
+
return "Can be replaced with: ".concat(fix);
|
|
397
|
+
};
|
|
398
|
+
var disallowUse = function disallowUse(packageName) {
|
|
399
|
+
return "Do not use the package ".concat(packageName);
|
|
400
|
+
};
|
|
401
|
+
var exportedObjectShouldBe = function exportedObjectShouldBe(caseStyle) {
|
|
402
|
+
return "Exported object should be in ".concat(caseStyle, ". Refer https://www.youtube.com/watch?v=As9BzWsGJfY");
|
|
403
|
+
};
|
|
404
|
+
var filenameShouldBe = function filenameShouldBe(caseStyle) {
|
|
405
|
+
return "Filename should be in ".concat(caseStyle, ". Refer https://www.youtube.com/watch?v=As9BzWsGJfY");
|
|
406
|
+
};
|
|
407
|
+
var moveToConstantsJs = function moveToConstantsJs(constantName) {
|
|
408
|
+
return "Move the constant ".concat(constantName, " to a constants.js file.");
|
|
409
|
+
};
|
|
410
|
+
var preferSubscriptionUnsubscribe = function preferSubscriptionUnsubscribe(replacerText) {
|
|
411
|
+
return "Prefer to use ".concat(replacerText, ".unsubscribe() to prevent consumer creation boilerplate.");
|
|
412
|
+
};
|
|
413
|
+
var renameFile = function renameFile(filename) {
|
|
414
|
+
return "Rename this file to ".concat(filename);
|
|
415
|
+
};
|
|
416
|
+
var replaceWith$1 = function replaceWith(fix) {
|
|
417
|
+
return "Replace this with: ".concat(fix);
|
|
418
|
+
};
|
|
419
|
+
var unableToResolveKey = function unableToResolveKey(_ref) {
|
|
420
|
+
var key = _ref.key,
|
|
421
|
+
lng = _ref.lng;
|
|
422
|
+
return "Unable to resolve localized string '".concat(key, "' in ").concat(lng, ".json");
|
|
423
|
+
};
|
|
424
|
+
var giveCamelCaseOrPascalCaseNameFor = function giveCamelCaseOrPascalCaseNameFor(functionName) {
|
|
425
|
+
return "Use either camelCase or PascalCase for naming the function - ".concat(functionName, ".");
|
|
426
|
+
};
|
|
427
|
+
var replaceZustandDefaultExportWith = function replaceZustandDefaultExportWith(fix) {
|
|
428
|
+
return "Zustand has deprecated the use of default exports for its functions. Replace this with: ".concat(fix);
|
|
429
|
+
};
|
|
430
|
+
var replaceTailwindClass = function replaceTailwindClass(tailwindClass, neetoUIClass) {
|
|
431
|
+
return "Replace the class \"".concat(tailwindClass, "\" with its neetoui alternative \"").concat(neetoUIClass, "\"");
|
|
432
|
+
};
|
|
433
|
+
var noMultipleComponentsInAFile$1 = function noMultipleComponentsInAFile() {
|
|
434
|
+
var maxAllowedNoOfLines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 20;
|
|
435
|
+
return "Do not have multiple component definitions that exceed ".concat(maxAllowedNoOfLines, " lines in a single file.");
|
|
436
|
+
};
|
|
437
|
+
var suggestNeetoCommonsFunctionsAndHooks = function suggestNeetoCommonsFunctionsAndHooks(functionName, utilType, url) {
|
|
438
|
+
return "Use \"".concat(functionName, "\" from \"@bigbinary/neeto-commons-frontend/").concat(utilType, "\" instead. Refer: ").concat(url);
|
|
439
|
+
};
|
|
440
|
+
var addRequiredPeerDependencies$1 = function addRequiredPeerDependencies(packageName) {
|
|
441
|
+
return "".concat(packageName, " should be added to peerDependencies");
|
|
442
|
+
};
|
|
443
|
+
var API_CONNECTOR_SHOULD_USE_DEFAULT_EXPORT_MESSAGE = "API Connector should be exported using the default export method";
|
|
444
|
+
var CAN_BE_REPLACED_WITH_HANDLE_META_CLICK = "Can be replaced with handleMetaClick function. Refer https://bit.ly/handleMetaClick";
|
|
445
|
+
var COMBINE_MULTIPLE_INDEPENDENT_AWAITS_MESSAGE = "Combine independent awaits to a single `Promise.all` call.";
|
|
446
|
+
var EXPORTED_OBJECT_AND_FILENAME_SHOULD_MATCH_MESSAGE = "Exported object and filename should match.";
|
|
447
|
+
var GLOBALPROPS_NO_ASSIGNMENT_MESSAGE = "globalProps should not be assigned to other variables";
|
|
448
|
+
var NESTED_GLOBALPROPS_NO_ASSIGNMENT_MESSAGE = "Nested properties of globalProps should not be assigned to other variables";
|
|
449
|
+
var NO_AXIOS_IMPORT_OUTSIDE_APIS_MESSAGE = "Do not use axios outside `app/javascript/src/apis`";
|
|
450
|
+
var NO_CONDITIONAL_RENDER_OF_OVERLAYS = "Overlay components should not be rendered conditionally. Use `isOpen` attribute instead.";
|
|
451
|
+
var NO_EXCESS_API_ACTION_ARGUMENTS_MESSAGE = "API actions should use named parameters for more than ".concat(API_ACTIONS_ARGUMENT_LIMIT, " parameters");
|
|
452
|
+
var NO_EXCESS_FUNCTION_ARGUMENTS_MESSAGE = "Functions should use named parameters for more than ".concat(ARGUMENT_LIMIT, " parameters");
|
|
453
|
+
var NO_GLOBALPROPS_REASSIGNMENT_MESSAGE = "globalProps or its nested properties should not be re-assigned.";
|
|
454
|
+
var NO_ROUTES_ASSIGNMENT = "`routes` or its nested properties should not be assigned to other variables.";
|
|
455
|
+
var NO_ROUTES_REASSIGNMENT = "`routes` or its nested properties should not be re-assigned.";
|
|
456
|
+
var NO_NAMESPACE_SPECIFIER_IMPORT_FOR_RAMDA_MESSAGE = 'Use `import { methodsToImport } from "ramda"` instead';
|
|
457
|
+
var PREFER_EAGER_VALIDATION_MESSAGE = "Prefer to use Formik defaults for `validateOnBlur` and `validateOnChange` to ensure eager validation. Refer https://bit.ly/formik-eager-validation";
|
|
458
|
+
var PREFIX_NEETO_UI_IMPORT_ALIAS_MESSAGE = "Aliases for anything imported from neetoUI or neetoIcons should start with `NeetoUI`";
|
|
459
|
+
var REPLACE_WITH_HANDLE_META_CLICK = "Replace with handleMetaClick function";
|
|
460
|
+
var ROUTE_SHOULD_BE_A_STRING = "Route should be a plain string literal.";
|
|
461
|
+
var ROUTE_SHOULD_MATCH_OBJECT_PATH = "Route string should match with its object path.";
|
|
462
|
+
var ROUTES_HAS_ALREADY_BEEN_DECLARED = "Identifier `routes` has already been declared";
|
|
463
|
+
var ROUTES_CONSTANT_SHOULD_BE_DECLARED = "A constant object named `routes` should be declared inside routes.js";
|
|
464
|
+
var ROUTES_SHOULD_USE_DEFAULT_EXPORT = "`routes` should be exported using the default export method.";
|
|
465
|
+
var UNNECESSARY_CREATE_CONSUMER = "`createSubscription` function from `neetocommon/utils` invalidates the need of `createConsumer`";
|
|
466
|
+
var USE_ARRAY_METHODS = "Use array methods (forEach, map, filter, reduce, etc) instead of 'for' loop. Refer 'Advanced Array Methods' section in https://bit.ly/array-methods-page-1";
|
|
467
|
+
var USE_AXIOS_CONFIG_FOR_PASSING_QUERY_PARAMETERS_MESSAGE = "Use 'params attribute in axios configuration' to pass query parameters.";
|
|
468
|
+
var USE_CREATE_SUBSCRIPTION_FROM_NEETO_COMMONS = "Use `createSubscription` from @bigbinary/neeto-commons-frontend/utils instead. Refer: https://github.com/bigbinary/neeto-commons-frontend/blob/main/docs/utils/README.md#createsubscription";
|
|
469
|
+
var USE_INLINE_SVG_FOR_RENDER = "Use inline SVG instead of img tag for rendering SVGs";
|
|
470
|
+
var USE_LINK_FOR_NAVIGATION = "Use Link or NavLink component from 'react-router-dom' for click-navigation instead of onClick handler";
|
|
471
|
+
var USE_ANCHOR_FOR_NAVIGATION = "Use Anchor element (<a>) for click-navigation instead of onClick handler";
|
|
472
|
+
var USE_BUTTON_TO_FOR_LINK_NAVIGATION = "Use `to` prop of Button (<Button to='path'>) for click-navigation instead of onClick handler";
|
|
473
|
+
var USE_BUTTON_TO_FOR_ANCHOR_NAVIGATION = "Use `href` prop of Button (<Button href='path'>) for click-navigation instead of onClick handler";
|
|
474
|
+
var USE_NEETO_SMALLER_CASE = "Use 'neeto' instead of 'Neeto' in strings";
|
|
475
|
+
var USE_NEETOUI_BORDER_COLOR = "Use neetoUI border color. Refer https://bit.ly/neeto-ui-border-colors for more details.";
|
|
476
|
+
var USE_NEETOUI_BORDER_RADIUS = "Use neetoUI border radius. Refer https://bit.ly/neeto-ui-border-radius for more details.";
|
|
477
|
+
var USE_NEETOUI_BOX_SHADOW = "Use neetoUI border shadow. Refer https://bit.ly/neeto-ui-box-shadows for more details.";
|
|
478
|
+
var USE_NEETOUI_TEXT_COLOR = "Use neetoUI text color. Refer https://bit.ly/neeto-ui-text-color for more details.";
|
|
479
|
+
var DONT_USE_ZUSTAND_STORE_WITHOUT_SELECTOR = "Don't use zustand store hook without a selector function. It will impact the performance";
|
|
480
|
+
var DONT_USE_ZUSTAND_STORE_WITHOUT_COMPARATOR_FUNCTION = "Don't pick multiple zustand state items without comparator function";
|
|
481
|
+
var USE_PROP_FOR_PICKING_SINGLE_ITEM = "Use prop instead of pick when picking single item";
|
|
482
|
+
var ENSURE_ZUSTAND_STORES_ARE_TYPE_ANNOTATED = "\n Zustand stores should be type annotated like this:\n /** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\n const useUserStore = create(...)\n";
|
|
483
|
+
var USE_REACT_QUERY_FOR_MANAGING_REMOTE_DATA = "API calls should be managed using React Query";
|
|
484
|
+
var FILES_INSIDE_REACT_QUERY_FOLDER_SHOULD_END_WITH_API = "Files inside reactQuery folder should end with Api";
|
|
485
|
+
var USE_ZUSTAND_FOR_GLOBAL_STATE_MANAGEMENT = "Use zustand for global state management";
|
|
486
|
+
var AVOID_T_FUNCTIONS_IN_STRING_INTERPOLATION = "Translation function should not be used in string interpolation. Instead use a single translation key for the entire string. Refer: https://bit.ly/localization-best-practices";
|
|
487
|
+
var AVOID_MULTIPLE_T_FUNCTIONS_UNDER_SAME_PARENT = "Avoid using multiple translation functions under the same JSX parent. Instead use a single translation function with a single key. Refer: https://bit.ly/localization-best-practices";
|
|
488
|
+
var USE_TRANS_COMPONENTS_AND_VALUES_PROPS = "Instead of using numbered tags in translation string use `components` and `values` props of `Trans` to use named tag in translation string. Refer: https://bit.ly/localization-best-practices";
|
|
489
|
+
var USE_TRANSLATION_HOOK_IN_COMPONENTS = "Use translation function from `useTranslation()` hook in components.";
|
|
490
|
+
var USE_COMPONENTS_CHILDREN_PROP_IN_TRANS = "Use components children prop instead of label prop in `Trans` component to avoid multiple translation keys.";
|
|
491
|
+
var USE_I18NEXT_PLURALS = "Use plurals that comes with the `i18next` package for hard-coded strings. Refer: https://bit.ly/i18next-plurals";
|
|
492
|
+
var USE_PLURALIZE_PACKAGE = "Use `pluralize` package for dynamic values. Refer: https://bit.ly/i18next-plurals";
|
|
493
|
+
var USE_COPY_TO_CLIPBOARD_FROM_NEETO_COMMONS = "Use `copyToClipboard` from `@bigbinary/neeto-commons-frontend` package. Refer: https://bit.ly/copy-to-clipboard-utility-function";
|
|
494
|
+
var USE_ZUSTAND_PICK_TRANSFORMER = "Replace the boilerplate with zustand-pick syntax offered by babel-preset-neeto. Refer: https://bit.ly/zustand-pick-transform-doc";
|
|
495
|
+
var HARD_CODED_STRING_SHOULD_BE_LOCALIZED = "Hard-coded string should be localized";
|
|
496
|
+
var PROPS_NOT_SORTED = "Props inside spread attributes should be alphabetically sorted";
|
|
497
|
+
var MERGE_ADJACENT_SPREAD_ATTRIBUTES = "Merge spread attributes";
|
|
498
|
+
var DIFFERENT_PROPS_MUST_BE_OUTSIDE = "Props with different key and value should be outside the spread attribute";
|
|
499
|
+
var PROP_KEY_VALUE_DUPLICATE = "Prop key and value names should not be repeated";
|
|
500
|
+
var USE_WITH_IMMUTABLE_ACTIONS_WRAPPER = 'Use "withImmutableActions" wrapper from "neeto-commons-frontend" inside zustand create. Refer: https://bit.ly/withimmutableactions';
|
|
501
|
+
|
|
502
|
+
var PACKAGES_TO_CHECK = ["@bigbinary/neeto-molecules", "@bigbinary/neetoui", "@bigbinary/neeto-commons-frontend"];
|
|
503
|
+
|
|
504
|
+
// Checks if the passed package is present as a dependency
|
|
505
|
+
// { packageName: "version" }
|
|
506
|
+
var DependencyPattern = function DependencyPattern(packageName) {
|
|
507
|
+
return {
|
|
508
|
+
type: TYPES.PROPERTY,
|
|
509
|
+
key: {
|
|
510
|
+
type: TYPES.LITERAL,
|
|
511
|
+
value: packageName
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
var getIndentation = function getIndentation(node, context) {
|
|
517
|
+
var indentLevel = context.getSourceCode().getFirstToken(node).loc.start.column;
|
|
518
|
+
return " ".repeat(indentLevel);
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
var addRequiredPeerDependencies = {
|
|
522
|
+
meta: {
|
|
523
|
+
type: "problem",
|
|
524
|
+
docs: {
|
|
525
|
+
url: "https://github.com/bigbinary/eslint-plugin-neeto/blob/main/docs/src/rules/add-required-peer-dependencies.md",
|
|
526
|
+
description: "Ensures that dependencies like neetoui, neeto-molecules and neeto-commons-frontend are added in peerDependencies, if used."
|
|
527
|
+
},
|
|
528
|
+
fixable: "code"
|
|
529
|
+
},
|
|
530
|
+
create: function create(context) {
|
|
531
|
+
return {
|
|
532
|
+
Property: function Property(node) {
|
|
533
|
+
if (!context.getFilename().endsWith("package.json") || node.key.value !== "devDependencies") {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
PACKAGES_TO_CHECK.forEach(function (packageName) {
|
|
537
|
+
var dependencyPattern = DependencyPattern(packageName);
|
|
538
|
+
if (pure.findBy(dependencyPattern, node.value.properties)) {
|
|
539
|
+
var peerDependencies = pure.findBy({
|
|
540
|
+
key: {
|
|
541
|
+
value: "peerDependencies"
|
|
542
|
+
}
|
|
543
|
+
}, node.parent.properties);
|
|
544
|
+
var dependencyIndentLevel = getIndentation(node.value.properties[0], context);
|
|
545
|
+
if (peerDependencies) {
|
|
546
|
+
if (pure.findBy(dependencyPattern, peerDependencies.value.properties)) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
context.report({
|
|
550
|
+
node: peerDependencies,
|
|
551
|
+
message: addRequiredPeerDependencies$1(packageName),
|
|
552
|
+
fix: function fix(fixer) {
|
|
553
|
+
return fixer.insertTextAfter(ramda.last(peerDependencies.value.properties), ",\n".concat(dependencyIndentLevel, "\"").concat(packageName, "\": \"latest\""));
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
} else {
|
|
557
|
+
context.report({
|
|
558
|
+
node: node,
|
|
559
|
+
message: addRequiredPeerDependencies$1(packageName),
|
|
560
|
+
fix: function fix(fixer) {
|
|
561
|
+
var keyIndentLevel = getIndentation(node, context);
|
|
562
|
+
var fixString = ",\n".concat(keyIndentLevel, "\"peerDependencies\": {\n").concat(dependencyIndentLevel, "\"").concat(packageName, "\": \"latest\"\n").concat(keyIndentLevel, "}");
|
|
563
|
+
return fixer.insertTextAfter(node, fixString);
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
|
|
237
574
|
function _arrayWithHoles(arr) {
|
|
238
575
|
if (Array.isArray(arr)) return arr;
|
|
239
576
|
}
|
|
@@ -291,7 +628,7 @@
|
|
|
291
628
|
|
|
292
629
|
var regeneratorRuntime$1 = {exports: {}};
|
|
293
630
|
|
|
294
|
-
var _typeof
|
|
631
|
+
var _typeof = {exports: {}};
|
|
295
632
|
|
|
296
633
|
(function (module) {
|
|
297
634
|
function _typeof(obj) {
|
|
@@ -304,10 +641,10 @@
|
|
|
304
641
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
305
642
|
}
|
|
306
643
|
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
307
|
-
} (_typeof
|
|
644
|
+
} (_typeof));
|
|
308
645
|
|
|
309
646
|
(function (module) {
|
|
310
|
-
var _typeof = _typeof
|
|
647
|
+
var _typeof$1 = _typeof.exports["default"];
|
|
311
648
|
function _regeneratorRuntime() {
|
|
312
649
|
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
313
650
|
return exports;
|
|
@@ -384,7 +721,7 @@
|
|
|
384
721
|
if ("throw" !== record.type) {
|
|
385
722
|
var result = record.arg,
|
|
386
723
|
value = result.value;
|
|
387
|
-
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
724
|
+
return value && "object" == _typeof$1(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
388
725
|
invoke("next", value, resolve, reject);
|
|
389
726
|
}, function (err) {
|
|
390
727
|
invoke("throw", err, resolve, reject);
|
|
@@ -628,98 +965,6 @@
|
|
|
628
965
|
}
|
|
629
966
|
}
|
|
630
967
|
|
|
631
|
-
var APIS_DIRECTORY = "app/javascript/src/apis";
|
|
632
|
-
var REACT_QUERY_DIRECTORY = "app/javascript/src/hooks/reactQuery";
|
|
633
|
-
var ROUTES_FILE_PATH = "app/javascript/src/routes.js";
|
|
634
|
-
var COMPONENTS_DIRECTORY = "app/javascript/src/components";
|
|
635
|
-
var BLACKLISTED_PACKAGES = ["moment", "bootstrap", "blueprint", "react-spinners", "react-table", "remixicon", "mjml", "react-select", "@bigbinary/neeto-utils"];
|
|
636
|
-
var TYPES = {
|
|
637
|
-
ARRAY_EXPRESSION: "ArrayExpression",
|
|
638
|
-
ARROW_FUNCTION_EXPRESSION: "ArrowFunctionExpression",
|
|
639
|
-
ASSIGNMENT_EXPRESSION: "AssignmentExpression",
|
|
640
|
-
ASSIGNMENT_PATTERN: "AssignmentPattern",
|
|
641
|
-
AWAIT_EXPRESSION: "AwaitExpression",
|
|
642
|
-
BINARY_EXPRESSION: "BinaryExpression",
|
|
643
|
-
BLOCK_STATEMENT: "BlockStatement",
|
|
644
|
-
BREAK_STATEMENT: "BreakStatement",
|
|
645
|
-
CALL_EXPRESSION: "CallExpression",
|
|
646
|
-
CHAIN_EXPRESSION: "ChainExpression",
|
|
647
|
-
CONDITIONAL_EXPRESSION: "ConditionalExpression",
|
|
648
|
-
EXPORT_NAMED_DECLARATION: "ExportNamedDeclaration",
|
|
649
|
-
EXPORT_DEFAULT_DECLARATION: "ExportDefaultDeclaration",
|
|
650
|
-
EXPRESSION_STATEMENT: "ExpressionStatement",
|
|
651
|
-
FUNCTION_DECLARATION: "FunctionDeclaration",
|
|
652
|
-
FUNCTION_EXPRESSION: "FunctionExpression",
|
|
653
|
-
IDENTIFIER: "Identifier",
|
|
654
|
-
IF_STATEMENT: "IfStatement",
|
|
655
|
-
IMPORT_DECLARATION: "ImportDeclaration",
|
|
656
|
-
IMPORT_DEFAULT_SPECIFIER: "ImportDefaultSpecifier",
|
|
657
|
-
IMPORT_SPECIFIER: "ImportSpecifier",
|
|
658
|
-
JSX_ATTRIBUTE: "JSXAttribute",
|
|
659
|
-
JSX_ELEMENT: "JSXElement",
|
|
660
|
-
JSX_EXPRESSION_CONTAINER: "JSXExpressionContainer",
|
|
661
|
-
JSX_IDENTIFIER: "JSXIdentifier",
|
|
662
|
-
JSX_OPENING_ELEMENT: "JSXOpeningElement",
|
|
663
|
-
JSX_SPREAD_ATTRIBUTE: "JSXSpreadAttribute",
|
|
664
|
-
JSX_TEXT: "JSXText",
|
|
665
|
-
LITERAL: "Literal",
|
|
666
|
-
LOGICAL_EXPRESSION: "LogicalExpression",
|
|
667
|
-
MEMBER_EXPRESSION: "MemberExpression",
|
|
668
|
-
OBJECT_EXPRESSION: "ObjectExpression",
|
|
669
|
-
OBJECT_PATTERN: "ObjectPattern",
|
|
670
|
-
PROGRAM: "Program",
|
|
671
|
-
PROPERTY: "Property",
|
|
672
|
-
RETURN_STATEMENT: "ReturnStatement",
|
|
673
|
-
SPREAD_ELEMENT: "SpreadElement",
|
|
674
|
-
TEMPLATE_ELEMENT: "TemplateElement",
|
|
675
|
-
TEMPLATE_LITERAL: "TemplateLiteral",
|
|
676
|
-
UNARY_EXPRESSION: "UnaryExpression",
|
|
677
|
-
VARIABLE_DECLARATION: "VariableDeclaration",
|
|
678
|
-
VARIABLE_DECLARATOR: "VariableDeclarator",
|
|
679
|
-
WHILE_STATEMENT: "WhileStatement",
|
|
680
|
-
NEW_EXPRESSION: "NewExpression"
|
|
681
|
-
};
|
|
682
|
-
var IMPORT_DECLARATION = {
|
|
683
|
-
type: TYPES.IMPORT_DECLARATION,
|
|
684
|
-
source: {
|
|
685
|
-
type: TYPES.LITERAL
|
|
686
|
-
},
|
|
687
|
-
specifiers: [{
|
|
688
|
-
type: TYPES.IMPORT_SPECIFIER
|
|
689
|
-
}]
|
|
690
|
-
};
|
|
691
|
-
var CAMEL_CASE_REGEX = /^[a-z][A-Za-z0-9]*$/;
|
|
692
|
-
var CONSTANT_CASE_REGEX = /^[A-Z0-9_]+$/;
|
|
693
|
-
var PASCAL_CASE_REGEX = /^(?:[A-Z]+[a-z0-9]+[A-Z]*)+$/;
|
|
694
|
-
var SNAKE_CASE_REGEX = /^[a-z0-9_]+$/;
|
|
695
|
-
|
|
696
|
-
// const TestComponent = () => {}
|
|
697
|
-
var COMPONENT_PATTERN = {
|
|
698
|
-
type: TYPES.VARIABLE_DECLARATION,
|
|
699
|
-
kind: "const",
|
|
700
|
-
declarations: [{
|
|
701
|
-
type: TYPES.VARIABLE_DECLARATOR,
|
|
702
|
-
init: {
|
|
703
|
-
type: TYPES.ARROW_FUNCTION_EXPRESSION
|
|
704
|
-
},
|
|
705
|
-
id: {
|
|
706
|
-
type: TYPES.IDENTIFIER,
|
|
707
|
-
name: ramda.test(PASCAL_CASE_REGEX)
|
|
708
|
-
}
|
|
709
|
-
}]
|
|
710
|
-
};
|
|
711
|
-
var NO_OF_LINES_ALLOWED_FOR_MULTIPLE_COMPONENTS_IN_A_FILE = 20;
|
|
712
|
-
|
|
713
|
-
function _typeof(obj) {
|
|
714
|
-
"@babel/helpers - typeof";
|
|
715
|
-
|
|
716
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
717
|
-
return typeof obj;
|
|
718
|
-
} : function (obj) {
|
|
719
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
720
|
-
}, _typeof(obj);
|
|
721
|
-
}
|
|
722
|
-
|
|
723
968
|
/**
|
|
724
969
|
* Returns a list of nodes that matches the pattern
|
|
725
970
|
* somewhere deep inside the given object-tree by
|
|
@@ -731,7 +976,7 @@
|
|
|
731
976
|
*/
|
|
732
977
|
var findMatchingNodesDeep = function findMatchingNodesDeep(obj, pattern) {
|
|
733
978
|
var res = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
734
|
-
if (_typeof(obj) !== "object" || ramda.isNil(obj)) return res;
|
|
979
|
+
if (_typeof$1(obj) !== "object" || ramda.isNil(obj)) return res;
|
|
735
980
|
if (pure.matches(pattern, obj)) return ramda.append(obj, res);
|
|
736
981
|
return Object.entries(obj).reduce(function (acc, _ref) {
|
|
737
982
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
@@ -760,7 +1005,7 @@
|
|
|
760
1005
|
* @param {Object} obj the object tree to check
|
|
761
1006
|
*/
|
|
762
1007
|
var patternExistsDeep = /*#__PURE__*/ramda.curry(function (pattern, obj) {
|
|
763
|
-
if (_typeof(obj) !== "object" || ramda.isNil(obj)) return false;
|
|
1008
|
+
if (_typeof$1(obj) !== "object" || ramda.isNil(obj)) return false;
|
|
764
1009
|
if (pure.matches(pattern, obj)) return true;
|
|
765
1010
|
return Object.entries(obj).some(function (_ref3) {
|
|
766
1011
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
@@ -967,118 +1212,6 @@
|
|
|
967
1212
|
}
|
|
968
1213
|
};
|
|
969
1214
|
|
|
970
|
-
var ARGUMENT_LIMIT = 3;
|
|
971
|
-
var API_ACTIONS_ARGUMENT_LIMIT = 2;
|
|
972
|
-
var FIXABLE_PARAMETER_TYPES = [TYPES.IDENTIFIER, TYPES.ASSIGNMENT_PATTERN];
|
|
973
|
-
|
|
974
|
-
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
975
|
-
var addInJsconfig = function addInJsconfig(aliasName) {
|
|
976
|
-
return "Add path for \"".concat(aliasName, "\" in jsconfig.json. Refer https://bit.ly/sync-webpack-alias-and-jsconfig-paths for more details.");
|
|
977
|
-
};
|
|
978
|
-
var canBeReplacedWith = function canBeReplacedWith(fix) {
|
|
979
|
-
return "Can be replaced with: ".concat(fix);
|
|
980
|
-
};
|
|
981
|
-
var disallowUse = function disallowUse(packageName) {
|
|
982
|
-
return "Do not use the package ".concat(packageName);
|
|
983
|
-
};
|
|
984
|
-
var exportedObjectShouldBe = function exportedObjectShouldBe(caseStyle) {
|
|
985
|
-
return "Exported object should be in ".concat(caseStyle, ". Refer https://www.youtube.com/watch?v=As9BzWsGJfY");
|
|
986
|
-
};
|
|
987
|
-
var filenameShouldBe = function filenameShouldBe(caseStyle) {
|
|
988
|
-
return "Filename should be in ".concat(caseStyle, ". Refer https://www.youtube.com/watch?v=As9BzWsGJfY");
|
|
989
|
-
};
|
|
990
|
-
var moveToConstantsJs = function moveToConstantsJs(constantName) {
|
|
991
|
-
return "Move the constant ".concat(constantName, " to a constants.js file.");
|
|
992
|
-
};
|
|
993
|
-
var preferSubscriptionUnsubscribe = function preferSubscriptionUnsubscribe(replacerText) {
|
|
994
|
-
return "Prefer to use ".concat(replacerText, ".unsubscribe() to prevent consumer creation boilerplate.");
|
|
995
|
-
};
|
|
996
|
-
var renameFile = function renameFile(filename) {
|
|
997
|
-
return "Rename this file to ".concat(filename);
|
|
998
|
-
};
|
|
999
|
-
var replaceWith$1 = function replaceWith(fix) {
|
|
1000
|
-
return "Replace this with: ".concat(fix);
|
|
1001
|
-
};
|
|
1002
|
-
var unableToResolveKey = function unableToResolveKey(_ref) {
|
|
1003
|
-
var key = _ref.key,
|
|
1004
|
-
lng = _ref.lng;
|
|
1005
|
-
return "Unable to resolve localized string '".concat(key, "' in ").concat(lng, ".json");
|
|
1006
|
-
};
|
|
1007
|
-
var giveCamelCaseOrPascalCaseNameFor = function giveCamelCaseOrPascalCaseNameFor(functionName) {
|
|
1008
|
-
return "Use either camelCase or PascalCase for naming the function - ".concat(functionName, ".");
|
|
1009
|
-
};
|
|
1010
|
-
var replaceZustandDefaultExportWith = function replaceZustandDefaultExportWith(fix) {
|
|
1011
|
-
return "Zustand has deprecated the use of default exports for its functions. Replace this with: ".concat(fix);
|
|
1012
|
-
};
|
|
1013
|
-
var replaceTailwindClass = function replaceTailwindClass(tailwindClass, neetoUIClass) {
|
|
1014
|
-
return "Replace the class \"".concat(tailwindClass, "\" with its neetoui alternative \"").concat(neetoUIClass, "\"");
|
|
1015
|
-
};
|
|
1016
|
-
var noMultipleComponentsInAFile$1 = function noMultipleComponentsInAFile() {
|
|
1017
|
-
var maxAllowedNoOfLines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 20;
|
|
1018
|
-
return "Do not have multiple component definitions that exceed ".concat(maxAllowedNoOfLines, " lines in a single file.");
|
|
1019
|
-
};
|
|
1020
|
-
var suggestNeetoCommonsFunctionsAndHooks = function suggestNeetoCommonsFunctionsAndHooks(functionName, utilType, url) {
|
|
1021
|
-
return "Use \"".concat(functionName, "\" from \"@bigbinary/neeto-commons-frontend/").concat(utilType, "\" instead. Refer: ").concat(url);
|
|
1022
|
-
};
|
|
1023
|
-
var API_CONNECTOR_SHOULD_USE_DEFAULT_EXPORT_MESSAGE = "API Connector should be exported using the default export method";
|
|
1024
|
-
var CAN_BE_REPLACED_WITH_HANDLE_META_CLICK = "Can be replaced with handleMetaClick function. Refer https://bit.ly/handleMetaClick";
|
|
1025
|
-
var COMBINE_MULTIPLE_INDEPENDENT_AWAITS_MESSAGE = "Combine independent awaits to a single `Promise.all` call.";
|
|
1026
|
-
var EXPORTED_OBJECT_AND_FILENAME_SHOULD_MATCH_MESSAGE = "Exported object and filename should match.";
|
|
1027
|
-
var GLOBALPROPS_NO_ASSIGNMENT_MESSAGE = "globalProps should not be assigned to other variables";
|
|
1028
|
-
var NESTED_GLOBALPROPS_NO_ASSIGNMENT_MESSAGE = "Nested properties of globalProps should not be assigned to other variables";
|
|
1029
|
-
var NO_AXIOS_IMPORT_OUTSIDE_APIS_MESSAGE = "Do not use axios outside `app/javascript/src/apis`";
|
|
1030
|
-
var NO_CONDITIONAL_RENDER_OF_OVERLAYS = "Overlay components should not be rendered conditionally. Use `isOpen` attribute instead.";
|
|
1031
|
-
var NO_EXCESS_API_ACTION_ARGUMENTS_MESSAGE = "API actions should use named parameters for more than ".concat(API_ACTIONS_ARGUMENT_LIMIT, " parameters");
|
|
1032
|
-
var NO_EXCESS_FUNCTION_ARGUMENTS_MESSAGE = "Functions should use named parameters for more than ".concat(ARGUMENT_LIMIT, " parameters");
|
|
1033
|
-
var NO_GLOBALPROPS_REASSIGNMENT_MESSAGE = "globalProps or its nested properties should not be re-assigned.";
|
|
1034
|
-
var NO_ROUTES_ASSIGNMENT = "`routes` or its nested properties should not be assigned to other variables.";
|
|
1035
|
-
var NO_ROUTES_REASSIGNMENT = "`routes` or its nested properties should not be re-assigned.";
|
|
1036
|
-
var NO_NAMESPACE_SPECIFIER_IMPORT_FOR_RAMDA_MESSAGE = 'Use `import { methodsToImport } from "ramda"` instead';
|
|
1037
|
-
var PREFER_EAGER_VALIDATION_MESSAGE = "Prefer to use Formik defaults for `validateOnBlur` and `validateOnChange` to ensure eager validation. Refer https://bit.ly/formik-eager-validation";
|
|
1038
|
-
var PREFIX_NEETO_UI_IMPORT_ALIAS_MESSAGE = "Aliases for anything imported from neetoUI or neetoIcons should start with `NeetoUI`";
|
|
1039
|
-
var REPLACE_WITH_HANDLE_META_CLICK = "Replace with handleMetaClick function";
|
|
1040
|
-
var ROUTE_SHOULD_BE_A_STRING = "Route should be a plain string literal.";
|
|
1041
|
-
var ROUTE_SHOULD_MATCH_OBJECT_PATH = "Route string should match with its object path.";
|
|
1042
|
-
var ROUTES_HAS_ALREADY_BEEN_DECLARED = "Identifier `routes` has already been declared";
|
|
1043
|
-
var ROUTES_CONSTANT_SHOULD_BE_DECLARED = "A constant object named `routes` should be declared inside routes.js";
|
|
1044
|
-
var ROUTES_SHOULD_USE_DEFAULT_EXPORT = "`routes` should be exported using the default export method.";
|
|
1045
|
-
var UNNECESSARY_CREATE_CONSUMER = "`createSubscription` function from `neetocommon/utils` invalidates the need of `createConsumer`";
|
|
1046
|
-
var USE_ARRAY_METHODS = "Use array methods (forEach, map, filter, reduce, etc) instead of 'for' loop. Refer 'Advanced Array Methods' section in https://bit.ly/array-methods-page-1";
|
|
1047
|
-
var USE_AXIOS_CONFIG_FOR_PASSING_QUERY_PARAMETERS_MESSAGE = "Use 'params attribute in axios configuration' to pass query parameters.";
|
|
1048
|
-
var USE_CREATE_SUBSCRIPTION_FROM_NEETO_COMMONS = "Use `createSubscription` from @bigbinary/neeto-commons-frontend/utils instead. Refer: https://github.com/bigbinary/neeto-commons-frontend/blob/main/docs/utils/README.md#createsubscription";
|
|
1049
|
-
var USE_INLINE_SVG_FOR_RENDER = "Use inline SVG instead of img tag for rendering SVGs";
|
|
1050
|
-
var USE_LINK_FOR_NAVIGATION = "Use Link or NavLink component from 'react-router-dom' for click-navigation instead of onClick handler";
|
|
1051
|
-
var USE_ANCHOR_FOR_NAVIGATION = "Use Anchor element (<a>) for click-navigation instead of onClick handler";
|
|
1052
|
-
var USE_BUTTON_TO_FOR_LINK_NAVIGATION = "Use `to` prop of Button (<Button to='path'>) for click-navigation instead of onClick handler";
|
|
1053
|
-
var USE_BUTTON_TO_FOR_ANCHOR_NAVIGATION = "Use `href` prop of Button (<Button href='path'>) for click-navigation instead of onClick handler";
|
|
1054
|
-
var USE_NEETO_SMALLER_CASE = "Use 'neeto' instead of 'Neeto' in strings";
|
|
1055
|
-
var USE_NEETOUI_BORDER_COLOR = "Use neetoUI border color. Refer https://bit.ly/neeto-ui-border-colors for more details.";
|
|
1056
|
-
var USE_NEETOUI_BORDER_RADIUS = "Use neetoUI border radius. Refer https://bit.ly/neeto-ui-border-radius for more details.";
|
|
1057
|
-
var USE_NEETOUI_BOX_SHADOW = "Use neetoUI border shadow. Refer https://bit.ly/neeto-ui-box-shadows for more details.";
|
|
1058
|
-
var USE_NEETOUI_TEXT_COLOR = "Use neetoUI text color. Refer https://bit.ly/neeto-ui-text-color for more details.";
|
|
1059
|
-
var DONT_USE_ZUSTAND_STORE_WITHOUT_SELECTOR = "Don't use zustand store hook without a selector function. It will impact the performance";
|
|
1060
|
-
var DONT_USE_ZUSTAND_STORE_WITHOUT_COMPARATOR_FUNCTION = "Don't pick multiple zustand state items without comparator function";
|
|
1061
|
-
var USE_PROP_FOR_PICKING_SINGLE_ITEM = "Use prop instead of pick when picking single item";
|
|
1062
|
-
var ENSURE_ZUSTAND_STORES_ARE_TYPE_ANNOTATED = "\n Zustand stores should be type annotated like this:\n /** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\n const useUserStore = create(...)\n";
|
|
1063
|
-
var USE_REACT_QUERY_FOR_MANAGING_REMOTE_DATA = "API calls should be managed using React Query";
|
|
1064
|
-
var FILES_INSIDE_REACT_QUERY_FOLDER_SHOULD_END_WITH_API = "Files inside reactQuery folder should end with Api";
|
|
1065
|
-
var USE_ZUSTAND_FOR_GLOBAL_STATE_MANAGEMENT = "Use zustand for global state management";
|
|
1066
|
-
var AVOID_T_FUNCTIONS_IN_STRING_INTERPOLATION = "Translation function should not be used in string interpolation. Instead use a single translation key for the entire string. Refer: https://bit.ly/localization-best-practices";
|
|
1067
|
-
var AVOID_MULTIPLE_T_FUNCTIONS_UNDER_SAME_PARENT = "Avoid using multiple translation functions under the same JSX parent. Instead use a single translation function with a single key. Refer: https://bit.ly/localization-best-practices";
|
|
1068
|
-
var USE_TRANS_COMPONENTS_AND_VALUES_PROPS = "Instead of using numbered tags in translation string use `components` and `values` props of `Trans` to use named tag in translation string. Refer: https://bit.ly/localization-best-practices";
|
|
1069
|
-
var USE_TRANSLATION_HOOK_IN_COMPONENTS = "Use translation function from `useTranslation()` hook in components.";
|
|
1070
|
-
var USE_COMPONENTS_CHILDREN_PROP_IN_TRANS = "Use components children prop instead of label prop in `Trans` component to avoid multiple translation keys.";
|
|
1071
|
-
var USE_I18NEXT_PLURALS = "Use plurals that comes with the `i18next` package for hard-coded strings. Refer: https://bit.ly/i18next-plurals";
|
|
1072
|
-
var USE_PLURALIZE_PACKAGE = "Use `pluralize` package for dynamic values. Refer: https://bit.ly/i18next-plurals";
|
|
1073
|
-
var USE_COPY_TO_CLIPBOARD_FROM_NEETO_COMMONS = "Use `copyToClipboard` from `@bigbinary/neeto-commons-frontend` package. Refer: https://bit.ly/copy-to-clipboard-utility-function";
|
|
1074
|
-
var USE_ZUSTAND_PICK_TRANSFORMER = "Replace the boilerplate with zustand-pick syntax offered by babel-preset-neeto. Refer: https://bit.ly/zustand-pick-transform-doc";
|
|
1075
|
-
var HARD_CODED_STRING_SHOULD_BE_LOCALIZED = "Hard-coded string should be localized";
|
|
1076
|
-
var PROPS_NOT_SORTED = "Props inside spread attributes should be alphabetically sorted";
|
|
1077
|
-
var MERGE_ADJACENT_SPREAD_ATTRIBUTES = "Merge spread attributes";
|
|
1078
|
-
var DIFFERENT_PROPS_MUST_BE_OUTSIDE = "Props with different key and value should be outside the spread attribute";
|
|
1079
|
-
var PROP_KEY_VALUE_DUPLICATE = "Prop key and value names should not be repeated";
|
|
1080
|
-
var USE_WITH_IMMUTABLE_ACTIONS_WRAPPER = 'Use "withImmutableActions" wrapper from "neeto-commons-frontend" inside zustand create. Refer: https://bit.ly/withimmutableactions';
|
|
1081
|
-
|
|
1082
1215
|
var toCamelCase = function toCamelCase(text) {
|
|
1083
1216
|
var capitalized = text.split(/[^0-9a-z]/i).map(function (part) {
|
|
1084
1217
|
return "".concat(part[0].toUpperCase()).concat(part.slice(1));
|
|
@@ -1144,37 +1277,6 @@
|
|
|
1144
1277
|
}
|
|
1145
1278
|
};
|
|
1146
1279
|
|
|
1147
|
-
function _toPrimitive(input, hint) {
|
|
1148
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
1149
|
-
var prim = input[Symbol.toPrimitive];
|
|
1150
|
-
if (prim !== undefined) {
|
|
1151
|
-
var res = prim.call(input, hint || "default");
|
|
1152
|
-
if (_typeof(res) !== "object") return res;
|
|
1153
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1154
|
-
}
|
|
1155
|
-
return (hint === "string" ? String : Number)(input);
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
function _toPropertyKey(arg) {
|
|
1159
|
-
var key = _toPrimitive(arg, "string");
|
|
1160
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
|
-
function _defineProperty(obj, key, value) {
|
|
1164
|
-
key = _toPropertyKey(key);
|
|
1165
|
-
if (key in obj) {
|
|
1166
|
-
Object.defineProperty(obj, key, {
|
|
1167
|
-
value: value,
|
|
1168
|
-
enumerable: true,
|
|
1169
|
-
configurable: true,
|
|
1170
|
-
writable: true
|
|
1171
|
-
});
|
|
1172
|
-
} else {
|
|
1173
|
-
obj[key] = value;
|
|
1174
|
-
}
|
|
1175
|
-
return obj;
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
1280
|
var AWAIT_DECLARATION_PATTERN = {
|
|
1179
1281
|
type: TYPES.VARIABLE_DECLARATOR,
|
|
1180
1282
|
init: {
|
|
@@ -5859,7 +5961,7 @@
|
|
|
5859
5961
|
|
|
5860
5962
|
var findAllRamdaUsage = function findAllRamdaUsage(node, identifierName) {
|
|
5861
5963
|
var acc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
5862
|
-
if (!node || _typeof(node) !== "object") return acc;
|
|
5964
|
+
if (!node || _typeof$1(node) !== "object") return acc;
|
|
5863
5965
|
return Object.entries(node).reduce(function (acc, _ref) {
|
|
5864
5966
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
5865
5967
|
key = _ref2[0],
|
|
@@ -26148,12 +26250,16 @@
|
|
|
26148
26250
|
"no-repetition-in-prop-key-value-names": noRepetitionInPropKeyAndValueName,
|
|
26149
26251
|
"use-functions-and-hooks-from-neeto-commons-frontend": useFunctionsAndHooksFromNeetoCommonsFrontend,
|
|
26150
26252
|
"no-unnecessary-if-condition": noUnnecessaryIfCondition,
|
|
26151
|
-
"zustand-use-with-immutable-actions-wrapper-inside-create": useWithImmutableActionsWrapperInsideCreate
|
|
26253
|
+
"zustand-use-with-immutable-actions-wrapper-inside-create": useWithImmutableActionsWrapperInsideCreate,
|
|
26254
|
+
"add-required-peer-dependencies": addRequiredPeerDependencies
|
|
26152
26255
|
},
|
|
26153
26256
|
configs: {
|
|
26154
26257
|
recommended: recommended,
|
|
26155
26258
|
"nextjs-recommended": nextjsRecommended,
|
|
26156
26259
|
"nanos-recommended": nanosRecommended
|
|
26260
|
+
},
|
|
26261
|
+
processors: {
|
|
26262
|
+
".json": jsonProcessor
|
|
26157
26263
|
}
|
|
26158
26264
|
};
|
|
26159
26265
|
|