@zohodesk/codestandard-validator 0.0.7-exp-7 → 0.0.7-exp-9

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.
Files changed (72) hide show
  1. package/.babelrc +1 -1
  2. package/build/hooks/Precommit/pre-commit.js +6 -6
  3. package/build/utils/PluginsInstallation/arePluginsInstalled.js +0 -4
  4. package/build/utils/PluginsInstallation/checkIfPluginsAreInstalled.js +0 -55
  5. package/build/utils/PluginsInstallation/installPlugins.js +13 -52
  6. package/package.json +1 -1
  7. package/build/utils/EslintConfigFileUtils/createEslintConfigFile.js +0 -54
  8. package/build/utils/EslintConfigFileUtils/getEslintExecutablePath.js +0 -24
  9. package/build/utils/EslintConfigFileUtils/getLintConfiguration.js +0 -52
  10. package/configuration/.prettierignore +0 -1
  11. package/configuration/.prettierrc +0 -13
  12. package/configuration/common/.eslintrc.js +0 -18
  13. package/configuration/common/index.js +0 -8
  14. package/configuration/common/pluginVersion.js +0 -3
  15. package/configuration/services/Desk-Extension/.eslintrc.js +0 -23
  16. package/configuration/services/Desk-Extension/index.js +0 -25
  17. package/configuration/services/Desk-Extension/pluginVersion.js +0 -16
  18. package/configuration/services/Desk-Extension/rule_configuration/css_rules/cssRuleConfiguration.js +0 -15
  19. package/configuration/services/Desk-Extension/rule_configuration/i18nRules/noHardcodingRuleExcludes.js +0 -41
  20. package/configuration/services/Desk-Extension/rule_configuration/unUsed/unUsedImport.js +0 -14
  21. package/configuration/services/GC_Chat/index.js +0 -21
  22. package/configuration/services/GC_Chat/pluginVersion.js +0 -12
  23. package/configuration/services/GC_Chat/rule_configuration/i18nRules/i18nRules.js +0 -284
  24. package/configuration/services/GC_Chat/rule_configuration/react-performance-rules/reactPerformanceRulesConfig.js +0 -26
  25. package/configuration/services/client_platform/.eslintrc.js +0 -35
  26. package/configuration/services/client_platform/index.js +0 -16
  27. package/configuration/services/client_platform/pluginVersion.js +0 -12
  28. package/configuration/services/client_platform/rule_configuration/architecture_rules/architectureRuleConfiguration.js +0 -172
  29. package/configuration/services/client_platform/rule_configuration/architecture_rules/clientScriptRuleConfiguration.js +0 -19
  30. package/configuration/services/client_platform/rule_configuration/architecture_rules/customFieldRuleConfiguration.js +0 -30
  31. package/configuration/services/client_platform/rule_configuration/architecture_rules/errorHandlerRuleConfiguration.js +0 -34
  32. package/configuration/services/client_platform/rule_configuration/architecture_rules/layerConfiguration.js +0 -52
  33. package/configuration/services/client_platform/rule_configuration/i18n/i18n.js +0 -39
  34. package/configuration/services/client_platform/rule_configuration/sdk/sdk.js +0 -23
  35. package/configuration/services/desk_client_app/.eslintrc.js +0 -23
  36. package/configuration/services/desk_client_app/index.js +0 -41
  37. package/configuration/services/desk_client_app/pluginVersion.js +0 -52
  38. package/configuration/services/desk_client_app/rule_configuration/i18nRules/noHardcodingRuleExcludes.js +0 -49
  39. package/configuration/services/desk_client_app/rule_configuration/propertiesFileValidation/propertiesFileExcludes.js +0 -23
  40. package/configuration/services/desk_client_app/rule_configuration/react-compiler/reactCompilerConfig.js +0 -25
  41. package/configuration/services/desk_client_app/rule_configuration/react-general/reactGeneralConfig.js +0 -33
  42. package/configuration/services/desk_client_app/rule_configuration/react-performance-rules/reactPerformanceRulesConfig.js +0 -84
  43. package/configuration/services/desk_client_app/rule_configuration/uatRules/uatRules.js +0 -23
  44. package/configuration/services/desk_client_app/rule_configuration/unused-imports/unusedImportsConfig.js +0 -28
  45. package/configuration/services/helpcenter_product/.eslintrc.js +0 -23
  46. package/configuration/services/helpcenter_product/index.js +0 -33
  47. package/configuration/services/helpcenter_product/pluginVersion.js +0 -33
  48. package/configuration/services/helpcenter_product/rule_configuration/i18nRules/noHardcodingRuleExcludes.js +0 -40
  49. package/configuration/services/helpcenter_product/rule_configuration/react-compiler/reactCompilerConfig.js +0 -18
  50. package/configuration/services/helpcenter_product/rule_configuration/react-general/reactGeneralConfig.js +0 -24
  51. package/configuration/services/helpcenter_product/rule_configuration/react-performance-rules/reactPerformanceRulesConfig.js +0 -25
  52. package/configuration/services/zohodesk/.eslintrc.js +0 -22
  53. package/configuration/services/zohodesk/index.js +0 -15
  54. package/configuration/services/zohodesk/pluginVersion.js +0 -7
  55. package/configuration/services/zohodesk/rule_configuration/select2RestrictedOptions/select2Excludes.js +0 -8
  56. package/configuration/services/zohogc_client/.eslintrc.js +0 -23
  57. package/configuration/services/zohogc_client/index.js +0 -22
  58. package/configuration/services/zohogc_client/pluginVersion.js +0 -27
  59. package/configuration/services/zohogc_client/rule_configuration/fitnessFunction/fitnessFunctionRules.js +0 -31
  60. package/configuration/services/zohogc_client/rule_configuration/i18nRules/i18nRules.js +0 -303
  61. package/configuration/services/zohogc_client/rule_configuration/react-performance-rules/reactPerformanceRulesConfig.js +0 -27
  62. package/configuration/services/zohogc_client/rule_configuration/uatRules/uatRules.js +0 -23
  63. package/configuration/services/zohoim_client/.eslintrc.js +0 -23
  64. package/configuration/services/zohoim_client/defaultRule.txt +0 -243
  65. package/configuration/services/zohoim_client/index.js +0 -28
  66. package/configuration/services/zohoim_client/pluginVersion.js +0 -38
  67. package/configuration/services/zohoim_client/rule_configuration/i18nRules/noHardcodingRule.js +0 -38
  68. package/configuration/services/zohoim_client/rule_configuration/propertiesFileValidation/propertiesFileRule.js +0 -23
  69. package/configuration/services/zohoim_client/rule_configuration/react-compiler/reactCompilerConfig.js +0 -16
  70. package/configuration/services/zohoim_client/rule_configuration/react-general/reactGeneralConfig.js +0 -22
  71. package/configuration/services/zohoim_client/rule_configuration/react-performance-rules/reactPerformanceRulesConfig.js +0 -19
  72. package/configuration/services/zohoim_client/rule_configuration/uatRules/uatRules.js +0 -21
