@sasjs/lint 2.4.1 → 2.4.2
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/.github/dependabot.yml +1 -1
- package/.github/reviewer-lottery.yml +0 -2
- package/.github/workflows/assign-reviewer.yml +2 -2
- package/format/formatFile.d.ts +1 -1
- package/format/formatFile.js +24 -72
- package/format/formatFile.js.map +1 -1
- package/format/formatFolder.d.ts +1 -1
- package/format/formatFolder.js +36 -104
- package/format/formatFolder.js.map +1 -1
- package/format/formatProject.js +10 -45
- package/format/formatProject.js.map +1 -1
- package/format/formatText.d.ts +1 -1
- package/format/formatText.js +6 -46
- package/format/formatText.js.map +1 -1
- package/format/index.js +5 -1
- package/format/index.js.map +1 -1
- package/format/shared.js +16 -16
- package/format/shared.js.map +1 -1
- package/formatExample.js +10 -6
- package/formatExample.js.map +1 -1
- package/index.js +5 -1
- package/index.js.map +1 -1
- package/lint/index.js +5 -1
- package/lint/index.js.map +1 -1
- package/lint/lintFile.d.ts +1 -1
- package/lint/lintFile.js +12 -76
- package/lint/lintFile.js.map +1 -1
- package/lint/lintFolder.d.ts +1 -1
- package/lint/lintFolder.js +23 -114
- package/lint/lintFolder.js.map +1 -1
- package/lint/lintProject.js +10 -45
- package/lint/lintProject.js.map +1 -1
- package/lint/lintText.js +6 -40
- package/lint/lintText.js.map +1 -1
- package/lint/shared.js +24 -45
- package/lint/shared.js.map +1 -1
- package/lintExample.js +45 -5
- package/lintExample.js.map +1 -1
- package/package.json +3 -3
- package/rules/file/hasDoxygenHeader.js +29 -29
- package/rules/file/hasDoxygenHeader.js.map +1 -1
- package/rules/file/hasMacroNameInMend.js +59 -59
- package/rules/file/hasMacroNameInMend.js.map +1 -1
- package/rules/file/hasMacroParentheses.js +25 -27
- package/rules/file/hasMacroParentheses.js.map +1 -1
- package/rules/file/hasRequiredMacroOptions.js +20 -20
- package/rules/file/hasRequiredMacroOptions.js.map +1 -1
- package/rules/file/lineEndings.js +27 -27
- package/rules/file/lineEndings.js.map +1 -1
- package/rules/file/noNestedMacros.js +23 -23
- package/rules/file/noNestedMacros.js.map +1 -1
- package/rules/file/strictMacroDefinition.js +52 -57
- package/rules/file/strictMacroDefinition.js.map +1 -1
- package/rules/line/indentationMultiple.js +16 -16
- package/rules/line/indentationMultiple.js.map +1 -1
- package/rules/line/maxLineLength.js +16 -16
- package/rules/line/maxLineLength.js.map +1 -1
- package/rules/line/noEncodedPasswords.js +18 -18
- package/rules/line/noEncodedPasswords.js.map +1 -1
- package/rules/line/noGremlins.js +29 -69
- package/rules/line/noGremlins.js.map +1 -1
- package/rules/line/noTabs.js +19 -19
- package/rules/line/noTabs.js.map +1 -1
- package/rules/line/noTrailingSpaces.js +16 -16
- package/rules/line/noTrailingSpaces.js.map +1 -1
- package/rules/path/lowerCaseFileNames.js +15 -15
- package/rules/path/lowerCaseFileNames.js.map +1 -1
- package/rules/path/noSpacesInFileNames.js +15 -15
- package/rules/path/noSpacesInFileNames.js.map +1 -1
- package/types/LintConfig.js +28 -68
- package/types/LintConfig.js.map +1 -1
- package/types/index.js +5 -1
- package/types/index.js.map +1 -1
- package/utils/asyncForEach.js +4 -46
- package/utils/asyncForEach.js.map +1 -1
- package/utils/getColumnNumber.js +3 -3
- package/utils/getColumnNumber.js.map +1 -1
- package/utils/getDataSectionsDetail.js +16 -38
- package/utils/getDataSectionsDetail.js.map +1 -1
- package/utils/getHeaderLinesCount.js +8 -30
- package/utils/getHeaderLinesCount.js.map +1 -1
- package/utils/getIndicesOf.js +3 -4
- package/utils/getIndicesOf.js.map +1 -1
- package/utils/getLintConfig.js +14 -52
- package/utils/getLintConfig.js.map +1 -1
- package/utils/getProjectRoot.js +22 -59
- package/utils/getProjectRoot.js.map +1 -1
- package/utils/index.js +5 -1
- package/utils/index.js.map +1 -1
- package/utils/isIgnored.d.ts +1 -1
- package/utils/isIgnored.js +20 -67
- package/utils/isIgnored.js.map +1 -1
- package/utils/listSasFiles.js +5 -39
- package/utils/listSasFiles.js.map +1 -1
- package/utils/parseMacros.d.ts +1 -1
- package/utils/parseMacros.js +29 -50
- package/utils/parseMacros.js.map +1 -1
- package/utils/splitText.js +4 -4
- package/utils/splitText.js.map +1 -1
- package/utils/trimComments.js +8 -10
- package/utils/trimComments.js.map +1 -1
package/.github/dependabot.yml
CHANGED
package/format/formatFile.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ import { LintConfig } from '../types/LintConfig';
|
|
|
6
6
|
* @param {LintConfig} configuration - an optional configuration. When not passed in, this is read from the .sasjslint file.
|
|
7
7
|
* @returns {Promise<FormatResult>} Resolves successfully when the file has been formatted.
|
|
8
8
|
*/
|
|
9
|
-
export declare const formatFile: (filePath: string, configuration?: LintConfig
|
|
9
|
+
export declare const formatFile: (filePath: string, configuration?: LintConfig) => Promise<FormatResult>;
|
package/format/formatFile.js
CHANGED
|
@@ -8,85 +8,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.formatFile = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
13
|
+
const file_1 = require("@sasjs/utils/file");
|
|
14
|
+
const lint_1 = require("../lint");
|
|
15
|
+
const getLintConfig_1 = require("../utils/getLintConfig");
|
|
16
|
+
const shared_1 = require("./shared");
|
|
44
17
|
/**
|
|
45
18
|
* Applies automatic formatting to the file at the given path.
|
|
46
19
|
* @param {string} filePath - the path to the file to be formatted.
|
|
47
20
|
* @param {LintConfig} configuration - an optional configuration. When not passed in, this is read from the .sasjslint file.
|
|
48
21
|
* @returns {Promise<FormatResult>} Resolves successfully when the file has been formatted.
|
|
49
22
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
formattedText = shared_1.processText(text, config);
|
|
71
|
-
return [4 /*yield*/, file_1.createFile(filePath, formattedText)];
|
|
72
|
-
case 5:
|
|
73
|
-
_b.sent();
|
|
74
|
-
return [4 /*yield*/, lint_1.lintFile(filePath, config)];
|
|
75
|
-
case 6:
|
|
76
|
-
diagnosticsAfterFormat = _b.sent();
|
|
77
|
-
diagnosticsCountAfterFormat = diagnosticsAfterFormat.length;
|
|
78
|
-
fixedDiagnosticsCount = diagnosticsCountBeforeFormat - diagnosticsCountAfterFormat;
|
|
79
|
-
updatedFilePaths = [];
|
|
80
|
-
if (fixedDiagnosticsCount) {
|
|
81
|
-
updatedFilePaths.push(filePath);
|
|
82
|
-
}
|
|
83
|
-
return [2 /*return*/, {
|
|
84
|
-
updatedFilePaths: updatedFilePaths,
|
|
85
|
-
fixedDiagnosticsCount: fixedDiagnosticsCount,
|
|
86
|
-
unfixedDiagnostics: diagnosticsAfterFormat
|
|
87
|
-
}];
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}); };
|
|
23
|
+
const formatFile = (filePath, configuration) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
const config = configuration || (yield (0, getLintConfig_1.getLintConfig)());
|
|
25
|
+
const diagnosticsBeforeFormat = yield (0, lint_1.lintFile)(filePath, config);
|
|
26
|
+
const diagnosticsCountBeforeFormat = diagnosticsBeforeFormat.length;
|
|
27
|
+
const text = yield (0, file_1.readFile)(filePath);
|
|
28
|
+
const formattedText = (0, shared_1.processText)(text, config);
|
|
29
|
+
yield (0, file_1.createFile)(filePath, formattedText);
|
|
30
|
+
const diagnosticsAfterFormat = yield (0, lint_1.lintFile)(filePath, config);
|
|
31
|
+
const diagnosticsCountAfterFormat = diagnosticsAfterFormat.length;
|
|
32
|
+
const fixedDiagnosticsCount = diagnosticsCountBeforeFormat - diagnosticsCountAfterFormat;
|
|
33
|
+
const updatedFilePaths = [];
|
|
34
|
+
if (fixedDiagnosticsCount) {
|
|
35
|
+
updatedFilePaths.push(filePath);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
updatedFilePaths,
|
|
39
|
+
fixedDiagnosticsCount,
|
|
40
|
+
unfixedDiagnostics: diagnosticsAfterFormat
|
|
41
|
+
};
|
|
42
|
+
});
|
|
91
43
|
exports.formatFile = formatFile;
|
|
92
44
|
//# sourceMappingURL=formatFile.js.map
|
package/format/formatFile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatFile.js","sourceRoot":"","sources":["../../src/format/formatFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatFile.js","sourceRoot":"","sources":["../../src/format/formatFile.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AACxD,kCAAkC;AAGlC,0DAAsD;AACtD,qCAAsC;AAEtC;;;;;GAKG;AACI,MAAM,UAAU,GAAG,CACxB,QAAgB,EAChB,aAA0B,EACH,EAAE;IACzB,MAAM,MAAM,GAAG,aAAa,IAAI,CAAC,MAAM,IAAA,6BAAa,GAAE,CAAC,CAAA;IACvD,MAAM,uBAAuB,GAAG,MAAM,IAAA,eAAQ,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAChE,MAAM,4BAA4B,GAAG,uBAAuB,CAAC,MAAM,CAAA;IAEnE,MAAM,IAAI,GAAG,MAAM,IAAA,eAAQ,EAAC,QAAQ,CAAC,CAAA;IAErC,MAAM,aAAa,GAAG,IAAA,oBAAW,EAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAE/C,MAAM,IAAA,iBAAU,EAAC,QAAQ,EAAE,aAAa,CAAC,CAAA;IAEzC,MAAM,sBAAsB,GAAG,MAAM,IAAA,eAAQ,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAC/D,MAAM,2BAA2B,GAAG,sBAAsB,CAAC,MAAM,CAAA;IAEjE,MAAM,qBAAqB,GACzB,4BAA4B,GAAG,2BAA2B,CAAA;IAE5D,MAAM,gBAAgB,GAAa,EAAE,CAAA;IAErC,IAAI,qBAAqB,EAAE;QACzB,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;KAChC;IAED,OAAO;QACL,gBAAgB;QAChB,qBAAqB;QACrB,kBAAkB,EAAE,sBAAsB;KAC3C,CAAA;AACH,CAAC,CAAA,CAAA;AA/BY,QAAA,UAAU,cA+BtB"}
|
package/format/formatFolder.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ import { LintConfig } from '../types/LintConfig';
|
|
|
6
6
|
* @param {LintConfig} configuration - an optional configuration. When not passed in, this is read from the .sasjslint file.
|
|
7
7
|
* @returns {Promise<FormatResult>} Resolves successfully when all SAS files in the given folder have been formatted.
|
|
8
8
|
*/
|
|
9
|
-
export declare const formatFolder: (folderPath: string, configuration?: LintConfig
|
|
9
|
+
export declare const formatFolder: (folderPath: string, configuration?: LintConfig) => Promise<FormatResult>;
|
package/format/formatFolder.js
CHANGED
|
@@ -8,46 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
13
|
};
|
|
41
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
15
|
exports.formatFolder = void 0;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
16
|
+
const file_1 = require("@sasjs/utils/file");
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const lint_1 = require("../lint");
|
|
19
|
+
const asyncForEach_1 = require("../utils/asyncForEach");
|
|
20
|
+
const getLintConfig_1 = require("../utils/getLintConfig");
|
|
21
|
+
const listSasFiles_1 = require("../utils/listSasFiles");
|
|
22
|
+
const formatFile_1 = require("./formatFile");
|
|
23
|
+
const excludeFolders = [
|
|
51
24
|
'.git',
|
|
52
25
|
'.github',
|
|
53
26
|
'.vscode',
|
|
@@ -61,76 +34,35 @@ var excludeFolders = [
|
|
|
61
34
|
* @param {LintConfig} configuration - an optional configuration. When not passed in, this is read from the .sasjslint file.
|
|
62
35
|
* @returns {Promise<FormatResult>} Resolves successfully when all SAS files in the given folder have been formatted.
|
|
63
36
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return __generator(this, function (_a) {
|
|
87
|
-
switch (_a.label) {
|
|
88
|
-
case 0:
|
|
89
|
-
filePath = path_1.default.join(folderPath, fileName);
|
|
90
|
-
return [4 /*yield*/, formatFile_1.formatFile(filePath)];
|
|
91
|
-
case 1:
|
|
92
|
-
_a.sent();
|
|
93
|
-
return [2 /*return*/];
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}); })];
|
|
97
|
-
case 5:
|
|
98
|
-
_b.sent();
|
|
99
|
-
return [4 /*yield*/, file_1.listSubFoldersInFolder(folderPath)];
|
|
100
|
-
case 6:
|
|
101
|
-
subFolders = (_b.sent()).filter(function (f) { return !excludeFolders.includes(f); });
|
|
102
|
-
return [4 /*yield*/, asyncForEach_1.asyncForEach(subFolders, function (subFolder) { return __awaiter(void 0, void 0, void 0, function () {
|
|
103
|
-
return __generator(this, function (_a) {
|
|
104
|
-
switch (_a.label) {
|
|
105
|
-
case 0: return [4 /*yield*/, exports.formatFolder(path_1.default.join(folderPath, subFolder), config)];
|
|
106
|
-
case 1:
|
|
107
|
-
_a.sent();
|
|
108
|
-
return [2 /*return*/];
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}); })];
|
|
112
|
-
case 7:
|
|
113
|
-
_b.sent();
|
|
114
|
-
return [4 /*yield*/, lint_1.lintFolder(folderPath)];
|
|
115
|
-
case 8:
|
|
116
|
-
diagnosticsAfterFormat = _b.sent();
|
|
117
|
-
diagnosticsCountAfterFormat = Array.from(diagnosticsAfterFormat.values()).reduce(function (a, b) { return a + b.length; }, 0);
|
|
118
|
-
fixedDiagnosticsCount = diagnosticsCountBeforeFormat - diagnosticsCountAfterFormat;
|
|
119
|
-
updatedFilePaths = [];
|
|
120
|
-
Array.from(diagnosticsBeforeFormat.keys()).forEach(function (filePath) {
|
|
121
|
-
var diagnosticsBefore = diagnosticsBeforeFormat.get(filePath) || [];
|
|
122
|
-
var diagnosticsAfter = diagnosticsAfterFormat.get(filePath) || [];
|
|
123
|
-
if (diagnosticsBefore.length !== diagnosticsAfter.length) {
|
|
124
|
-
updatedFilePaths.push(filePath);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
return [2 /*return*/, {
|
|
128
|
-
updatedFilePaths: updatedFilePaths,
|
|
129
|
-
fixedDiagnosticsCount: fixedDiagnosticsCount,
|
|
130
|
-
unfixedDiagnostics: diagnosticsAfterFormat
|
|
131
|
-
}];
|
|
37
|
+
const formatFolder = (folderPath, configuration) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
const config = configuration || (yield (0, getLintConfig_1.getLintConfig)());
|
|
39
|
+
const diagnosticsBeforeFormat = yield (0, lint_1.lintFolder)(folderPath);
|
|
40
|
+
const diagnosticsCountBeforeFormat = Array.from(diagnosticsBeforeFormat.values()).reduce((a, b) => a + b.length, 0);
|
|
41
|
+
const fileNames = yield (0, listSasFiles_1.listSasFiles)(folderPath);
|
|
42
|
+
yield (0, asyncForEach_1.asyncForEach)(fileNames, (fileName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
const filePath = path_1.default.join(folderPath, fileName);
|
|
44
|
+
yield (0, formatFile_1.formatFile)(filePath);
|
|
45
|
+
}));
|
|
46
|
+
const subFolders = (yield (0, file_1.listSubFoldersInFolder)(folderPath)).filter((f) => !excludeFolders.includes(f));
|
|
47
|
+
yield (0, asyncForEach_1.asyncForEach)(subFolders, (subFolder) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
yield (0, exports.formatFolder)(path_1.default.join(folderPath, subFolder), config);
|
|
49
|
+
}));
|
|
50
|
+
const diagnosticsAfterFormat = yield (0, lint_1.lintFolder)(folderPath);
|
|
51
|
+
const diagnosticsCountAfterFormat = Array.from(diagnosticsAfterFormat.values()).reduce((a, b) => a + b.length, 0);
|
|
52
|
+
const fixedDiagnosticsCount = diagnosticsCountBeforeFormat - diagnosticsCountAfterFormat;
|
|
53
|
+
const updatedFilePaths = [];
|
|
54
|
+
Array.from(diagnosticsBeforeFormat.keys()).forEach((filePath) => {
|
|
55
|
+
const diagnosticsBefore = diagnosticsBeforeFormat.get(filePath) || [];
|
|
56
|
+
const diagnosticsAfter = diagnosticsAfterFormat.get(filePath) || [];
|
|
57
|
+
if (diagnosticsBefore.length !== diagnosticsAfter.length) {
|
|
58
|
+
updatedFilePaths.push(filePath);
|
|
132
59
|
}
|
|
133
60
|
});
|
|
134
|
-
|
|
61
|
+
return {
|
|
62
|
+
updatedFilePaths,
|
|
63
|
+
fixedDiagnosticsCount,
|
|
64
|
+
unfixedDiagnostics: diagnosticsAfterFormat
|
|
65
|
+
};
|
|
66
|
+
});
|
|
135
67
|
exports.formatFolder = formatFolder;
|
|
136
68
|
//# sourceMappingURL=formatFolder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatFolder.js","sourceRoot":"","sources":["../../src/format/formatFolder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatFolder.js","sourceRoot":"","sources":["../../src/format/formatFolder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAA0D;AAC1D,gDAAuB;AACvB,kCAAoC;AAGpC,wDAAoD;AACpD,0DAAsD;AACtD,wDAAoD;AACpD,6CAAyC;AAEzC,MAAM,cAAc,GAAG;IACrB,MAAM;IACN,SAAS;IACT,SAAS;IACT,cAAc;IACd,YAAY;IACZ,cAAc;CACf,CAAA;AAED;;;;;GAKG;AACI,MAAM,YAAY,GAAG,CAC1B,UAAkB,EAClB,aAA0B,EACH,EAAE;IACzB,MAAM,MAAM,GAAG,aAAa,IAAI,CAAC,MAAM,IAAA,6BAAa,GAAE,CAAC,CAAA;IACvD,MAAM,uBAAuB,GAAG,MAAM,IAAA,iBAAU,EAAC,UAAU,CAAC,CAAA;IAC5D,MAAM,4BAA4B,GAAG,KAAK,CAAC,IAAI,CAC7C,uBAAuB,CAAC,MAAM,EAAE,CACjC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IAEnC,MAAM,SAAS,GAAG,MAAM,IAAA,2BAAY,EAAC,UAAU,CAAC,CAAA;IAChD,MAAM,IAAA,2BAAY,EAAC,SAAS,EAAE,CAAO,QAAQ,EAAE,EAAE;QAC/C,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QAChD,MAAM,IAAA,uBAAU,EAAC,QAAQ,CAAC,CAAA;IAC5B,CAAC,CAAA,CAAC,CAAA;IAEF,MAAM,UAAU,GAAG,CAAC,MAAM,IAAA,6BAAsB,EAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAClE,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC3C,CAAA;IAED,MAAM,IAAA,2BAAY,EAAC,UAAU,EAAE,CAAO,SAAS,EAAE,EAAE;QACjD,MAAM,IAAA,oBAAY,EAAC,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,CAAA;IAC9D,CAAC,CAAA,CAAC,CAAA;IAEF,MAAM,sBAAsB,GAAG,MAAM,IAAA,iBAAU,EAAC,UAAU,CAAC,CAAA;IAC3D,MAAM,2BAA2B,GAAG,KAAK,CAAC,IAAI,CAC5C,sBAAsB,CAAC,MAAM,EAAE,CAChC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IAEnC,MAAM,qBAAqB,GACzB,4BAA4B,GAAG,2BAA2B,CAAA;IAE5D,MAAM,gBAAgB,GAAa,EAAE,CAAA;IAErC,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC9D,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;QACrE,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;QAEnE,IAAI,iBAAiB,CAAC,MAAM,KAAK,gBAAgB,CAAC,MAAM,EAAE;YACxD,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SAChC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,gBAAgB;QAChB,qBAAqB;QACrB,kBAAkB,EAAE,sBAAsB;KAC3C,CAAA;AACH,CAAC,CAAA,CAAA;AAhDY,QAAA,YAAY,gBAgDxB"}
|
package/format/formatProject.js
CHANGED
|
@@ -8,56 +8,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.formatProject = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
13
|
+
const getProjectRoot_1 = require("../utils/getProjectRoot");
|
|
14
|
+
const formatFolder_1 = require("./formatFolder");
|
|
42
15
|
/**
|
|
43
16
|
* Automatically formats all SAS files in the current project.
|
|
44
17
|
* @returns {Promise<FormatResult>} Resolves successfully when all SAS files in the current project have been formatted.
|
|
45
18
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
throw new Error('SASjs Project Root was not found.');
|
|
55
|
-
}
|
|
56
|
-
console.info("Formatting all .sas files under " + projectRoot);
|
|
57
|
-
return [4 /*yield*/, formatFolder_1.formatFolder(projectRoot)];
|
|
58
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}); };
|
|
19
|
+
const formatProject = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
const projectRoot = (yield (0, getProjectRoot_1.getProjectRoot)()) || process.currentDir;
|
|
21
|
+
if (!projectRoot) {
|
|
22
|
+
throw new Error('SASjs Project Root was not found.');
|
|
23
|
+
}
|
|
24
|
+
console.info(`Formatting all .sas files under ${projectRoot}`);
|
|
25
|
+
return yield (0, formatFolder_1.formatFolder)(projectRoot);
|
|
26
|
+
});
|
|
62
27
|
exports.formatProject = formatProject;
|
|
63
28
|
//# sourceMappingURL=formatProject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatProject.js","sourceRoot":"","sources":["../../src/format/formatProject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatProject.js","sourceRoot":"","sources":["../../src/format/formatProject.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,4DAAwD;AACxD,iDAA6C;AAE7C;;;GAGG;AACI,MAAM,aAAa,GAAG,GAAgC,EAAE;IAC7D,MAAM,WAAW,GAAG,CAAC,MAAM,IAAA,+BAAc,GAAE,CAAC,IAAI,OAAO,CAAC,UAAU,CAAA;IAClE,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;KACrD;IAED,OAAO,CAAC,IAAI,CAAC,mCAAmC,WAAW,EAAE,CAAC,CAAA;IAE9D,OAAO,MAAM,IAAA,2BAAY,EAAC,WAAW,CAAC,CAAA;AACxC,CAAC,CAAA,CAAA;AATY,QAAA,aAAa,iBASzB"}
|
package/format/formatText.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { LintConfig } from '../types';
|
|
2
|
-
export declare const formatText: (text: string, configuration?: LintConfig
|
|
2
|
+
export declare const formatText: (text: string, configuration?: LintConfig) => Promise<string>;
|
package/format/formatText.js
CHANGED
|
@@ -8,53 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.formatText = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
case 0:
|
|
47
|
-
_a = configuration;
|
|
48
|
-
if (_a) return [3 /*break*/, 2];
|
|
49
|
-
return [4 /*yield*/, utils_1.getLintConfig()];
|
|
50
|
-
case 1:
|
|
51
|
-
_a = (_b.sent());
|
|
52
|
-
_b.label = 2;
|
|
53
|
-
case 2:
|
|
54
|
-
config = _a;
|
|
55
|
-
return [2 /*return*/, shared_1.processText(text, config)];
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}); };
|
|
13
|
+
const utils_1 = require("../utils");
|
|
14
|
+
const shared_1 = require("./shared");
|
|
15
|
+
const formatText = (text, configuration) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const config = configuration || (yield (0, utils_1.getLintConfig)());
|
|
17
|
+
return (0, shared_1.processText)(text, config);
|
|
18
|
+
});
|
|
59
19
|
exports.formatText = formatText;
|
|
60
20
|
//# sourceMappingURL=formatText.js.map
|
package/format/formatText.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatText.js","sourceRoot":"","sources":["../../src/format/formatText.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatText.js","sourceRoot":"","sources":["../../src/format/formatText.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oCAAwC;AACxC,qCAAsC;AAE/B,MAAM,UAAU,GAAG,CAAO,IAAY,EAAE,aAA0B,EAAE,EAAE;IAC3E,MAAM,MAAM,GAAG,aAAa,IAAI,CAAC,MAAM,IAAA,qBAAa,GAAE,CAAC,CAAA;IACvD,OAAO,IAAA,oBAAW,EAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AAClC,CAAC,CAAA,CAAA;AAHY,QAAA,UAAU,cAGtB"}
|
package/format/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/format/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,+CAA4B;AAC5B,iDAA8B;AAC9B,kDAA+B"}
|
package/format/shared.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processLine = exports.processText = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return exports.processLine(config, line);
|
|
4
|
+
const LineEndings_1 = require("../types/LineEndings");
|
|
5
|
+
const splitText_1 = require("../utils/splitText");
|
|
6
|
+
const processText = (text, config) => {
|
|
7
|
+
const processedText = processContent(config, text);
|
|
8
|
+
const lines = (0, splitText_1.splitText)(processedText, config);
|
|
9
|
+
const formattedLines = lines.map((line) => {
|
|
10
|
+
return (0, exports.processLine)(config, line);
|
|
11
11
|
});
|
|
12
|
-
|
|
12
|
+
const configuredLineEnding = config.lineEndings === LineEndings_1.LineEndings.LF ? '\n' : '\r\n';
|
|
13
13
|
return formattedLines.join(configuredLineEnding);
|
|
14
14
|
};
|
|
15
15
|
exports.processText = processText;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const processContent = (config, content) => {
|
|
17
|
+
let processedContent = content;
|
|
18
18
|
config.fileLintRules
|
|
19
|
-
.filter(
|
|
20
|
-
.forEach(
|
|
19
|
+
.filter((r) => !!r.fix)
|
|
20
|
+
.forEach((rule) => {
|
|
21
21
|
processedContent = rule.fix(processedContent, config);
|
|
22
22
|
});
|
|
23
23
|
return processedContent;
|
|
24
24
|
};
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const processLine = (config, line) => {
|
|
26
|
+
let processedLine = line;
|
|
27
27
|
config.lineLintRules
|
|
28
|
-
.filter(
|
|
29
|
-
.forEach(
|
|
28
|
+
.filter((r) => !!r.fix)
|
|
29
|
+
.forEach((rule) => {
|
|
30
30
|
processedLine = rule.fix(processedLine, config);
|
|
31
31
|
});
|
|
32
32
|
return processedLine;
|
package/format/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/format/shared.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/format/shared.ts"],"names":[],"mappings":";;;AACA,sDAAkD;AAClD,kDAA8C;AAEvC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,MAAkB,EAAE,EAAE;IAC9D,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAClD,MAAM,KAAK,GAAG,IAAA,qBAAS,EAAC,aAAa,EAAE,MAAM,CAAC,CAAA;IAC9C,MAAM,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxC,OAAO,IAAA,mBAAW,EAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,MAAM,oBAAoB,GACxB,MAAM,CAAC,WAAW,KAAK,yBAAW,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAA;IACvD,OAAO,cAAc,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;AAClD,CAAC,CAAA;AAVY,QAAA,WAAW,eAUvB;AAED,MAAM,cAAc,GAAG,CAAC,MAAkB,EAAE,OAAe,EAAU,EAAE;IACrE,IAAI,gBAAgB,GAAG,OAAO,CAAA;IAC9B,MAAM,CAAC,aAAa;SACjB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;SACtB,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,gBAAgB,GAAG,IAAI,CAAC,GAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;IACxD,CAAC,CAAC,CAAA;IAEJ,OAAO,gBAAgB,CAAA;AACzB,CAAC,CAAA;AAEM,MAAM,WAAW,GAAG,CAAC,MAAkB,EAAE,IAAY,EAAU,EAAE;IACtE,IAAI,aAAa,GAAG,IAAI,CAAA;IACxB,MAAM,CAAC,aAAa;SACjB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;SACtB,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,aAAa,GAAG,IAAI,CAAC,GAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;IAEJ,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AATY,QAAA,WAAW,eASvB"}
|
package/formatExample.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const formatText_1 = require("./format/formatText");
|
|
4
|
+
const lint_1 = require("./lint");
|
|
5
|
+
const content = `%put 'Hello';
|
|
6
|
+
%put 'World';
|
|
7
|
+
%macro somemacro()
|
|
8
|
+
%put 'test';
|
|
9
|
+
%mend;\r\n`;
|
|
6
10
|
console.log(content);
|
|
7
|
-
lint_1.lintText(content).then(
|
|
11
|
+
(0, lint_1.lintText)(content).then((diagnostics) => {
|
|
8
12
|
console.log('Before Formatting:');
|
|
9
13
|
console.table(diagnostics);
|
|
10
|
-
formatText_1.formatText(content).then(
|
|
11
|
-
lint_1.lintText(formattedText).then(
|
|
14
|
+
(0, formatText_1.formatText)(content).then((formattedText) => {
|
|
15
|
+
(0, lint_1.lintText)(formattedText).then((newDiagnostics) => {
|
|
12
16
|
console.log('After Formatting:');
|
|
13
17
|
console.log(formattedText);
|
|
14
18
|
console.table(newDiagnostics);
|
package/formatExample.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatExample.js","sourceRoot":"","sources":["../src/formatExample.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"formatExample.js","sourceRoot":"","sources":["../src/formatExample.ts"],"names":[],"mappings":";;AAAA,oDAAgD;AAChD,iCAAiC;AAEjC,MAAM,OAAO,GAAG;;;;WAIL,CAAA;AAEX,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AACpB,IAAA,eAAQ,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;IACrC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;IACjC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IAC1B,IAAA,uBAAU,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,EAAE;QACzC,IAAA,eAAQ,EAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,EAAE;YAC9C,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;YAChC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;YAC1B,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|