@sasjs/lint 2.4.0 → 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.
Files changed (103) hide show
  1. package/.all-contributorsrc +11 -1
  2. package/.github/dependabot.yml +1 -1
  3. package/.github/reviewer-lottery.yml +0 -2
  4. package/.github/workflows/assign-reviewer.yml +2 -2
  5. package/README.md +41 -37
  6. package/format/formatFile.d.ts +1 -1
  7. package/format/formatFile.js +24 -72
  8. package/format/formatFile.js.map +1 -1
  9. package/format/formatFolder.d.ts +1 -1
  10. package/format/formatFolder.js +36 -104
  11. package/format/formatFolder.js.map +1 -1
  12. package/format/formatProject.js +10 -45
  13. package/format/formatProject.js.map +1 -1
  14. package/format/formatText.d.ts +1 -1
  15. package/format/formatText.js +6 -46
  16. package/format/formatText.js.map +1 -1
  17. package/format/index.js +5 -1
  18. package/format/index.js.map +1 -1
  19. package/format/shared.js +16 -16
  20. package/format/shared.js.map +1 -1
  21. package/formatExample.js +10 -6
  22. package/formatExample.js.map +1 -1
  23. package/index.js +5 -1
  24. package/index.js.map +1 -1
  25. package/lint/index.js +5 -1
  26. package/lint/index.js.map +1 -1
  27. package/lint/lintFile.d.ts +1 -1
  28. package/lint/lintFile.js +12 -76
  29. package/lint/lintFile.js.map +1 -1
  30. package/lint/lintFolder.d.ts +1 -1
  31. package/lint/lintFolder.js +23 -114
  32. package/lint/lintFolder.js.map +1 -1
  33. package/lint/lintProject.js +10 -45
  34. package/lint/lintProject.js.map +1 -1
  35. package/lint/lintText.js +6 -40
  36. package/lint/lintText.js.map +1 -1
  37. package/lint/shared.js +24 -45
  38. package/lint/shared.js.map +1 -1
  39. package/lintExample.js +45 -5
  40. package/lintExample.js.map +1 -1
  41. package/package.json +3 -3
  42. package/rules/file/hasDoxygenHeader.js +29 -29
  43. package/rules/file/hasDoxygenHeader.js.map +1 -1
  44. package/rules/file/hasMacroNameInMend.js +59 -59
  45. package/rules/file/hasMacroNameInMend.js.map +1 -1
  46. package/rules/file/hasMacroParentheses.js +25 -27
  47. package/rules/file/hasMacroParentheses.js.map +1 -1
  48. package/rules/file/hasRequiredMacroOptions.js +20 -20
  49. package/rules/file/hasRequiredMacroOptions.js.map +1 -1
  50. package/rules/file/lineEndings.js +27 -27
  51. package/rules/file/lineEndings.js.map +1 -1
  52. package/rules/file/noNestedMacros.js +23 -23
  53. package/rules/file/noNestedMacros.js.map +1 -1
  54. package/rules/file/strictMacroDefinition.js +52 -57
  55. package/rules/file/strictMacroDefinition.js.map +1 -1
  56. package/rules/line/indentationMultiple.js +16 -16
  57. package/rules/line/indentationMultiple.js.map +1 -1
  58. package/rules/line/maxLineLength.js +16 -16
  59. package/rules/line/maxLineLength.js.map +1 -1
  60. package/rules/line/noEncodedPasswords.js +18 -18
  61. package/rules/line/noEncodedPasswords.js.map +1 -1
  62. package/rules/line/noGremlins.js +29 -69
  63. package/rules/line/noGremlins.js.map +1 -1
  64. package/rules/line/noTabs.js +19 -19
  65. package/rules/line/noTabs.js.map +1 -1
  66. package/rules/line/noTrailingSpaces.js +16 -16
  67. package/rules/line/noTrailingSpaces.js.map +1 -1
  68. package/rules/path/lowerCaseFileNames.js +15 -15
  69. package/rules/path/lowerCaseFileNames.js.map +1 -1
  70. package/rules/path/noSpacesInFileNames.js +15 -15
  71. package/rules/path/noSpacesInFileNames.js.map +1 -1
  72. package/types/LintConfig.js +28 -68
  73. package/types/LintConfig.js.map +1 -1
  74. package/types/index.js +5 -1
  75. package/types/index.js.map +1 -1
  76. package/utils/asyncForEach.js +4 -46
  77. package/utils/asyncForEach.js.map +1 -1
  78. package/utils/getColumnNumber.js +3 -3
  79. package/utils/getColumnNumber.js.map +1 -1
  80. package/utils/getDataSectionsDetail.js +16 -38
  81. package/utils/getDataSectionsDetail.js.map +1 -1
  82. package/utils/getHeaderLinesCount.js +8 -30
  83. package/utils/getHeaderLinesCount.js.map +1 -1
  84. package/utils/getIndicesOf.js +3 -4
  85. package/utils/getIndicesOf.js.map +1 -1
  86. package/utils/getLintConfig.js +14 -52
  87. package/utils/getLintConfig.js.map +1 -1
  88. package/utils/getProjectRoot.js +22 -59
  89. package/utils/getProjectRoot.js.map +1 -1
  90. package/utils/index.js +5 -1
  91. package/utils/index.js.map +1 -1
  92. package/utils/isIgnored.d.ts +1 -1
  93. package/utils/isIgnored.js +20 -67
  94. package/utils/isIgnored.js.map +1 -1
  95. package/utils/listSasFiles.js +5 -39
  96. package/utils/listSasFiles.js.map +1 -1
  97. package/utils/parseMacros.d.ts +1 -1
  98. package/utils/parseMacros.js +29 -50
  99. package/utils/parseMacros.js.map +1 -1
  100. package/utils/splitText.js +4 -4
  101. package/utils/splitText.js.map +1 -1
  102. package/utils/trimComments.js +8 -10
  103. package/utils/trimComments.js.map +1 -1