package/.babelrc CHANGED
@@ -4,7 +4,7 @@
4
4
  "@babel/preset-env",
5
5
  {
6
6
  "targets": {
7
- "node": "14"
7
+ "node": "16"
8
8
  }
9
9
  }
10
10
  ]
@@ -154,9 +154,9 @@ function findStyleLintErrors(filePath) {
154
154
  if (stdout) {
155
155
  resolve(stderr.trim().split('\n'));
156
156
  }
157
- // if(stderr){
158
- // resolve(stderr.trim().split('\n'))
159
- // }
157
+ if (stderr) {
158
+ resolve(stderr.trim().split('\n'));
159
+ }
160
160
  // else if(error){
161
161
  // Logger.log(Logger.FAILURE_TYPE,error)
162
162
  // reject("Error executing eslint command")
@@ -337,7 +337,7 @@ async function preCommitHook() {
337
337
  }
338
338
  } catch (err) {
339
339
  Logger.log(Logger.FAILURE_TYPE, err);
340
- Logger.log(Logger.FAILURE_TYPE, "Error in executing eslint command");
340
+ Logger.log(Logger.FAILURE_TYPE, "Error in executing lint command");
341
341
  }
342
342
  }
343
343
  }
@@ -348,14 +348,14 @@ async function preCommitHook() {
348
348
  Logger.log(Logger.INFO_TYPE, 'Error executing pre commit hook');
349
349
  }
350
350
  if (shouldAbortCommit) {
351
- Logger.log(Logger.FAILURE_TYPE, `There are eslint errors/warnings present. So commit is aborted.`);
351
+ Logger.log(Logger.FAILURE_TYPE, `There are linter errors/warnings present. So commit is aborted.`);
352
352
  process.exit(1);
353
353
  } else if (shouldAbortCommit === false && staged_files.length !== 0) {
354
354
  Logger.log(Logger.SUCCESS_TYPE, `Commit Successful`);
355
355
  process.exit(0);
356
356
  }
