@zohodesk/codestandard-validator 0.0.7-exp-11 → 0.0.7-exp-13
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/build/hooks/Precommit/pre-commit.js +11 -4
- package/build/hooks/hook.js +8 -1
- package/build/utils/FileAndFolderOperations/filterFiles.js +1 -1
- package/build/utils/General/getGeneralInfo.js +21 -2
- package/build/utils/General/getNodeModulesPath.js +4 -1
- package/changeLog.md +7 -1
- package/jsonUtils/commonLinterRepoDetails.js +1 -1
- package/package.json +1 -1
|
@@ -89,12 +89,17 @@ function filterDeltedFileFromStagedFiles(files) {
|
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
async function lintFiles(filePath) {
|
|
92
|
-
switch (path.extname(filePath)) {
|
|
93
|
-
case '.js'
|
|
92
|
+
switch (String(path.extname(filePath))) {
|
|
93
|
+
case '.js':
|
|
94
|
+
case '.ts':
|
|
95
|
+
case '.tsx':
|
|
96
|
+
case '.jsx':
|
|
97
|
+
case '.properties':
|
|
94
98
|
{
|
|
95
99
|
return await findEslintErrors(filePath);
|
|
96
100
|
}
|
|
97
|
-
case '.css'
|
|
101
|
+
case '.css':
|
|
102
|
+
case '.scss':
|
|
98
103
|
{
|
|
99
104
|
return await findStyleLintErrors(filePath);
|
|
100
105
|
}
|
|
@@ -253,8 +258,10 @@ async function preCommitHook() {
|
|
|
253
258
|
// Logger.log(Logger.SUCCESS_TYPE,`Commit Successful`)
|
|
254
259
|
// process.exit(0)
|
|
255
260
|
// }
|
|
261
|
+
|
|
262
|
+
// CssFiles not Enabled For while
|
|
256
263
|
areFilesStaged = true;
|
|
257
|
-
var stagedFiles = [...staged_filesJS
|
|
264
|
+
var stagedFiles = [...staged_filesJS];
|
|
258
265
|
for (let file in stagedFiles) {
|
|
259
266
|
let currentFileName = stagedFiles[file];
|
|
260
267
|
let changedLinesArray = [];
|
package/build/hooks/hook.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const {
|
|
4
4
|
getLastCommitHash,
|
|
5
|
-
getStoredCommitHash
|
|
5
|
+
getStoredCommitHash,
|
|
6
|
+
updateJsonFile
|
|
6
7
|
} = require("../utils/General/getGeneralInfo");
|
|
7
8
|
const {
|
|
8
9
|
executeMethodsThatReturnBooleanValue
|
|
@@ -16,8 +17,14 @@ const {
|
|
|
16
17
|
const {
|
|
17
18
|
installPlugins
|
|
18
19
|
} = require("../utils/PluginsInstallation/installPlugins");
|
|
20
|
+
const path = require("path");
|
|
19
21
|
async function hooks() {
|
|
22
|
+
var jsonFilePath = path.join(__dirname, '..', '..', 'jsonUtils', 'fsUtils.json');
|
|
20
23
|
if (!(getLastCommitHash() == getStoredCommitHash())) {
|
|
24
|
+
updateJsonFile(jsonFilePath, data => {
|
|
25
|
+
data.commitHash = getLastCommitHash();
|
|
26
|
+
return data;
|
|
27
|
+
});
|
|
21
28
|
await executeMethodsThatReturnBooleanValue("Make sure zgit.csez.zohocorpin.com is accessible", cloneViaCdt, null);
|
|
22
29
|
const {
|
|
23
30
|
uninstalledPlugins
|
|
@@ -24,7 +24,7 @@ function filterFiles(arrayOfFilesToBeFiltered, filesToBeRemoved, isConfigFileNee
|
|
|
24
24
|
if (currentFile.includes('.feature') && existsSync(currentFile)) {
|
|
25
25
|
files.featureFiles.push(currentFile);
|
|
26
26
|
}
|
|
27
|
-
if (currentFile.includes('.js') || currentFile.includes('.ts') || currentFile.includes('.tsx') || currentFile.includes('.jsx') && existsSync(currentFile)) {
|
|
27
|
+
if (currentFile.includes('.js') || currentFile.includes('.ts') || currentFile.includes('.tsx') || currentFile.includes('.jsx') || currentFile.includes('.properties') && existsSync(currentFile)) {
|
|
28
28
|
files.JsFiles.push(currentFile);
|
|
29
29
|
}
|
|
30
30
|
if (currentFile.includes('.css') && existsSync(currentFile)) {
|
|
@@ -10,6 +10,9 @@ const {
|
|
|
10
10
|
readOnlyToken,
|
|
11
11
|
commitHashEndPoint
|
|
12
12
|
} = require('../../../jsonUtils/commonLinterRepoDetails');
|
|
13
|
+
const {
|
|
14
|
+
Logger
|
|
15
|
+
} = require('../Logger/Logger');
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
18
|
* @function getTimeStampInfo - to fetch various timestamp details
|
|
@@ -103,9 +106,23 @@ function getLastCommitHash() {
|
|
|
103
106
|
*/
|
|
104
107
|
|
|
105
108
|
function getStoredCommitHash() {
|
|
106
|
-
const commitInfoPath =
|
|
109
|
+
const commitInfoPath = getJsonUtilsPath();
|
|
107
110
|
return fs.existsSync(commitInfoPath) && require(commitInfoPath).commitHash;
|
|
108
111
|
}
|
|
112
|
+
function getJsonUtilsPath() {
|
|
113
|
+
return path.join(__dirname, '..', '..', '..', 'jsonUtils', 'fsUtils.json');
|
|
114
|
+
}
|
|
115
|
+
function updateJsonFile(filePath, modifier) {
|
|
116
|
+
try {
|
|
117
|
+
const absolutePath = path.resolve(filePath);
|
|
118
|
+
const rawData = fs.readFileSync(absolutePath, "utf-8");
|
|
119
|
+
const jsonData = JSON.parse(rawData);
|
|
120
|
+
const updatedData = modifier(jsonData);
|
|
121
|
+
fs.writeFileSync(absolutePath, JSON.stringify(updatedData, null, 2), "utf-8");
|
|
122
|
+
} catch (error) {
|
|
123
|
+
Logger.log(Logger.FAILURE_TYPE, "Error updating JSON file");
|
|
124
|
+
}
|
|
125
|
+
}
|
|
109
126
|
module.exports = {
|
|
110
127
|
getSupportedLanguage,
|
|
111
128
|
getTimeStampInfo,
|
|
@@ -113,5 +130,7 @@ module.exports = {
|
|
|
113
130
|
getConfigurationPrecommit,
|
|
114
131
|
getRunningEnv,
|
|
115
132
|
getLastCommitHash,
|
|
116
|
-
getStoredCommitHash
|
|
133
|
+
getStoredCommitHash,
|
|
134
|
+
getJsonUtilsPath,
|
|
135
|
+
updateJsonFile
|
|
117
136
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
|
+
const {
|
|
5
|
+
getJsonUtilsPath
|
|
6
|
+
} = require('./getGeneralInfo');
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* @function getNodeModulesPath - fetches the absolute path where node_modules of project is present
|
|
7
10
|
* @returns {string} - path where node_modules of the project is present
|
|
8
11
|
*/
|
|
9
12
|
function getNodeModulesPath() {
|
|
10
|
-
return require(
|
|
13
|
+
return require(getJsonUtilsPath()).nodeModulesPath;
|
|
11
14
|
}
|
|
12
15
|
module.exports = {
|
|
13
16
|
getNodeModulesPath
|
package/changeLog.md
CHANGED
|
@@ -29,4 +29,10 @@
|
|
|
29
29
|
# 0.0.6 - Support extended for .properties file
|
|
30
30
|
|
|
31
31
|
1. The file types that are supported by this library can now be configured using the configuration file "lint.config.js"
|
|
32
|
-
2. Support for .properties file is also extended in this version along with existing support for file types .js, .jsx, .ts, .tsx
|
|
32
|
+
2. Support for .properties file is also extended in this version along with existing support for file types .js, .jsx, .ts, .tsx
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# - Support For Stylelint
|
|
36
|
+
|
|
37
|
+
1. Enhancement Parser support CSS files and linter
|
|
38
|
+
2. Clonet Configuration Flow Enhancement Validation
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
module.exports = {
|
|
12
12
|
endPoint: "zgit.csez.zohocorpin.com/code_standard/client_linter/linter_configuration.git",
|
|
13
|
-
branch: "master",
|
|
13
|
+
branch: process.env.CONFIGURATION_BRANCH || "master",
|
|
14
14
|
cacheDirectory: "./",
|
|
15
15
|
commonLinterRepoName: "configuration",
|
|
16
16
|
type: "git",
|