@@ -101,6 +101,15 @@
101
101
  "test",
102
102
  "review"
103
103
  ]
104
+ },
105
+ {
106
+ "login": "McGwire-Jones",
107
+ "name": "McGwire-Jones",
108
+ "avatar_url": "https://avatars.githubusercontent.com/u/51411005?v=4",
109
+ "profile": "https://github.com/McGwire-Jones",
110
+ "contributions": [
111
+ "code"
112
+ ]
104
113
  }
105
114
  ],
106
115
  "contributorsPerLine": 7,
@@ -109,5 +118,6 @@
109
118
  "repoType": "github",
110
119
  "repoHost": "https://github.com",
111
120
  "skipCi": true,
112
- "commitConvention": "none"
121
+ "commitConvention": "none",
122
+ "commitType": "docs"
113
123
  }
@@ -4,4 +4,4 @@ updates:
4
4
  directory: '/'
5
5
  schedule:
6
6
  interval: monthly
7
- open-pull-requests-limit: 10
7
+ open-pull-requests-limit: 3
@@ -2,8 +2,6 @@ groups:
2
2
  - name: SASjs Devs # name of the group
3
3
  reviewers: 1 # how many reviewers do you want to assign?
4
4
  usernames: # github usernames of the reviewers
5
- - krishna-acondy
6
5
  - YuryShkoda
7
- - saadjutt01
8
6
  - medjedovicm
9
7
  - allanbowe
@@ -8,6 +8,6 @@ jobs:
8
8
  runs-on: ubuntu-latest
9
9
  steps:
10
10
  - uses: actions/checkout@v2
11
- - uses: uesteibar/reviewer-lottery@v1
11
+ - uses: uesteibar/reviewer-lottery@v3
12
12
  with:
