@devtron-labs/devtron-fe-common-lib 0.0.52 → 0.0.53

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/.eslintignore ADDED
@@ -0,0 +1,96 @@
1
+ .eslintrc.js
2
+
3
+ # Files with ESLint errors/warnings
4
+ src/Common/AddCDButton/AddCDButton.tsx
5
+ src/Common/AddCDButton/utils.tsx
6
+ src/Common/Api.ts
7
+ src/Common/AppStatus/AppStatus.tsx
8
+ src/Common/AppStatus/index.ts
9
+ src/Common/AppStatus/utils.ts
10
+ src/Common/BreadCrumb/BreadCrumb.tsx
11
+ src/Common/BreadCrumb/BreadcrumbStore.tsx
12
+ src/Common/BreadCrumb/Types.ts
13
+ src/Common/CIPipeline.Types.ts
14
+ src/Common/ChartVersionAndTypeSelector.tsx
15
+ src/Common/Checkbox.tsx
16
+ src/Common/ClipboardButton/ClipboardButton.tsx
17
+ src/Common/ClipboardButton/__tests__/ClipboardButton.test.tsx
18
+ src/Common/Common.service.ts
19
+ src/Common/Constants.ts
20
+ src/Common/CustomInput/CustomInput.tsx
21
+ src/Common/CustomInput/Types.ts
22
+ src/Common/CustomInput/index.ts
23
+ src/Common/CustomTagSelector/PropagateTagInfo.tsx
24
+ src/Common/CustomTagSelector/ResizableTagTextArea.tsx
25
+ src/Common/CustomTagSelector/TagDetails.tsx
26
+ src/Common/CustomTagSelector/TagLabelSelect.tsx
27
+ src/Common/CustomTagSelector/TagLabelValueSelector.tsx
28
+ src/Common/CustomTagSelector/TagSelector.utils.ts
29
+ src/Common/CustomTagSelector/Types.ts
30
+ src/Common/CustomTagSelector/ValidationRules.ts
31
+ src/Common/CustomTagSelector/index.ts
32
+ src/Common/DebouncedSearch/DebouncedSearch.tsx
33
+ src/Common/DebouncedSearch/Utils.ts
34
+ src/Common/DebouncedSearch/__tests__/DebouncedSearch.test.tsx
35
+ src/Common/DeleteComponentModal/DeleteComponent.tsx
36
+ src/Common/DeleteComponentModal/types.ts
37
+ src/Common/DevtronProgressing/DevtronProgressing.tsx
38
+ src/Common/Dialogs/ConfirmationDialog.tsx
39
+ src/Common/Dialogs/DeleteDialog.tsx
40
+ src/Common/Dialogs/DialogForm.tsx
41
+ src/Common/Dialogs/ForceDeleteDialog.tsx
42
+ src/Common/Dialogs/Types.ts
43
+ src/Common/Dialogs/index.ts
44
+ src/Common/DraggableWrapper/DraggableButton.tsx
45
+ src/Common/DraggableWrapper/DraggableWrapper.tsx
46
+ src/Common/Drawer/Drawer.tsx
47
+ src/Common/EmptyState/EmptyState.tsx
48
+ src/Common/EmptyState/GenericEmptyState.tsx
49
+ src/Common/Error.tsx
50
+ src/Common/ErrorScreenNotFound.tsx
51
+ src/Common/Grid/Grid.tsx
52
+ src/Common/Helper.tsx
53
+ src/Common/Hooks/UseClickOutside/UseClickOutside.tsx
54
+ src/Common/Hooks/UseSuperAdmin/UseSuperAdmin.tsx
55
+ src/Common/Hooks/UseWindowSize/UseWindowSize.tsx
56
+ src/Common/ImageTags.Types.ts
57
+ src/Common/ImageTags.tsx
58
+ src/Common/InfoColorBar/InfoColourbar.tsx
59
+ src/Common/Modals/Modal.tsx
60
+ src/Common/Modals/OpaqueModal.tsx
61
+ src/Common/Modals/VisibleModal.tsx
62
+ src/Common/Modals/VisibleModal2.tsx
63
+ src/Common/MultiSelectCustomization.tsx
64
+ src/Common/Policy.Types.ts
65
+ src/Common/PopupMenu.tsx
66
+ src/Common/Progressing.tsx
67
+ src/Common/RJSF/Form.tsx
68
+ src/Common/RJSF/common/FieldRow.tsx
69
+ src/Common/RJSF/config.ts
70
+ src/Common/RJSF/templates/ArrayFieldItemTemplate.tsx
71
+ src/Common/RJSF/templates/ArrayFieldTemplate.tsx
72
+ src/Common/RJSF/templates/BaseInput.tsx
73
+ src/Common/RJSF/templates/ButtonTemplates/AddButton.tsx
74
+ src/Common/RJSF/templates/ButtonTemplates/RemoveButton.tsx
75
+ src/Common/RJSF/templates/ButtonTemplates/SubmitButton.tsx
76
+ src/Common/RJSF/templates/Description.tsx
77
+ src/Common/RJSF/templates/Field.tsx
78
+ src/Common/RJSF/templates/FieldErrorTemplate.tsx
79
+ src/Common/RJSF/templates/ObjectFieldTemplate.tsx
80
+ src/Common/RJSF/templates/TitleField.tsx
81
+ src/Common/RJSF/templates/WrapIfAdditionalTemplate.tsx
82
+ src/Common/RJSF/utils.ts
83
+ src/Common/RJSF/widgets/Checkbox.tsx
84
+ src/Common/RJSF/widgets/Select.tsx
85
+ src/Common/RadioGroup.tsx
86
+ src/Common/RadioGroup/RadioGroup.tsx
87
+ src/Common/Reload.tsx
88
+ src/Common/ResizableTextarea.tsx
89
+ src/Common/Security/ScanVulnerabilitiesTable.tsx
90
+ src/Common/ServerError.ts
91
+ src/Common/TippyCustomized.tsx
92
+ src/Common/ToastBody.tsx
93
+ src/Common/Toggle/Toggle.tsx
94
+ src/Common/Types.ts
95
+ src/custom.d.ts
96
+ src/index.ts
package/.eslintrc.js CHANGED
@@ -1,41 +1,109 @@
1
1
  module.exports = {
2
2
  parser: '@typescript-eslint/parser',
3
- plugins: ['@typescript-eslint'],
3
+ plugins: ['@typescript-eslint', 'react', 'prettier'],
4
4
  env: {
5
- commonjs: true,
6
5
  browser: true,
7
- es6: true,
6
+ es2021: true,
8
7
  },
9
8
  parserOptions: {
10
- ecmaVersion: 2018,
9
+ ecmaVersion: 2021,
11
10
  sourceType: 'module',
12
11
  ecmaFeatures: {
13
12
  jsx: true,
14
13
  },
15
14
  project: ['./tsconfig.json'],
16
15
  },
16
+ globals: {
17
+ JSX: true,
18
+ },
19
+ extends: [
20
+ 'eslint:recommended',
21
+ 'plugin:react/recommended',
22
+ 'plugin:react/jsx-runtime',
23
+ 'plugin:@typescript-eslint/eslint-recommended',
24
+ 'airbnb',
25
+ 'airbnb/hooks',
26
+ 'prettier',
27
+ ],
17
28
  rules: {
29
+ 'prettier/prettier': ['error'],
30
+ 'linebreak-style': ['error', 'unix'],
31
+ 'no-console': 'warn',
18
32
  'no-var': 'error',
19
33
  'no-duplicate-imports': 'error',
34
+ 'no-shadow': 'off',
35
+ '@typescript-eslint/no-shadow': 'warn',
20
36
  '@typescript-eslint/explicit-function-return-type': 'off',
21
- '@typescript-eslint/no-explicit-any': 'off',
22
- '@typescript-eslint/no-use-before-define': 'off',
23
37
  '@typescript-eslint/explicit-member-accessibility': 'off',
24
- curly: [2, 'all'],
25
- 'keyword-spacing': 'error',
26
- 'prettier/prettier': ['error', { semi: false }],
38
+ // Since we are using typescript, we can disable the no-unused-vars rule for enum,etc
39
+ 'no-unused-vars': 'off',
40
+ '@typescript-eslint/no-unused-vars': 'error',
41
+ 'react/jsx-filename-extension': [
42
+ 'error',
43
+ {
44
+ extensions: ['tsx'],
45
+ },
46
+ ],
47
+ 'react/jsx-props-no-spreading': 'off',
48
+ 'react/prefer-stateless-function': 'off',
49
+ 'jsx-a11y/click-events-have-key-events': 'off',
50
+ 'jsx-a11y/no-static-element-interactions': 'off',
51
+ 'jsx-a11y/no-noninteractive-element-interactions': 'off',
52
+ 'no-underscore-dangle': 'off',
53
+ 'import/no-extraneous-dependencies': [
54
+ 'warn',
55
+ {
56
+ devDependencies: true,
57
+ },
58
+ ],
59
+ 'no-plusplus': [
60
+ 'error',
61
+ {
62
+ allowForLoopAfterthoughts: true,
63
+ },
64
+ ],
65
+ // Since we dont use prop-types, we can disable this rule
66
+ 'react/require-default-props': 'off',
67
+ 'react-hooks/exhaustive-deps': 'off',
68
+ 'react/function-component-definition': [
69
+ 'warn',
70
+ {
71
+ namedComponents: 'arrow-function',
72
+ unnamedComponents: 'arrow-function',
73
+ },
74
+ ],
75
+ 'react/jsx-uses-react': 'off',
76
+ 'react/react-in-jsx-scope': 'off',
77
+ // additional rules:
78
+ '@typescript-eslint/no-floating-promises': 'error',
79
+ 'import/extensions': [
80
+ 'warn',
81
+ 'ignorePackages',
82
+ {
83
+ js: 'never',
84
+ jsx: 'never',
85
+ ts: 'never',
86
+ tsx: 'never',
87
+ },
88
+ ],
27
89
  },
28
- extends: [
29
- 'eslint:recommended',
30
- 'plugin:@typescript-eslint/eslint-recommended',
31
- 'plugin:@typescript-eslint/recommended',
32
- 'prettier/@typescript-eslint',
33
- 'plugin:prettier/recommended',
34
- 'plugin:react/recommended',
90
+ overrides: [
91
+ {
92
+ files: ['*.ts', '*.tsx'],
93
+ rules: {
94
+ 'no-undef': 'off',
95
+ },
96
+ },
35
97
  ],
36
98
  settings: {
37
99
  react: {
38
100
  version: 'detect',
39
101
  },
102
+ 'import/resolver': {
103
+ node: {
104
+ moduleDirectory: ['src', 'node_modules'],
105
+ extensions: ['.js', '.jsx', '.ts', '.tsx'],
106
+ },
107
+ },
40
108
  },
41
109
  }
@@ -0,0 +1,25 @@
1
+ # Description
2
+
3
+ Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
4
+
5
+ ## Type of change
6
+
7
+ - [ ] Bug fix (non-breaking change which fixes an issue)
8
+ - [ ] New feature (non-breaking change which adds functionality)
9
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
10
+ - [ ] This change requires a documentation update
11
+
12
+ ## How Has This Been Tested?
13
+
14
+ Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
15
+
16
+ - [ ] Test A
17
+ - [ ] Test B
18
+
19
+ ## Checklist
20
+
21
+ - [ ] The title of the PR states what changed and the related issues number (used for the release note).
22
+ - [ ] Does this PR require documentation updates?
23
+ - [ ] I've updated documentation as required by this PR.
24
+ - [ ] I have performed a self-review of my own code
25
+ - [ ] I have commented my code, particularly in hard-to-understand areas
@@ -0,0 +1,31 @@
1
+ name: Common Lib CI
2
+
3
+ on:
4
+ pull_request:
5
+ types:
6
+ - opened
7
+ - synchronize
8
+ - edited
9
+ - reopened
10
+
11
+ jobs:
12
+ ci:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout repository
16
+ uses: actions/checkout@v3
17
+
18
+ - name: Use Node.js
19
+ uses: actions/setup-node@v3
20
+ with:
21
+ node-version-file: '.nvmrc'
22
+ cache: 'npm'
23
+
24
+ - name: Install dependencies
25
+ run: npm ci
26
+
27
+ - name: Check linting issues
28
+ run: npm run lint
29
+
30
+ - name: Build Lib
31
+ run: npm run build-lib
@@ -11,7 +11,7 @@ jobs:
11
11
  - uses: actions/checkout@v3
12
12
  - uses: actions/setup-node@v3
13
13
  with:
14
- node-version: 16
14
+ node-version-file: '.nvmrc'
15
15
  - run: npm ci
16
16
  - run: npm test
17
17
 
@@ -25,7 +25,7 @@ jobs:
25
25
  - uses: actions/checkout@v3
26
26
  - uses: actions/setup-node@v3
27
27
  with:
28
- node-version: 16
28
+ node-version-file: '.nvmrc'
29
29
  registry-url: https://npm.pkg.github.com/
30
30
  - run: npm ci
31
31
  - run: npm run build-lib
@@ -46,4 +46,3 @@ jobs:
46
46
  - run: npm publish --access public
47
47
  env:
48
48
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49
-
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npx tsc --noEmit
5
+ npm run lint-staged
package/.lintstagedrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "*.{js,jsx,ts,tsx}": ["npx eslint"]
3
+ }
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v16.13.0
package/dist/index.js CHANGED
@@ -274,7 +274,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
274
274
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
275
275
  PERFORMANCE OF THIS SOFTWARE.
