@zohodesk/codestandard-validator 0.0.2-exp-5 → 0.0.3

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.
@@ -1,21 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  /* eslint-disable no-console */
4
- const {
5
- execSync
6
- } = require('child_process');
7
- const {
8
- readdirSync
9
- } = require('fs');
10
- const path = require('path');
11
4
  const initializeHusky = require('./initializeHusky');
12
5
  const configurePrecommitHook = require('./configurePrecommitHook');
13
- const {
14
- getNodeModulesPath
15
- } = require('../General/getNodeModulesPath');
16
- const {
17
- executeSynchronizedCommands
18
- } = require('../General/executeSyncCommands');
19
6
  const {
20
7
  Logger
21
8
  } = require('../Logger/Logger');
@@ -26,51 +13,21 @@ let isCustomPrecommitConfigurationSuccessful = false;
26
13
  * @returns {boolean} - indicating whether entire custom precommit hook setup using husky process is success or failure
27
14
  */
28
15
  function setupHusky() {
29
- let isHuskyPackageInstalled = true; //installHuskyPackage()
30
- if (isHuskyPackageInstalled) {
31
- let isHuskyInitializedSuccessfully = initializeHusky();
32
- if (isHuskyInitializedSuccessfully) {
33
- Logger.log(Logger.SUCCESS_TYPE, 'Husky installation successful');
34
- isCustomPrecommitConfigurationSuccessful = configurePrecommitHook();
35
- if (isCustomPrecommitConfigurationSuccessful) {
36
- Logger.log(Logger.SUCCESS_TYPE, 'Custom pre commit hook setup was successful');
37
- return true;
38
- } else {
39
- Logger.log(Logger.FAILURE_TYPE, 'Couldn\'t configure custom pre commit hook');
40
- return false;
41
- }
16
+ let isHuskyInitializedSuccessfully = initializeHusky();
17
+ if (isHuskyInitializedSuccessfully) {
18
+ Logger.log(Logger.SUCCESS_TYPE, 'Husky installation successful');
19
+ isCustomPrecommitConfigurationSuccessful = configurePrecommitHook();
20
+ if (isCustomPrecommitConfigurationSuccessful) {
21
+ Logger.log(Logger.SUCCESS_TYPE, 'Custom pre commit hook setup was successful');
22
+ return true;
42
23
  } else {
24
+ Logger.log(Logger.FAILURE_TYPE, 'Couldn\'t configure custom pre commit hook');
43
25
  return false;
44
26
  }
45
27
  } else {
46
- Logger.log(Logger.FAILURE_TYPE, 'Some issue in installing husky package.');
47
28
  return false;
48
29
  }
49
30
  }
50
-
51
- /**
52
- * @function installHuskyPackage - installs husky package if not installed for the project
53
- * @returns {boolean} - indicating if husky package installed successfully or not
54
- */
55
- function installHuskyPackage() {
56
- const nodeModulesPathOfProject = path.join(getNodeModulesPath(), 'node_modules');
57
- let pluginsInNodeModules = executeSynchronizedCommands(readdirSync, [nodeModulesPathOfProject], '', 'Unable to get directories in node_modules when checking if husky is installed', true, false);
58
- let husky = {
59
- packageName: 'husky',
60
- version: '^7.0.4'
61
- };
62
- let isHuskyInstalled = pluginsInNodeModules.includes(husky.packageName) ? true : false;
63
- if (!isHuskyInstalled) {
64
- Logger.log(Logger.INFO_TYPE, 'Installing husky package ....');
65
- let installCommand = `npm install ${husky.packageName}@${husky.version} --save-dev`;
66
- let isHuskyPackageInstalled = executeSynchronizedCommands(execSync, [installCommand, {
67
- stdio: 'inherit'
68
- }], 'Husky package Installed Successfully', 'Unable to install husky package', false, true);
69
- return isHuskyPackageInstalled;
70
- }
71
- Logger.log(Logger.SUCCESS_TYPE, 'Husky package already installed!');
72
- return true;
73
- }
74
31
  module.exports = {
75
32
  setupHusky
76
33
  };
package/changeLog.md CHANGED
@@ -1,7 +1,16 @@
1
1
  # Code standard library
2
2
 
3
3
  # 0.0.0
4
+ 1. Testing version of the library
5
+
6
+ # 0.0.1
7
+ - This version was mistakenly published without the build folder which will be corrected in the next release
8
+
9
+ # 0.0.2 - first stable release of the library
4
10
  1. Sets up a custom precommit hook using husky
5
11
  2. clones the common linter configuration repository in developer branch
6
12
  3. Based on the cloned configuration folder creates a eslint config file
7
- 4. Checks for eslint rule violations in the staged files(Impact based) and aborts/allows commit accordingly
13
+ 4. Checks for eslint rule violations in the staged files(Impact based) and aborts/allows commit accordingly
14
+
15
+ # 0.0.3 - modifications in usage of Husky package
16
+ 1. The husky package is not installed and the required huksy package version is temporarily downloaded from npm registry and used
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/codestandard-validator",
3
- "version": "0.0.2-exp-5",
3
+ "version": "0.0.3",
4
4
  "description": "library to enforce code standard using eslint",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,18 +0,0 @@
1
- const { rulesConfig, plugins, extendPlugins } = require("@zohodesk/codestandard-validator"); //no i18n
2
- const [off, , error] = ["off", "warn", "error"];
3
- module.exports = {
4
- env: {
5
- browser: true,
6
- es2021: true,
7
- },
8
- extends: extendPlugins,
9
- parserOptions: {
10
- ecmaFeatures: {
11
- jsx: true,
12
- },
13
- ecmaVersion: 12,
14
- sourceType: "module",
15
- },
16
- plugins: plugins,
17
- overrides: rulesConfig
18
- };
@@ -1,9 +0,0 @@
1
- const { zsecurityRules } = require('./rule_configuration/configurations')
2
- const $plugins = require('./pluginVersion')
3
-
4
-
5
- module.exports = {
6
- rulesConfig : Object.assign([],[...zsecurityRules]),
7
- plugins:$plugins.map((plugin) => plugin?.plugin).filter(item => item !== undefined) ,
8
- extendPlugins:$plugins.map((plugin) => plugin?.extend).filter(item => item !== undefined)
9
- }
@@ -1,7 +0,0 @@
1
- module.exports = [
2
- {
3
- packageName: "@zohodesk/eslint-plugin-zsecurity",
4
- version: "0.0.1-beta.4",
5
- plugin: "@zohodesk/zsecurity"
6
- }
7
- ];
@@ -1,9 +0,0 @@
1
- module.exports.zsecurityRules = [
2
- {
3
- files: ["src/**/*.js"],
4
- rules: {
5
- "@zohodesk/zsecurity/no-unsecure-html": 'error',
6
- "@zohodesk/zsecurity/no-protocol-check": 'error',
7
- },
8
- },
9
- ];
@@ -1,18 +0,0 @@
1
- const { rulesConfig, plugins, extendPlugins } = require("@zohodesk/codestandard-validator"); //no i18n
2
- const [off, , error] = ["off", "warn", "error"];
3
- module.exports = {
4
- env: {
5
- browser: true,
6
- es2021: true,
7
- },
8
- extends: extendPlugins,
9
- parserOptions: {
10
- ecmaFeatures: {
11
- jsx: true,
12
- },
13
- ecmaVersion: 12,
14
- sourceType: "module",
15
- },
16
- plugins: plugins,
17
- overrides: rulesConfig
18
- };
@@ -1,16 +0,0 @@
1
- const { plugins , rulesConfig} = require('../../common/index')
2
- const { architectureRules } = require("./rule_configuration/architectureRules/bestPracticeRules")
3
- const { i18Configuration } = require("./rule_configuration/i18nRules/noHardcodingRuleExcludes")
4
- const $plugins = [...require('./pluginVersion'), ...plugins ]
5
-
6
-
7
- module.exports = {
8
- rulesConfig : Object.assign([],[...architectureRules,...i18Configuration,...rulesConfig]) ,
9
- plugins:$plugins.map((plugin) => plugin?.plugin).filter(item => item !== undefined) ,
10
- extendPlugins:$plugins.map((plugin) => plugin?.extend).filter(item => item !== undefined)
11
- }
12
-
13
-
14
-
15
-
16
-
@@ -1,17 +0,0 @@
1
- module.exports = [
2
- {
3
- packageName: "@zohodesk/eslint-plugin-architecturerules",
4
- version: "0.0.2-exp-4",
5
- plugin: "@zohodesk/architecturerules",
6
- },
7
- {
8
- packageName: "@zohodesk/eslint-plugin-no-hardcoding",
9
- version: "1.0.2",
10
- plugin: "@zohodesk/no-hardcoding",
11
- },
12
- {
13
- packageName: "@zohodesk/eslint-config-acceptancetest",
14
- version: "0.0.3",
15
- extend: "@zohodesk/eslint-config-acceptancetest",
16
- }
17
- ];
@@ -1,9 +0,0 @@
1
- module.exports.architectureRules = [
2
- {
3
- files: ['src/**/*.js'],
4
- rules: {
5
- '@zohodesk/architecturerules/no-unused-vars' : 'warn',
6
- '@zohodesk/architecturerules/no-comments-rule':'warn'
7
- }
8
- }
9
- ]
@@ -1,32 +0,0 @@
1
- let noHardcodingRuleExcludes = {
2
- objectKeys:["dataId","data-id","data-test-id","size","iconSize","iconName","align","alignBox","palette","scroll","boxSize","boxPosition","type","moduleName","apiname","apiName","id","target","tagName","module","folderName","componentGroup","hoverType","tabIndex","aria-Label","aria-label","ariaLabel","d","className","rel","heading","column","row","transform","color","condition","fieldName","animationStyle","textBoxVariant","searchBoxSize","src","display","href","width","height","enctype","target","left","top","position","location","backgroundColor","visibility","cursor","lineHeight","border","readOnly","textAlign","scrolling","class","padding","overflow","textBoxSize","right","top","bottom","left","fieldType","regex","searchModuleFieldName","searchConditionValue","logoName","_id"],
3
- props:["dataId","data-id","data-test-id","size","iconSize","iconName","align","alignBox","palette","scroll","boxSize","boxPosition","type","moduleName","apiname","apiName","id","target","tagName","module","folderName","componentGroup","hoverType","tabIndex","aria-Label","aria-label","ariaLabel","d","className","rel","heading","column","row","transform","color","condition","fieldName","animationStyle","textBoxVariant","searchBoxSize","src","display","href","width","height","enctype","target","left","top","position","location","backgroundColor","visibility","cursor","lineHeight","border","readOnly","textAlign","scrolling","class","padding","overflow","textBoxSize","right","top","bottom","left","fieldType","logoName","_id"],
4
- methods:["findIdex","findIndex","includes","getFieldIndex","oneOf","oneOfType","bind","getFieldLabel","addEventListener","removeEventListener","replace","split","indexOf","set","selectn","getAdditionalProperty","reject","sendResponse","resolve","mapStateToProps","setAttribute","updateError","concat","createElement","getproperty","addElement","getElementsByName","match","lastIndexOf","setRequestHeader","getParameter","getAttribute","RegExp","substring","equals","log","debug","addClass","open","find","setTimeout","attachEvent","addEventListener","removeAttribute","parseInt","replace","setInterval","getObj","detachEvent","removeEventListener","css","animate","bind","ajaxNew","set_cookie","getElementById","ajax","find","createTextNode","parents","removeClass","toggleClass","write","get_cookie","parseFromString","Error","error","querySelector","getDeptBasedData","timeEnd","time","deskCustomError"],
5
- allowedTags:["svg"],
6
- keys:["Product Category","Product Owner","Product Information","Summarize information","and then","and finally","Support Manager","Newbie Agent","Light Agent","All Accounts","All Contacts","All Cases","Open Cases","Closed Cases","My Cases","All Products","Published Solutions","Open Tasks","All Published Solutions","My Draft Solutions","My Review Solutions","Today+Overdue Tasks","Overdue Cases","My Overdue Cases","Spam Cases","Requests for review","Customer Responded Requests","Customer Responded Time","Unassigned Open Requests","Unassigned Open Cases","SLAViolated Requests","My Open Requests","My Accounts","My Contacts","My Products","All Solutions","My Solutions","All Tasks","My Open Tasks","Todays Tasks","Unpublished Solutions","Overdue Tasks","Tomorrows Tasks","All Contracts","Expired Contracts","My Contracts","My Tasks","Completed Tasks","Missed Chats","All Missed Calls","My Missed Calls","Accounts Unmapped with CRM","Accounts Mapped with CRM","Contacts Unmapped with CRM","Contacts Mapped with CRM","Agent Notification","Contact Notification","Contact Created Time","Public Email Templates","Request has been assigned to you","Request for review","Request moved to the Department","Team Notification","Secondary Contacts Notification","Created By","Created Time","Modified Time","Last Activity Time","Unsubscribed Mode","Unsubscribed Time","Reports To","Date of Birth","New Request Created","Your request has been closed","Requestor has replied to the request","Comment Added for the Request","Comment is deleted from a ticket","Comment is edited in a ticket","Resolution Updated for the Request","Notify support reps on new request","Notify Agent when a comment is deleted for their ticket","Notify Agent when a comment is edited from their ticket","Acknowledge contact on receiving a new ticket","Notify agent on assigning a task","Notify agents when a ticket is moved to their department","Notify all agents when a new ticket is created","Notify contact when a comment is added","Notify contact when a comment is deleted","Notify contact when a comment is edited","Notify contact when a resolution is added","Task has been assigned to you","Remind Task Owner on Set Time","Popular Articles","Remind At","User Information","To Address","Account Name","Contact Information",
7
- "All Requests","Product Code","Product Name","Unit Price","Due Date","Case Number","Not Started","In Progress","Waiting on someone else","On Hold","Contact Name","Last Week","Current Week","Last Month","Current Month","Previous FY","Current FY","Next FY","Previous FQ","Current FQ","Next FQ","Next Week","Next Month","Last 60 Days","Last 90 Days","Last 120 Days","Next 7 Days","Next 30 Days","Next 60 Days","Next 90 Days","Next 120 Days","Full Name","Due on","All User","View Requests","Add Request","View Thread","Paid User","Open in New Window","Recent articles","Contract Name","Contract End","Contract Start","Request Id","Contract Number","Sub Category","support.label.Additional Information","Closed Activities","Recent Views","Modified By","Other Phone","Home Phone","Account Number","Request Subject","Request Charge","Other Address","Mailing Address","Billing Address","Shipping Address","Response Due Date","Unassigned Cases","Case On Hold Time","Summarize information by","and then by","and finally by","Time to Respond","Closing Date","crm.label.Product Category","crm.label.Product Owner","crm.label.Product Information","crm.label.Contact Name","Sub Category","mousemove click","Manufacturer","Hour","Deactivated","Review","Notes","CREATEDTIME","Requests","Social","Reports","Report","Solution","Articles","Article","Customized","Title","Fax","Lookup","Chat","Community","Left","Cases","Solutions","Contract","Accounts","Account","Contacts","Contact","Products","Product","Home","Tasks","Calls","Events","IM","Phone","Mobile","Email","Type","Website","Name","Country","Comments","Priority","Description","Department","click","email","is","are","None","this","these","Total","Category","Pending","Status","Subject","Answer","Overdue","between","Top","Customer","Completed","Deferred","Highest","Lowest","High","Low","Normal","Inactive","Open","New","Web","Draft","Duplicate","Closed","Archived","Today","January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","Jun","Jul","Aug","Sep","Oct","Nov","Dec","days","day","on","User","Records","Private","AllUsers","Month","Avg","General","and","or","currentDateTime","confirmmsg","maxlenmsg","AM","PM","for","Update","to","Direction","hour","hours","minute",
8
- "minutes","second","seconds","ago","Move","Unassigned","Expired","Prospect","potential","Lead","Request","Mode","Forums","More","Call","Task","Event","sendingportalinvitation","loading","Custom","loggedinuser_view","everyone_view","onlyagents_view","Agent","Ticket","Attachment","SMS","Subscriptions","ActiveUsersList","DeactivatedUsersList","NotConfirmedUsersList","Content","Created"],
9
- commentsToIgnoreHardcodingCheck:["no i18n"],
10
- stringsAllowedAsBlockCommentStart: ["ignore i18n start","no i18n start"],
11
- stringsAllowedAsBlockCommentEnd: ["ignore i18n end","no i18n end"],
12
- dateFormatPatterns:["DD MMM YYYY hh:mm A","DD\/MM\/YYYY h:mm A","DDD, DD MMM YYYY HH:mm:ss","DD MMM YYYY","hh:mm A"]
13
- }
14
- const [error,,off] = ['error','','off']
15
-
16
- let usegetI18NValueAppropriatelyExcludes = {
17
- i18nKeys:noHardcodingRuleExcludes.keys,
18
- commentsToIgnoreCheck:noHardcodingRuleExcludes.commentsToIgnoreHardcodingCheck
19
- }
20
-
21
- module.exports.i18Configuration = [
22
- {
23
- files: ['src/**/*.js'],
24
- rules: {
25
- '@zohodesk/no-hardcoding/no-hardcoding' : [error,{...noHardcodingRuleExcludes}],
26
- '@zohodesk/no-hardcoding/use-getI18NValue-method-appropriately': [error,{...usegetI18NValueAppropriatelyExcludes}]
27
- }
28
- }
29
- ]
30
-
31
-
32
-