13
- repo-token: ${{ secrets.GH_TOKEN }}
13
+ repo-token: ${{ secrets.GH_TOKEN }}
package/README.md CHANGED
@@ -21,10 +21,11 @@ Configuration is via a `.sasjslint` file with the following structure (these are
21
21
 
22
22
  ```json
23
23
  {
24
- "noEncodedPasswords": true,
25
24
  "hasDoxygenHeader": true,
26
25
  "hasMacroNameInMend": true,
27
26
  "hasMacroParentheses": true,
27
+ "hasRequiredMacroOptions": false,
28
+ "requiredMacroOptions": ["SECURE", "SRC"],
28
29
  "ignoreList": ["sasjsbuild/", "sasjsresults/"],
29
30
  "indentationMultiple": 2,
30
31
  "lineEndings": "off",
@@ -32,6 +33,7 @@ Configuration is via a `.sasjslint` file with the following structure (these are
32
33
  "maxDataLineLength": 80,
33
34
  "maxHeaderLineLength": 80,
34
35
  "maxLineLength": 80,
36
+ "noEncodedPasswords": true,
35
37
  "noNestedMacros": true,
36
38
  "noGremlins": true,
37
39
  "noSpacesInFileNames": true,
@@ -88,13 +90,6 @@ If creating a new value, use `{lineEnding}` instead of `\n`, eg as follows:
88
90
  }
89
91
  ```
90
92
 
91
- ### noEncodedPasswords
92
-
93
- This rule will highlight any rows that contain a `{sas00X}` type password, or `{sasenc}`. These passwords (especially 001 and 002) are NOT secure, and should NEVER be pushed to source control or saved to the filesystem without special permissions applied.
94
-
95
- - Default: true
96
- - Severity: ERROR
97
-
98
93
  ### hasDoxygenHeader
99
94
 
100
95
  The SASjs framework recommends the use of Doxygen headers for describing all types of SAS program. This check will identify files where a doxygen header does not begin in the first line.
@@ -116,6 +111,21 @@ As per the example [here](https://github.com/sasjs/lint/issues/20), macros defin
116
111
  - Default: true
117
112
  - Severity: WARNING
118
113
 
114
+ ### hasRequiredMacroOptions
115
+
116
+ This will require macros to have the options listed as "requiredMacroOptions." This is helpful if you want to ensure all macros are SECURE.
117
+
118
+ - Default: false
119
+ - severity: WARNING
120
+
121
+ Example
122
+ ```json
123
+ {
124
+ "hasRequiredMacroOptions": true,
125
+ "requiredMacroOptions": ["SECURE", "SRC"]
126
+ }
127
+ ```
128
+
119
129
  ### ignoreList
120
130
 
121
131
  There may be specific files (or folders) that are not good candidates for linting. Simply list them in this array and they will be ignored. In addition, any files in the project `.gitignore` file will also be ignored.
@@ -204,6 +214,13 @@ See also:
204
214
  - [maxDataLineLength](#maxdatalinelength)
205
215
  - [maxHeaderLineLength](#maxheaderlinelength)
206
216
 
217
+ ### noEncodedPasswords
218
+
219
+ This rule will highlight any rows that contain a `{sas00X}` type password, or `{sasenc}`. These passwords (especially 001 and 002) are NOT secure, and should NEVER be pushed to source control or saved to the filesystem without special permissions applied.
220
+
221
+ - Default: true
222
+ - Severity: ERROR
223
+
207
224
  ### noGremlins
208
225
 
209
226
  Capture zero-width whitespace and other non-standard characters. The logic is borrowed from the [VSCode Gremlins Extension](https://github.com/nhoizey/vscode-gremlins) - if you are looking for more advanced gremlin zapping capabilities, we highly recommend to use their extension instead.
@@ -254,20 +271,6 @@ This will highlight lines with trailing spaces. Trailing spaces serve no useful
254
271
  - Default: true
255
272
  - severity: WARNING
256
273
 
257
- ### hasRequiredMacroOptions
258
-
259
- This will require macros to have the options listed as "requiredMacroOptions." This is helpful if you want to ensure all macros are SECURE.
260
-
261
- - Default: false
262
- - severity: WARNING
263
-
264
- Example
265
- ```json
266
- {
267
- "hasRequiredMacroOptions": true,
268
- "requiredMacroOptions": ["SECURE", "SRC"]
269
- }
270
- ```
271
274
 
272
275
  ## severityLevel
273
276
 
@@ -322,9 +325,7 @@ Contact [Allan Bowe](https://www.linkedin.com/in/allanbowe/) for further details
322
325
  # Contributors ✨
323
326
 
324
327
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
325
-
326
- [![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors-)
327
-
328
+ [![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors-)
328
329
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
329
330
 
330
331
  Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
@@ -333,18 +334,21 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
333
334
  <!-- prettier-ignore-start -->
334
335
  <!-- markdownlint-disable -->
335
336
  <table>
336
- <tr>
337
- <td align="center"><a href="https://github.com/Carus11"><img src="https://avatars.githubusercontent.com/u/4925828?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Carus Kyle</b></sub></a><br /><a href="#ideas-Carus11" title="Ideas, Planning, & Feedback">🤔</a></td>
338
- <td align="center"><a href="https://github.com/allanbowe"><img src="https://avatars.githubusercontent.com/u/4420615?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Allan Bowe</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=allanbowe" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=allanbowe" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Aallanbowe" title="Reviewed Pull Requests">👀</a> <a href="#video-allanbowe" title="Videos">📹</a> <a href="https://github.com/sasjs/lint/commits?author=allanbowe" title="Documentation">📖</a></td>
339
- <td align="center"><a href="https://www.erudicat.com/"><img src="https://avatars.githubusercontent.com/u/25773492?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yury Shkoda</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=YuryShkoda" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=YuryShkoda" title="Tests">⚠️</a> <a href="#projectManagement-YuryShkoda" title="Project Management">📆</a> <a href="#video-YuryShkoda" title="Videos">📹</a> <a href="https://github.com/sasjs/lint/commits?author=YuryShkoda" title="Documentation">📖</a></td>
340
- <td align="center"><a href="https://krishna-acondy.io/"><img src="https://avatars.githubusercontent.com/u/2980428?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Krishna Acondy</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=krishna-acondy" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=krishna-acondy" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Akrishna-acondy" title="Reviewed Pull Requests">👀</a> <a href="#infra-krishna-acondy" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#platform-krishna-acondy" title="Packaging/porting to new platform">📦</a> <a href="#maintenance-krishna-acondy" title="Maintenance">🚧</a> <a href="#content-krishna-acondy" title="Content">🖋</a></td>
341
- <td align="center"><a href="https://github.com/saadjutt01"><img src="https://avatars.githubusercontent.com/u/8914650?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Muhammad Saad </b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=saadjutt01" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=saadjutt01" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Asaadjutt01" title="Reviewed Pull Requests">👀</a> <a href="#mentoring-saadjutt01" title="Mentoring">🧑‍🏫</a> <a href="https://github.com/sasjs/lint/commits?author=saadjutt01" title="Documentation">📖</a></td>
342
- <td align="center"><a href="https://github.com/sabhas"><img src="https://avatars.githubusercontent.com/u/82647447?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sabir Hassan</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=sabhas" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=sabhas" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Asabhas" title="Reviewed Pull Requests">👀</a> <a href="#ideas-sabhas" title="Ideas, Planning, & Feedback">🤔</a></td>
343
- <td align="center"><a href="https://github.com/medjedovicm"><img src="https://avatars.githubusercontent.com/u/18329105?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mihajlo Medjedovic</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=medjedovicm" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=medjedovicm" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Amedjedovicm" title="Reviewed Pull Requests">👀</a> <a href="#infra-medjedovicm" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
344
- </tr>
345
- <tr>
346
- <td align="center"><a href="https://github.com/VladislavParhomchik"><img src="https://avatars.githubusercontent.com/u/83717836?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vladislav Parhomchik</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=VladislavParhomchik" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3AVladislavParhomchik" title="Reviewed Pull Requests">👀</a></td>
347
- </tr>
337
+ <tbody>
338
+ <tr>
339
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/Carus11"><img src="https://avatars.githubusercontent.com/u/4925828?v=4?s=100" width="100px;" alt="Carus Kyle"/><br /><sub><b>Carus Kyle</b></sub></a><br /><a href="#ideas-Carus11" title="Ideas, Planning, & Feedback">🤔</a></td>
340
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/allanbowe"><img src="https://avatars.githubusercontent.com/u/4420615?v=4?s=100" width="100px;" alt="Allan Bowe"/><br /><sub><b>Allan Bowe</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=allanbowe" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=allanbowe" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Aallanbowe" title="Reviewed Pull Requests">👀</a> <a href="#video-allanbowe" title="Videos">📹</a> <a href="https://github.com/sasjs/lint/commits?author=allanbowe" title="Documentation">📖</a></td>
341
+ <td align="center" valign="top" width="14.28%"><a href="https://www.erudicat.com/"><img src="https://avatars.githubusercontent.com/u/25773492?v=4?s=100" width="100px;" alt="Yury Shkoda"/><br /><sub><b>Yury Shkoda</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=YuryShkoda" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=YuryShkoda" title="Tests">⚠️</a> <a href="#projectManagement-YuryShkoda" title="Project Management">📆</a> <a href="#video-YuryShkoda" title="Videos">📹</a> <a href="https://github.com/sasjs/lint/commits?author=YuryShkoda" title="Documentation">📖</a></td>
342
+ <td align="center" valign="top" width="14.28%"><a href="https://krishna-acondy.io/"><img src="https://avatars.githubusercontent.com/u/2980428?v=4?s=100" width="100px;" alt="Krishna Acondy"/><br /><sub><b>Krishna Acondy</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=krishna-acondy" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=krishna-acondy" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Akrishna-acondy" title="Reviewed Pull Requests">👀</a> <a href="#infra-krishna-acondy" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#platform-krishna-acondy" title="Packaging/porting to new platform">📦</a> <a href="#maintenance-krishna-acondy" title="Maintenance">🚧</a> <a href="#content-krishna-acondy" title="Content">🖋</a></td>
343
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/saadjutt01"><img src="https://avatars.githubusercontent.com/u/8914650?v=4?s=100" width="100px;" alt="Muhammad Saad "/><br /><sub><b>Muhammad Saad </b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=saadjutt01" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=saadjutt01" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Asaadjutt01" title="Reviewed Pull Requests">👀</a> <a href="#mentoring-saadjutt01" title="Mentoring">🧑‍🏫</a> <a href="https://github.com/sasjs/lint/commits?author=saadjutt01" title="Documentation">📖</a></td>
344
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/sabhas"><img src="https://avatars.githubusercontent.com/u/82647447?v=4?s=100" width="100px;" alt="Sabir Hassan"/><br /><sub><b>Sabir Hassan</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=sabhas" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=sabhas" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Asabhas" title="Reviewed Pull Requests">👀</a> <a href="#ideas-sabhas" title="Ideas, Planning, & Feedback">🤔</a></td>
345
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/medjedovicm"><img src="https://avatars.githubusercontent.com/u/18329105?v=4?s=100" width="100px;" alt="Mihajlo Medjedovic"/><br /><sub><b>Mihajlo Medjedovic</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=medjedovicm" title="Code">💻</a> <a href="https://github.com/sasjs/lint/commits?author=medjedovicm" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3Amedjedovicm" title="Reviewed Pull Requests">👀</a> <a href="#infra-medjedovicm" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
346
+ </tr>
347
+ <tr>
348
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/VladislavParhomchik"><img src="https://avatars.githubusercontent.com/u/83717836?v=4?s=100" width="100px;" alt="Vladislav Parhomchik"/><br /><sub><b>Vladislav Parhomchik</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=VladislavParhomchik" title="Tests">⚠️</a> <a href="https://github.com/sasjs/lint/pulls?q=is%3Apr+reviewed-by%3AVladislavParhomchik" title="Reviewed Pull Requests">👀</a></td>
349
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/McGwire-Jones"><img src="https://avatars.githubusercontent.com/u/51411005?v=4?s=100" width="100px;" alt="McGwire-Jones"/><br /><sub><b>McGwire-Jones</b></sub></a><br /><a href="https://github.com/sasjs/lint/commits?author=McGwire-Jones" title="Code">💻</a></td>
350
+ </tr>
351
+ </tbody>
348
352
  </table>
349
353
 
350
354
  <!-- markdownlint-restore -->
@@ -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 | undefined) => Promise<FormatResult>;
9
+ export declare const formatFile: (filePath: string, configuration?: LintConfig) => Promise<FormatResult>;
@@ -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
- var file_1 = require("@sasjs/utils/file");
41
- var lint_1 = require("../lint");
42
- var getLintConfig_1 = require("../utils/getLintConfig");
43
- var shared_1 = require("./shared");
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
- var formatFile = function (filePath, configuration) { return __awaiter(void 0, void 0, void 0, function () {
51
- var config, _a, diagnosticsBeforeFormat, diagnosticsCountBeforeFormat, text, formattedText, diagnosticsAfterFormat, diagnosticsCountAfterFormat, fixedDiagnosticsCount, updatedFilePaths;
52
- return __generator(this, function (_b) {
53
- switch (_b.label) {
54
- case 0:
55
- _a = configuration;
56
- if (_a) return [3 /*break*/, 2];
57
- return [4 /*yield*/, getLintConfig_1.getLintConfig()];
58
- case 1:
59
- _a = (_b.sent());
60
- _b.label = 2;
61
- case 2:
62
- config = _a;
63
- return [4 /*yield*/, lint_1.lintFile(filePath, config)];
64
- case 3:
65
- diagnosticsBeforeFormat = _b.sent();
66
- diagnosticsCountBeforeFormat = diagnosticsBeforeFormat.length;
67
- return [4 /*yield*/, file_1.readFile(filePath)];
68
- case 4:
69
- text = _b.sent();
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
@@ -1 +1 @@
1
- {"version":3,"file":"formatFile.js","sourceRoot":"","sources":["../../src/format/formatFile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAwD;AACxD,gCAAkC;A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M,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"}
@@ -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 | undefined) => Promise<FormatResult>;
9
+ export declare const formatFolder: (folderPath: string, configuration?: LintConfig) => Promise<FormatResult>;
@@ -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
- var file_1 = require("@sasjs/utils/file");
44
- var path_1 = __importDefault(require("path"));
45
- var lint_1 = require("../lint");
46
- var asyncForEach_1 = require("../utils/asyncForEach");
47
- var getLintConfig_1 = require("../utils/getLintConfig");
48
- var listSasFiles_1 = require("../utils/listSasFiles");
49
- var formatFile_1 = require("./formatFile");
50
- var excludeFolders = [
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
- var formatFolder = function (folderPath, configuration) { return __awaiter(void 0, void 0, void 0, function () {
65
- var config, _a, diagnosticsBeforeFormat, diagnosticsCountBeforeFormat, fileNames, subFolders, diagnosticsAfterFormat, diagnosticsCountAfterFormat, fixedDiagnosticsCount, updatedFilePaths;
66
- return __generator(this, function (_b) {
67
- switch (_b.label) {
68
- case 0:
69
- _a = configuration;
70
- if (_a) return [3 /*break*/, 2];
71
- return [4 /*yield*/, getLintConfig_1.getLintConfig()];
72
- case 1:
73
- _a = (_b.sent());
74
- _b.label = 2;
75
- case 2:
76
- config = _a;
77
- return [4 /*yield*/, lint_1.lintFolder(folderPath)];
78
- case 3:
79
- diagnosticsBeforeFormat = _b.sent();
80
- diagnosticsCountBeforeFormat = Array.from(diagnosticsBeforeFormat.values()).reduce(function (a, b) { return a + b.length; }, 0);
81
- return [4 /*yield*/, listSasFiles_1.listSasFiles(folderPath)];
82
- case 4:
83
- fileNames = _b.sent();
84
- return [4 /*yield*/, asyncForEach_1.asyncForEach(fileNames, function (fileName) { return __awaiter(void 0, void 0, void 0, function () {
85
- var filePath;
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":";;;;;;;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,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"}
@@ -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
- var getProjectRoot_1 = require("../utils/getProjectRoot");
41
- var formatFolder_1 = require("./formatFolder");
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
- var formatProject = function () { return __awaiter(void 0, void 0, void 0, function () {
47
- var projectRoot;
48
- return __generator(this, function (_a) {
49
- switch (_a.label) {
50
- case 0: return [4 /*yield*/, getProjectRoot_1.getProjectRoot()];
51
- case 1:
52
- projectRoot = (_a.sent()) || process.currentDir;
53
- if (!projectRoot) {
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0DAAwD;AACxD,+CAA6C;AAE7C;;;GAGG;AACI,IAAM,aAAa,GAAG;;;;oBACN,qBAAM,+BAAc,EAAE,EAAA;;gBAArC,WAAW,GAAG,CAAC,SAAsB,CAAC,IAAI,OAAO,CAAC,UAAU;gBAClE,IAAI,CAAC,WAAW,EAAE;oBAChB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;iBACrD;gBAED,OAAO,CAAC,IAAI,CAAC,qCAAmC,WAAa,CAAC,CAAA;gBAEvD,qBAAM,2BAAY,CAAC,WAAW,CAAC,EAAA;oBAAtC,sBAAO,SAA+B,EAAA;;;KACvC,CAAA;AATY,QAAA,aAAa,iBASzB"}
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"}
@@ -1,2 +1,2 @@
1
1
  import { LintConfig } from '../types';
2
- export declare const formatText: (text: string, configuration?: LintConfig | undefined) => Promise<string>;
2
+ export declare const formatText: (text: string, configuration?: LintConfig) => Promise<string>;