276
276
  ***************************************************************************** */
277
- /* global Reflect, Promise */
277
+ /* global Reflect, Promise, SuppressedError, Symbol */
278
278
 
279
279
  var extendStatics = function(d, b) {
280
280
  extendStatics = Object.setPrototypeOf ||
@@ -377,7 +377,12 @@ function __spreadArray(to, from, pack) {
377
377
  }
378
378
  }
379
379
  return to.concat(ar || Array.prototype.slice.call(from));
380
- }
380
+ }
381
+
382
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
383
+ var e = new Error(message);
384
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
385
+ };
381
386
 
382
387
  var ServerError = /** @class */ (function () {
383
388
  function ServerError(error) {
@@ -19608,14 +19613,14 @@ function _objectWithoutProperties(source, excluded) {
19608
19613
  return target;
19609
19614
  }
19610
19615
 
19611
- function _typeof(obj) {
19616
+ function _typeof(o) {
19612
19617
  "@babel/helpers - typeof";
19613
19618
 
19614
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
19615
- return typeof obj;
19616
- } : function (obj) {
19617
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
19618
- }, _typeof(obj);
19619
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
19620
+ return typeof o;
19621
+ } : function (o) {
19622
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
19623
+ }, _typeof(o);
19619
19624
  }
19620
19625
 
19621
19626
  function _classCallCheck(instance, Constructor) {
@@ -19624,20 +19629,20 @@ function _classCallCheck(instance, Constructor) {
19624
19629
  }
19625
19630
  }
19626
19631
 
19627
- function _toPrimitive(input, hint) {
19628
- if (_typeof(input) !== "object" || input === null) return input;
19629
- var prim = input[Symbol.toPrimitive];
19630
- if (prim !== undefined) {
19631
- var res = prim.call(input, hint || "default");
19632
- if (_typeof(res) !== "object") return res;
19632
+ function toPrimitive(t, r) {
19633
+ if ("object" != _typeof(t) || !t) return t;
19634
+ var e = t[Symbol.toPrimitive];
19635
+ if (void 0 !== e) {
19636
+ var i = e.call(t, r || "default");
19637
+ if ("object" != _typeof(i)) return i;
19633
19638
  throw new TypeError("@@toPrimitive must return a primitive value.");
19634
19639
  }
19635
- return (hint === "string" ? String : Number)(input);
19640
+ return ("string" === r ? String : Number)(t);
19636
19641
  }
19637
19642
 
19638
- function _toPropertyKey(arg) {
19639
- var key = _toPrimitive(arg, "string");
19640
- return _typeof(key) === "symbol" ? key : String(key);
19643
+ function toPropertyKey(t) {
19644
+ var i = toPrimitive(t, "string");
19645
+ return "symbol" == _typeof(i) ? i : String(i);
19641
19646
  }
19642
19647
 
19643
19648
  function _defineProperties(target, props) {
@@ -19646,7 +19651,7 @@ function _defineProperties(target, props) {
19646
19651
  descriptor.enumerable = descriptor.enumerable || false;
19647
19652
  descriptor.configurable = true;
19648
19653
  if ("value" in descriptor) descriptor.writable = true;
19649
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
19654
+ Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
19650
19655
  }
19651
19656
  }
19652
19657
  function _createClass(Constructor, protoProps, staticProps) {
@@ -19684,7 +19689,7 @@ function _inherits(subClass, superClass) {
19684
19689
  }
19685
19690
 
19686
19691
  function _defineProperty$1(obj, key, value) {
19687
- key = _toPropertyKey(key);
19692
+ key = toPropertyKey(key);
19688
19693
  if (key in obj) {
19689
19694
  Object.defineProperty(obj, key, {
19690
19695
  value: value,
@@ -21242,31 +21247,31 @@ function _arrayWithHoles(arr) {
21242
21247
  if (Array.isArray(arr)) return arr;
21243
21248
  }
21244
21249
 
21245
- function _iterableToArrayLimit(arr, i) {
21246
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
21247
- if (null != _i) {
21248
- var _s,
21249
- _e,
21250
- _x,
21251
- _r,
21252
- _arr = [],
21253
- _n = !0,
21254
- _d = !1;
21250
+ function _iterableToArrayLimit(r, l) {
21251
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
21252
+ if (null != t) {
21253
+ var e,
21254
+ n,
21255
+ i,
21256
+ u,
21257
+ a = [],
21258
+ f = !0,
21259
+ o = !1;
21255
21260
  try {
21256
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
21257
- if (Object(_i) !== _i) return;
21258
- _n = !1;
21259
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
21260
- } catch (err) {
21261
- _d = !0, _e = err;
21261
+ if (i = (t = t.call(r)).next, 0 === l) {
21262
+ if (Object(t) !== t) return;
21263
+ f = !1;
21264
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
21265
+ } catch (r) {
21266
+ o = !0, n = r;
21262
21267
  } finally {
21263
21268
  try {
21264
- if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
21269
+ if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
21265
21270
  } finally {
21266
- if (_d) throw _e;
21271
+ if (o) throw n;
21267
21272
  }
21268
21273
  }
21269
- return _arr;
21274
+ return a;
21270
21275
  }
21271
21276
  }
21272
21277
 
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
+ "prepare": "node -e \"try { require('husky').install() } catch (e) {}\"",
8
+ "lint": "tsc --noEmit && eslint 'src/**/*.{js,jsx,ts,tsx}' --max-warnings 0",
9
+ "lint-fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix",
7
10
  "test": "exit 0",
8
11
  "build-lib": "rollup -c --bundleConfigAsCjs",
9
- "build-watch": "rollup -c --bundleConfigAsCjs -w"
12
+ "build-watch": "rollup -c --bundleConfigAsCjs -w",
13
+ "lint-staged": "lint-staged"
10
14
  },
11
15
  "repository": {
12
16
  "type": "git",
@@ -30,7 +34,20 @@
30
34
  "@types/react": "17.0.39",
31
35
  "@types/react-dom": "17.0.13",
32
36
  "@types/react-router-dom": "^5.3.3",
37
+ "@typescript-eslint/eslint-plugin": "^6.17.0",
38
+ "@typescript-eslint/parser": "^6.17.0",
39
+ "eslint": "^8.56.0",
40
+ "eslint-config-airbnb": "^19.0.4",
41
+ "eslint-config-prettier": "^9.1.0",
42
+ "eslint-plugin-import": "^2.29.1",
43
+ "eslint-plugin-jsx-a11y": "^6.8.0",
44
+ "eslint-plugin-prettier": "^5.1.2",
45
+ "eslint-plugin-react": "^7.33.2",
46
+ "eslint-plugin-react-hooks": "^4.6.0",
47
+ "husky": "^7.0.4",
48
+ "lint-staged": "^12.5.0",
33
49
  "moment": "^2.29.4",
50
+ "prettier": "^3.1.1",
34
51
  "react-select": "5.2.2",
35
52
  "react-toastify": "^8.2.0",
36
53
  "rollup": "^3.10.0",