357
357
  } else {
358
- Logger.log(Logger.FAILURE_TYPE, 'Commit failed since some eslint plugins are not installed');
358
+ Logger.log(Logger.FAILURE_TYPE, 'Commit failed since some lint plugins are not installed');
359
359
  Logger.log(Logger.INFO_TYPE, `Kindly execute the command \x1b[37mnpx ZDPrecommit setupPlugins \x1b[33mfrom the location where package.json is present to install the plugins`);
360
360
  Logger.log(Logger.INFO_TYPE, 'Execute the command and kindly try committing again.');
361
361
  process.exit(1);
@@ -3,9 +3,6 @@
3
3
  const {
4
4
  checkIfPluginsAreInstalled
5
5
  } = require('./checkIfPluginsAreInstalled');
6
- const {
7
- printUninstalledPlugins
8
- } = require('./printUninstalledPlugins');
9
6
  const {
10
7
  installPlugins
11
8
  } = require('./installPlugins');
@@ -18,7 +15,6 @@ function arePluginsInstalled() {
18
15
  if (!areAllPluginsInstalled) {
19
16
  installPlugins(uninstalledPlugins);
20
17
  }
21
- // printUninstalledPlugins(uninstalledPlugins,noPluginMessage)
22
18
  }
23
19
  module.exports = {
24
20
  arePluginsInstalled
@@ -4,14 +4,12 @@ const {
4
4
  existsSync
5
5
  } = require('fs');
6
6
  const path = require('path');
7
- // const { getNodeModulesPath } = require('../General/getNodeModulesPath')
8
7
  const {
9
8
  Logger
10
9
  } = require('../Logger/Logger');
11
10
  const {
12
11
  getLibraryInstalledLocation
13
12
  } = require('../General/getLibraryInstalledLocation');
14
- // const { executeSynchronizedCommands } = require('../General/executeSyncCommands')
15
13
  const {
16
14
  endPoint,
17
15
  commonLinterRepoName
@@ -22,35 +20,6 @@ const {
22
20
  const {
23
21
  getServicePathElseCommon
24
22
  } = require('../ConfigFileUtils/getLintConfiguration');
25
-
26
- // function getUnInstalledPlugins(pluginsForCurrentRepo,pluginNamesOfDevDependencyPlugins,devDependencies){
27
- // let pluginsInNodeModules = executeSynchronizedCommands(readdirSync,[path.join(getNodeModulesPath(),'node_modules')],'','Unable to get the plugins inside node_modules',true,false)
28
- // let pluginsToBeInstalled = []
29
- // pluginsForCurrentRepo.filter(plugin => {
30
- // if(plugin.packageName.startsWith('@')){
31
- // let scope = plugin.packageName.split('/')[0]
32
- // let pluginName = plugin.packageName.split('/')[1]
33
- // let scopedPlugins = executeSynchronizedCommands(readdirSync,[path.join(getNodeModulesPath(),'node_modules',scope)],'','Unable to get the plugins inside the scope inside node_modules',true,false)
34
- // let isPluginInstalled = scopedPlugins.includes(pluginName) ? true : false
35
- // if(!isPluginInstalled){
36
- // pluginsToBeInstalled.push(`${plugin.packageName}@${plugin.version}`)
37
- // }
38
- // }
39
- // else{
40
- // let isPluginInstalled = pluginsInNodeModules.includes(plugin.packageName) ? true : false
41
- // if(!isPluginInstalled){
42
- // pluginsToBeInstalled.push(`${plugin.packageName}@${plugin.version}`)
43
- // }
44
- // }
45
- // if(pluginNamesOfDevDependencyPlugins.includes(plugin.packageName)){
46
- // if(plugin.version !== devDependencies[plugin.packageName]){
47
- // pluginsToBeInstalled.push(`${plugin.packageName}@${plugin.version}`)
48
- // }
49
- // }
50
- // })
51
- // return pluginsToBeInstalled
52
- // }
53
-
54
23
  function getAllPlugins() {
55
24
  let serviceSpecificPlugins = [];
56
25
  const pathToCommonPluginsFile = path.join(getLibraryInstalledLocation(), commonLinterRepoName, 'common', 'pluginVersion.js');
@@ -77,29 +46,6 @@ function checkIfPluginsAreInstalled() {
77
46
  noPluginMessage: '',
78
47
  uninstalledPlugins: []
79
48
  };
80
- // let pluginsIndevDependencies = {}
81
- // let pluginNamesOfDevDependencyPlugins = []
82
- // let arePluginsPresentIndevDependencies = false
83
- // var arePluginsPresentForCurrentRepo = false
84
-
85
- // if(existsSync(path.join(getNodeModulesPath(),'package.json'))){
86
- // let packageJsonContent = require(path.join(getNodeModulesPath(),'package.json'))
87
- // pluginsIndevDependencies = packageJsonContent.devDependencies
88
-
89
- // if(pluginsIndevDependencies !== undefined){
90
- // arePluginsPresentIndevDependencies = true
91
- // pluginNamesOfDevDependencyPlugins = Object.keys(pluginsIndevDependencies)
92
- // }
93
- // else if(pluginsIndevDependencies === undefined){
94
- // Logger.log(Logger.INFO_TYPE,'No devDependencies present!')
95
- // }
96
- // }
97
- // else{
98
- // arePluginsPresentIndevDependencies = false
99
- // }
100
-
101
- // arePluginsPresentForCurrentRepo = pluginsForCurrentRepo.length !== 0 ? true : false
102
-
103
49
  uninstalledPlugins = pluginsForCurrentRepo.map(plugin => {
104
50
  const {
105
51
  packageName,
@@ -115,7 +61,6 @@ function checkIfPluginsAreInstalled() {
115
61
  return `${packageName}@${version}`;
116
62
  }).filter(Boolean);
117
63
  if (uninstalledPlugins.length > 0) {
118
- // uninstalledPlugins = getUnInstalledPlugins(pluginsForCurrentRepo, pluginNamesOfDevDependencyPlugins, pluginsIndevDependencies);
119
64
  plugin.noPluginMessage = '';
120
65
  plugin.uninstalledPlugins = uninstalledPlugins;
121
66
  return plugin;
@@ -6,9 +6,6 @@ const {
6
6
  const {
7
7
  writeFileSync
8
8
  } = require('fs');
9
- const {
10
- checkIfPluginsAreInstalled
11
- } = require('./checkIfPluginsAreInstalled');
12
9
  const {
13
10
  executeSynchronizedCommands
14
11
  } = require('../General/executeSyncCommands');
@@ -21,22 +18,33 @@ const {
21
18
  const {
22
19
  getNodeModulesPath
23
20
  } = require('../General/getNodeModulesPath');
21
+ const {
22
+ spawn
23
+ } = require('child_process');
24
24
 
25
25
  /**
26
26
  * @function installPlugins - installs uninstalled plugins for the project
27
27
  * @returns {boolean} - indicating if plugins to be installed are installed successfully or not
28
28
  */
29
29
  function installPlugins(pluginsToBeInstalled) {
30
- // let {uninstalledPlugins : pluginsToBeInstalled} = checkIfPluginsAreInstalled()
31
30
  if (pluginsToBeInstalled.length > 0) {
32
31
  let packageJsonBeforePluginsInstallation = getPackageJsonContentBeforeInstallingPlugins();
33
- let installCommand = `npm install --save-dev ${pluginsToBeInstalled.join(' ')}`;
34
32
  Logger.log(Logger.INFO_TYPE, 'Installing plugins ....');
35
33
  Logger.log(Logger.INFO_TYPE, `Install command being executed: ${installCommand}`);
36
34
  let arePluginsInstalledSuccessfully = executeSynchronizedCommands(execSync, [installCommand, {
37
35
  stdio: 'inherit',
38
36
  cwd: getNodeModulesPath()
39
37
  }], '', 'Some issue occured while installing plugins', false, true);
38
+ const installCommand = ['install', '--save-dev', ...pluginsToBeInstalled, '--legacy-peer-deps'];
39
+ const result = spawn('npm', installCommand, {
40
+ stdio: 'inherit',
41
+ shell: true,
42
+ cwd: getNodeModulesPath()
43
+ });
44
+ if (result.error) {
45
+ Logger.log('Error running npm install:', result.error);
46
+ process.exit(1);
47
+ }
40
48
  if (arePluginsInstalledSuccessfully) {
41
49
  Logger.log(Logger.SUCCESS_TYPE, 'Plugins installation successful');
42
50
  let isPackageJsonRestored = restorePackageJsonContent(packageJsonBeforePluginsInstallation);
@@ -76,53 +84,6 @@ function restorePackageJsonContent(packageJsonContentBeforePluginsInstallation)
76
84
  let isPackageJsonRestored = executeSynchronizedCommands(writeFileSync, [packageJsonFilePath, JSON.stringify(packageJsonContentBeforePluginsInstallation, null, 2)], 'Package.json content restored successfully', 'Unable to restore package.json content', false, true);
77
85
  return isPackageJsonRestored;
78
86
  }
79
-
80
- // function appendInstalledPluginsToPackageJson(pluginsToBeAppendedInPackageJson){
81
- // let packageJsonFilePath = `${nodeModulesPathOfProject}/package.json`
82
- // let packageJsonContent = require(packageJsonFilePath)
83
- // let devDependencies = packageJsonContent.devDependencies
84
- // let pluginsToBeAddedInDevDependencies = {}
85
-
86
- // executeSynchronizedCommands(process.chdir,[nodeModulesPathOfProject],'','Unable to navigate to node_modules path when trying to revert changes in package.json',false,false)
87
-
88
- // let gitDiffOutput = executeSynchronizedCommands(execSync,['git diff --name-only'],'','Unable to execute git diff command while checking if package.json is changed',true,false).toString().trim()
89
- // let isPackageJsonChanged = gitDiffOutput.includes('package.json') ? true : false
90
-
91
- // if(isPackageJsonChanged){
92
- // let packageJsonChangesRevertCommand = `git checkout "${packageJsonFilePath}"`
93
- // isPackageJsonChangesRevertedSuccessfully = executeSynchronizedCommands(execSync,[packageJsonChangesRevertCommand,{stdio:'inherit'}],'Changes in package.json reverted successfully','Unable to revert the changes in package.json file',false,true)
94
-
95
- // if(isPackageJsonChangesRevertedSuccessfully){
96
- // pluginsToBeAppendedInPackageJson.map(uninstalledPlugin => {
97
- // if(uninstalledPlugin.startsWith('@')){
98
- // let indexOfAtCharacter = uninstalledPlugin.indexOf('@')
99
- // let indexOfSecondOccurenceOfAtCharacter = uninstalledPlugin.indexOf('@',indexOfAtCharacter + 1)
100
- // let unInstalledPluginName = uninstalledPlugin.slice(0,indexOfSecondOccurenceOfAtCharacter)
101
- // let unInstalledPluginVersion = uninstalledPlugin.slice(indexOfSecondOccurenceOfAtCharacter + 1)
102
- // pluginsToBeAddedInDevDependencies[unInstalledPluginName] = unInstalledPluginVersion
103
- // }
104
- // else{
105
- // pluginsToBeAddedInDevDependencies[uninstalledPlugin.split('@')[0]] = uninstalledPlugin.split('@')[1]
106
- // }
107
- // })
108
- // let updatedPluginsIndevDependencies = {
109
- // ...devDependencies,
110
- // ...pluginsToBeAddedInDevDependencies
111
- // }
112
- // packageJsonContent.devDependencies = updatedPluginsIndevDependencies
113
-
114
- // let modifiedPackageJson = {
115
- // ...packageJsonContent,
116
- // }
117
- // let isPluginsAddedInPackageJson = executeSynchronizedCommands(writeFileSync,[packageJsonFilePath,JSON.stringify(modifiedPackageJson,null,2)],'Newly installed plugins successfully added to package.json','Unable to append installed plugins to package.json',false,true)
118
- // return isPluginsAddedInPackageJson
119
- // }
120
- // else{
121
- // return true
122
- // }
123
- // }
124
- // }
125
-
126
87
  module.exports = {
127
88
  installPlugins
128
89
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/codestandard-validator",
3
- "version": "0.0.7-exp-7",
3
+ "version": "0.0.7-exp-9",
4
4
  "description": "library to enforce code standard using eslint",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- const path = require('path');
4
- const {
5
- writeFileSync,
6
- existsSync,
7
- unlinkSync,
8
- readFileSync
9
- } = require('fs');
10
- const {
11
- getNodeModulesPath
12
- } = require('../General/getNodeModulesPath.js');
13
- const {
14
- Logger
15
- } = require('../Logger/Logger.js');
16
- const {
17
- executeSynchronizedCommands
18
- } = require('../General/executeSyncCommands.js');
19
- const {
20
- getServicePathElseCommon
21
- } = require('./getLintConfiguration.js');
22
- let eslintConfiguration = ``;
23
-
24
- /**
25
- * @function createEslintConfigFile - creates a eslint configuration file based on the configuration file in the common linters repo
26
- * @returns {boolean} - indicating the success or failure in creating the eslint configuration file
27
- */
28
- function createEslintConfigFile() {
29
- const eslintConfigFilePath = path.join(getNodeModulesPath(), '.eslintrc.js');
30
- const {
31
- pathOfServiceSpecificEslintConfigFile
32
- } = getServicePathElseCommon();
33
- eslintConfiguration = executeSynchronizedCommands(readFileSync, [pathOfServiceSpecificEslintConfigFile, 'utf-8'], '', 'Unable to read content of eslint config file.', true, false);
34
- try {
35
- let isEslintConfigFilePresent = existsSync(eslintConfigFilePath);
36
- if (isEslintConfigFilePresent) {
37
- executeSynchronizedCommands(unlinkSync, [eslintConfigFilePath], 'Eslint configuration file removed successfully!', 'Unable to remove the eslint config file.', false, false);
38
- return createEslintConfigurationFile();
39
- } else if (!isEslintConfigFilePresent) {
40
- return createEslintConfigurationFile();
41
- }
42
- } catch (error) {
43
- Logger.log(Logger.FAILURE_TYPE, error);
44
- Logger.log(Logger.FAILURE_TYPE, 'Issue occured while checking if eslint config file exists');
45
- }
46
- }
47
- function createEslintConfigurationFile() {
48
- const eslintConfigFilePath = path.join(getNodeModulesPath(), '.eslintrc.js');
49
- let isEslintConfigFileCreated = executeSynchronizedCommands(writeFileSync, [eslintConfigFilePath, eslintConfiguration, 'utf-8'], 'Eslint configuration file created successfully!', 'Unable to create and write an eslint configuration file.', false, true);
50
- return isEslintConfigFileCreated;
51
- }
52
- module.exports = {
53
- createEslintConfigFile
54
- };
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- const path = require('path');
4
- const {
5
- readdirSync
6
- } = require('fs');
7
- const {
8
- getNodeModulesPath
9
- } = require('../General/getNodeModulesPath');
10
- const {
11
- executeSynchronizedCommands
12
- } = require('../General/executeSyncCommands');
13
- const {
14
- getLibraryInstalledLocation
15
- } = require('../General/getLibraryInstalledLocation');
16
- function getEslintExecutablePath() {
17
- let eslintLibraryName = 'eslint';
18
- let librariesInNodeModulesOfProject = executeSynchronizedCommands(readdirSync, [path.join(getNodeModulesPath(), 'node_modules')], '', 'Unable to get the plugins inside node_modules', true, false);
19
- let isEslintInstalledinProject = librariesInNodeModulesOfProject.some(library => library === eslintLibraryName);
20
- return isEslintInstalledinProject ? path.join(getNodeModulesPath(), 'node_modules', eslintLibraryName, 'bin', 'eslint.js') : path.join(getLibraryInstalledLocation(), 'node_modules', eslintLibraryName, 'bin', 'eslint.js');
21
- }
22
- module.exports = {
23
- getEslintExecutablePath
24
- };
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- const path = require('path');
4
- const {
5
- existsSync
6
- } = require('fs');
7
- const {
8
- endPoint,
9
- commonLinterRepoName
10
- } = require("../../../jsonUtils/commonLinterRepoDetails.js");
11
- const {
12
- getRepoName
13
- } = require('../GitActions/gitActions');
14
- const {
15
- getLibraryInstalledLocation
16
- } = require('../General/getLibraryInstalledLocation');
17
- const {
18
- executeMethodsThatMayThrowException
19
- } = require("../General/wrapperFunctionToExecuteAFunction");
20
-
21
- /**
22
- * @function getLintConfiguration - returns eslint configuration file from common linters repo
23
- * @returns {object} - containing properties of the eslint configuration file
24
- */
25
- function getServicePathElseCommon() {
26
- const repoName = getRepoName();
27
- const libraryInstalledLocation = getLibraryInstalledLocation();
28
- let commonConfigPath = path.join(libraryInstalledLocation, commonLinterRepoName, 'common', 'index.js');
29
- const _configurationPath = repoName && existsSync(path.join(libraryInstalledLocation, commonLinterRepoName, 'services', repoName, 'index.js')) ? path.join(libraryInstalledLocation, commonLinterRepoName, 'services', repoName, 'index.js') : commonConfigPath;
30
- let _pathOfServiceSpecificEslintConfigFile = repoName && existsSync(path.join(libraryInstalledLocation, commonLinterRepoName, 'services', repoName, '.eslintrc.js')) ? path.join(libraryInstalledLocation, commonLinterRepoName, 'services', repoName, '.eslintrc.js') : path.join(libraryInstalledLocation, commonLinterRepoName, 'common', '.eslintrc.js');
31
- let _pluginVersionPath = repoName && existsSync(path.join(libraryInstalledLocation, commonLinterRepoName, 'services', repoName, 'pluginVersion.js')) ? path.join(libraryInstalledLocation, commonLinterRepoName, 'services', repoName, 'pluginVersion.js') : undefined;
32
- return {
33
- configurationPath: _configurationPath,
34
- pathOfServiceSpecificEslintConfigFile: _pathOfServiceSpecificEslintConfigFile,
35
- pluginVersionPath: _pluginVersionPath
36
- };
37
- }
38
- function getLintConfigurationUtil() {
39
- const {
40
- configurationPath
41
- } = getServicePathElseCommon();
42
- const exceptionHandleObject = {
43
- rulesConfig: [{}, {}],
44
- plugins: [],
45
- extendPlugins: []
46
- };
47
- return executeMethodsThatMayThrowException(exceptionHandleObject, `Kindly Ensure that Configuration is setup in Configuration repo \n ${endPoint}`, require, configurationPath);
48
- }
49
- module.exports = {
50
- getLintConfigurationUtil,
51
- getServicePathElseCommon
52
- };
@@ -1 +0,0 @@
1
- node_modules
@@ -1,13 +0,0 @@
1
- {
2
- "printWidth": 150,
3
- "tabWidth": 2,
4
- "useTabs": false,
5
- "semi": true,
6
- "singleQuote": true,
7
- "jsxSingleQuote": true,
8
- "trailingComma": "none",
9
- "bracketSpacing": true,
10
- "arrowParens": "avoid",
11
- "endOfLine": "lf"
12
- }
13
-
@@ -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,8 +0,0 @@
1
- const $plugins = require('./pluginVersion')
2
-
3
-
4
- module.exports = {
5
- rulesConfig : Object.assign([],[]),
6
- plugins:$plugins.map((plugin) => plugin?.plugin).filter(item => item !== undefined) ,
7
- extendPlugins:$plugins.map((plugin) => plugin?.extend).filter(item => item !== undefined)
8
- }
@@ -1,3 +0,0 @@
1
- module.exports = [
2
-
3
- ];
@@ -1,23 +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
- settings: {
19
- react: {
20
- version: "16",
21
- },
22
- },
23
- };
@@ -1,25 +0,0 @@
1
- const { plugins, rulesConfig } = require("../../common/index");
2
- const {
3
- i18nConfiguration,
4
- } = require("./rule_configuration/i18nRules/noHardcodingRuleExcludes");
5
- const cssRuleConfiguration = require("./rule_configuration/css_rules/cssRuleConfiguration")
6
- const unUsedImport = require("./rule_configuration/unUsed/unUsedImport")
7
- const $plugins = [...require("./pluginVersion"), ...plugins];
8
-
9
- module.exports = {
10
- rulesConfig: Object.assign(
11
- [],
12
- [
13
- ...unUsedImport,
14
- ...cssRuleConfiguration,
15
- ...rulesConfig,
16
- ...i18nConfiguration
17
- ]
18
- ),
19
- plugins: $plugins
20
- .map((plugin) => plugin?.plugin)
21
- .filter((item) => item !== undefined),
22
- extendPlugins: $plugins
23
- .map((plugin) => plugin?.extend)
24
- .filter((item) => item !== undefined),
25
- };
@@ -1,16 +0,0 @@
1
- module.exports = [
2
- {
3
- packageName: "@zohodesk/eslint-plugin-no-hardcoding",
4
- version: "1.0.6",
5
- plugin: "@zohodesk/no-hardcoding"
6
- }, {
7
- packageName: "eslint-plugin-css-modules",
8
- version: "2.12.0",
9
- plugin: "css-modules"
10
- },
11
- {
12
- packageName: "eslint-plugin-unused-imports",
13
- version: "3.2.0",
14
- plugin: "unused-imports"
15
- }
16
- ];
@@ -1,15 +0,0 @@
1
- const [error, , off, warn] = ['error', '', 'off', 'warn']
2
-
3
- module.exports = [
4
- {
5
- files: ['./PrivateExtensions/**/*.css', './PublicExtensions/**/*.css', './PublicExtensions/**/*.js','./PrivateExtensions/**/*.js'],
6
- excludedFiles: [
7
- './PrivateExtensions/**/*.png',
8
- './PublicExtensions/**/*.png'
9
- ],
10
- rules: {
11
- 'css-modules/no-unused-class': [warn, { "camelCase": true }],
12
- 'css-modules/no-undef-class': [warn, { "camelCase": true }]
13
- }
14
- }
15
- ]
@@ -1,41 +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","hash","borderColor","variant","paddingSize","paddingLeftSize","ui_displayMode","$ui_displayMode","ui_alignItems","$ui_alignItems","ui_weight","$ui_weight","ui_wrapMode","$ui_wrapMode","ui_scroll","$ui_scroll","ui_direction","$ui_direction","ui_justifyContent","$ui_justifyContent","ui_textAlign","$ui_textAlign","ui_className","$ui_className","ui_hoverType","$ui_hoverType","ui_tagName","$ui_tagName","ui_size","$ui_size","wrap","fontWeight","errorType","shape","ui_boxSize","$ui_boxSize","ui_transform","$ui_transform","iconButtonHoverType","textField","valueField","titlePosition","mode","role","$ui_display"],
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","regex","searchModuleFieldName","searchConditionValue","logoName","_id","hash","borderColor","variant","paddingSize","paddingLeftSize","ui_displayMode","$ui_displayMode","ui_alignItems","$ui_alignItems","ui_weight","$ui_weight","ui_wrapMode","$ui_wrapMode","ui_scroll","$ui_scroll","ui_direction","$ui_direction","ui_justifyContent","$ui_justifyContent","ui_textAlign","$ui_textAlign","ui_className","$ui_className","ui_hoverType","$ui_hoverType","ui_tagName","$ui_tagName","ui_size","$ui_size","wrap","fontWeight","errorType","shape","ui_boxSize","$ui_boxSize","ui_transform","$ui_transform","iconButtonHoverType","textField","valueField","titlePositions","mode","role","$ui_display"],
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","-None-"],
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
- startString:["ZD-","zd-","GC-","https","..","ht","flex"],
14
- allowedPropStartingWords:["is","has","need","animation","dataId"],
15
- allowedPropEndingWords:["Id","id","size","palette","Palette","Size"],
16
- allowedWordsThatCanBePresentInAComponentNameToExcludeTheComponent:["Svg"]
17
- }
18
- const [error,,off] = ['error','','off']
19
-
20
- let usegetI18NValueAppropriatelyExcludes = {
21
- i18nKeys:noHardcodingRuleExcludes.keys,
22
- commentsToIgnoreCheck:noHardcodingRuleExcludes.commentsToIgnoreHardcodingCheck
23
- }
24
-
25
- module.exports.i18nConfiguration = [
26
- {
27
- files: ['./PrivateExtensions/**/*.js','./PublicExtensions/**/*.js'],
28
- excludedFiles: [
29
- './PrivateExtensions/**/*.png',
30
- './PublicExtensions/**/*.png',
31
- './PrivateExtensions/**/*.html',
32
- './PublicExtensions/**/*.html',
33
- './PrivateExtensions/**/*.css',
34
- './PublicExtensions/**/*.css',
35
- ],
36
- rules: {
37
- '@zohodesk/no-hardcoding/no-hardcoding' : [error,{...noHardcodingRuleExcludes}],
38
- '@zohodesk/no-hardcoding/use-getI18NValue-method-appropriately': [error,{...usegetI18NValueAppropriatelyExcludes}]
39
- }
40
- }
41
- ]
@@ -1,14 +0,0 @@
1
- const [error, , off, warn] = ['error', '', 'off', 'warn']
2
-
3
- module.exports = [
4
- {
5
- files: ['./PublicExtensions/**/*.js','./PrivateExtensions/**/*.js'],
6
- excludedFiles: [
7
- './PrivateExtensions/**/*.png',
8
- './PublicExtensions/**/*.png'
9
- ],
10
- rules: {
11
- 'unused-imports/no-unused-imports': [error]
12
- }
13
- }
14
- ]
@@ -1,21 +0,0 @@
1
- const { plugins, rulesConfig } = require('../../common/index');
2
- const {
3
- i18nConfiguration
4
- } = require('./rule_configuration/i18nRules/i18nRules');
5
- const {
6
- reactPerformanceRulesConfig
7
- } = require('./rule_configuration/react-performance-rules/reactPerformanceRulesConfig');
8
- const $plugins = [...require('./pluginVersion'), ...plugins];
9
-
10
- module.exports = {
11
- rulesConfig: Object.assign(
12
- [],
13
- [...i18nConfiguration, ...reactPerformanceRulesConfig, ...rulesConfig]
14
- ),
15
- plugins: $plugins
16
- .map((plugin) => plugin?.plugin)
17
- .filter((item) => item !== undefined),
18
- extendPlugins: $plugins
19
- .map((plugin) => plugin?.extend)
20
- .filter((item) => item !== undefined)
21
- };