Skip to content

Commit f84ed98

Browse files
committed
prettier
1 parent f9f5b38 commit f84ed98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+319
-633
lines changed

.github/workflows/test.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name: RunTests
22
on:
33
push:
4-
branches: [ "main", "develop" ]
4+
branches: ['main', 'develop']
55
pull_request:
6-
branches: [ "main" ]
6+
branches: ['main']
77
types: [opened, reopened, edited]
88

99
jobs:
1010
RunTestSuite:
1111
name: Run Test Suite
1212
runs-on: ubuntu-latest
13-
13+
1414
steps:
1515
- name: Checkout repo and submodules
1616
uses: actions/checkout@v4
@@ -26,28 +26,28 @@ jobs:
2626
- name: Run tests
2727
run: npm run test:ci
2828
env:
29-
NODE_OPTIONS: "--experimental-vm-modules"
29+
NODE_OPTIONS: '--experimental-vm-modules'
3030

3131
- name: Publish Test Results
3232
uses: EnricoMi/[email protected]
3333
if: always()
3434
with:
3535
files: ./coverage/test-report/test-report.xml
36-
36+
3737
- name: Publish Code Coverage
3838
uses: irongut/[email protected]
3939
with:
4040
filename: coverage/cobertura-coverage.xml
4141
badge: true
4242
format: markdown
4343
output: both
44-
44+
4545
- name: Add Coverage PR Comment
4646
uses: marocchino/sticky-pull-request-comment@v2
4747
if: github.event_name == 'pull_request'
4848
with:
4949
recreate: true
5050
path: code-coverage-results.md
51-
51+
5252
- name: Write to job Summary
5353
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"semi": true,
33
"singleQuote": true,
44
"trailingComma": "all",
5-
"printWidth": 80,
5+
"printWidth": 110,
66
"tabWidth": 2
77
}

README.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,11 @@ const CONFIG_PATH = join(__dirname, './config.toml');
2424

2525
const INPUT_PATH = join(__dirname, 'files', 'input_data.csv');
2626
const OUTPUT_PATH = join(__dirname, 'output', 'output.csv');
27-
const VALIDATION_ERRORS_PATH = join(
28-
__dirname,
29-
'output',
30-
'validation_errors.csv',
31-
);
27+
const VALIDATION_ERRORS_PATH = join(__dirname, 'output', 'validation_errors.csv');
3228

3329
// load configuration file
3430
const configLoadResult = loadConfig(CONFIG_PATH, REGION);
35-
if (!configLoadResult.success)
36-
throw new Error('unable to load configuration file.');
31+
if (!configLoadResult.success) throw new Error('unable to load configuration file.');
3732

3833
const config = configLoadResult.config;
3934

@@ -46,9 +41,7 @@ const preprocessResult = await preprocessFile({
4641
});
4742

4843
if (!preprocessResult.isValid)
49-
throw new Error(
50-
'Validation errors found in input file, review error file output.',
51-
);
44+
throw new Error('Validation errors found in input file, review error file output.');
5245

5346
// validate the input file against all configured validation rules.
5447
const processFileResult = await processFile({

jest.ci.config.js

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
22
export default {
3-
// [...]
4-
extensionsToTreatAsEsm: ['.ts'],
5-
moduleFileExtensions: ["ts", "js"],
6-
moduleNameMapper: {
7-
'^(\\.{1,2}/.*)\\.js$': '$1',
8-
},
9-
transformIgnorePatterns: ['^.+\\.js$'],
10-
transform: {
11-
// '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
12-
// '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
13-
'^.+\\.tsx?$': [
14-
'ts-jest',
15-
{
16-
useESM: true,
17-
},
18-
],
19-
},
20-
// reporters
21-
reporters: [
22-
'default',
23-
[
24-
'jest-junit',
25-
{
26-
outputDirectory: './coverage/test-report',
27-
outputName: 'test-report.xml',
28-
},
29-
],
3+
// [...]
4+
extensionsToTreatAsEsm: ['.ts'],
5+
moduleFileExtensions: ['ts', 'js'],
6+
moduleNameMapper: {
7+
'^(\\.{1,2}/.*)\\.js$': '$1',
8+
},
9+
transformIgnorePatterns: ['^.+\\.js$'],
10+
transform: {
11+
// '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
12+
// '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
13+
'^.+\\.tsx?$': [
14+
'ts-jest',
15+
{
16+
useESM: true,
17+
},
3018
],
31-
// coverage directory
32-
coverageDirectory: './coverage',
33-
collectCoverage: true,
34-
coverageReporters: ["cobertura", "lcov", "html"],
19+
},
20+
// reporters
21+
reporters: [
22+
'default',
23+
[
24+
'jest-junit',
25+
{
26+
outputDirectory: './coverage/test-report',
27+
outputName: 'test-report.xml',
28+
},
29+
],
30+
],
31+
// coverage directory
32+
coverageDirectory: './coverage',
33+
collectCoverage: true,
34+
coverageReporters: ['cobertura', 'lcov', 'html'],
3535

36-
verbose: true,
37-
}
36+
verbose: true,
37+
};

jest.config.js

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
22
export default {
3-
// [...]
4-
extensionsToTreatAsEsm: ['.ts'],
5-
moduleFileExtensions: ["ts", "js"],
6-
moduleNameMapper: {
7-
'^(\\.{1,2}/.*)\\.js$': '$1',
8-
},
9-
transformIgnorePatterns: ['^.+\\.js$'],
10-
transform: {
11-
// '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
12-
// '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
13-
'^.+\\.tsx?$': [
14-
'ts-jest',
15-
{
16-
useESM: true,
17-
},
18-
],
19-
},
20-
// reporters
21-
reporters: [
22-
'default',
23-
[
24-
'jest-junit',
25-
{
26-
outputDirectory: './coverage/test-report',
27-
outputName: 'test-report.xml',
28-
},
29-
],
3+
// [...]
4+
extensionsToTreatAsEsm: ['.ts'],
5+
moduleFileExtensions: ['ts', 'js'],
6+
moduleNameMapper: {
7+
'^(\\.{1,2}/.*)\\.js$': '$1',
8+
},
9+
transformIgnorePatterns: ['^.+\\.js$'],
10+
transform: {
11+
// '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
12+
// '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
13+
'^.+\\.tsx?$': [
14+
'ts-jest',
15+
{
16+
useESM: true,
17+
},
3018
],
31-
// coverage directory
32-
coverageDirectory: './coverage',
33-
collectCoverage: true,
34-
coverageReporters: ["cobertura", "lcov", "html"],
19+
},
20+
// reporters
21+
reporters: [
22+
'default',
23+
[
24+
'jest-junit',
25+
{
26+
outputDirectory: './coverage/test-report',
27+
outputName: 'test-report.xml',
28+
},
29+
],
30+
],
31+
// coverage directory
32+
coverageDirectory: './coverage',
33+
collectCoverage: true,
34+
coverageReporters: ['cobertura', 'lcov', 'html'],
3535

36-
verbose: true,
37-
}
36+
verbose: true,
37+
};

src/config/Config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ export namespace Config {
1919
static: string[];
2020
reference: string[];
2121
}
22-
export type StringBasedSalt = { source: 'STRING'; value: string }
22+
export type StringBasedSalt = { source: 'STRING'; value: string };
2323
export type FileBasedSalt = {
2424
source: 'FILE';
2525
validator_regex?: string;
2626
value: {
2727
win32?: string;
2828
darwin?: string;
2929
linux?: string;
30-
}
30+
};
3131
};
3232
export interface Options {
3333
isBackup?: boolean;
@@ -46,9 +46,9 @@ export namespace Config {
4646
algorithm: {
4747
columns: AlgorithmColumns;
4848
hash: {
49-
strategy: 'SHA256'
49+
strategy: 'SHA256';
5050
};
51-
salt: StringBasedSalt | FileBasedSalt
51+
salt: StringBasedSalt | FileBasedSalt;
5252
};
5353
destination: ColumnMap;
5454
destination_map: ColumnMap;

src/config/appConfig.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ export function loadAppConfig(configPath: string) {
3838
log('Loading Application config from', configPath);
3939

4040
// attempt to read the file
41-
const configData = attemptToReadTOMLData<AppConfigData>(
42-
configPath,
43-
APP_CONFIG_ENCODING,
44-
);
41+
const configData = attemptToReadTOMLData<AppConfigData>(configPath, APP_CONFIG_ENCODING);
4542

4643
// if cannot be read we assume default application configuration
4744
if (!configData) {

src/config/configStore.ts

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ import Debug from 'debug';
2222
const log = Debug('CID:ConfigStore');
2323

2424
import { loadConfig, CONFIG_FILE_ENCODING } from './loadConfig.js';
25-
import {
26-
loadAppConfig,
27-
saveAppConfig,
28-
DEFAULT_APP_CONFIG,
29-
} from './appConfig.js';
25+
import { loadAppConfig, saveAppConfig, DEFAULT_APP_CONFIG } from './appConfig.js';
3026

3127
import type { AppConfigData, Config } from './Config.js';
3228

@@ -109,10 +105,7 @@ export class ConfigStore {
109105
this.appConfig = loadAppConfig(this.getAppConfigFilePath());
110106

111107
// attempt to load the default app config
112-
const userConfigLoad = loadConfig(
113-
this.getConfigFilePath(),
114-
this.getRegion(),
115-
);
108+
const userConfigLoad = loadConfig(this.getConfigFilePath(), this.getRegion());
116109

117110
// if the load succesds we have a valid config -- use it as a
118111
// user-provided one
@@ -122,15 +115,10 @@ export class ConfigStore {
122115
return;
123116
}
124117

125-
console.log(
126-
'User config validation not successful - attempting to load backup config',
127-
);
118+
console.log('User config validation not successful - attempting to load backup config');
128119
// if the default config load failed use the backup default
129120
// from the app distribution
130-
const backupConfigLoad = loadConfig(
131-
this.getBackupConfigFilePath(),
132-
this.getRegion(),
133-
);
121+
const backupConfigLoad = loadConfig(this.getBackupConfigFilePath(), this.getRegion());
134122

135123
// if the load succesds we have a valid config -- use it as
136124
// a config-from-backup
@@ -190,9 +178,7 @@ export class ConfigStore {
190178
// This method does not save the backup as the user config, only deletes the user config file
191179
removeUserConfig() {
192180
// attempt to load the backup config
193-
console.log(
194-
'[removeUserConfig] Attempting to remove user configuration and replace with backup.',
195-
);
181+
console.log('[removeUserConfig] Attempting to remove user configuration and replace with backup.');
196182

197183
// if the current config is already a backup config don't do anything
198184
if (this.isCurrentConfigBackup()) {
@@ -202,10 +188,7 @@ export class ConfigStore {
202188
}
203189

204190
console.log('[removeUserConfig] Trying to load backup config file');
205-
const backupConfigLoad = loadConfig(
206-
this.getBackupConfigFilePath(),
207-
this.getRegion(),
208-
);
191+
const backupConfigLoad = loadConfig(this.getBackupConfigFilePath(), this.getRegion());
209192

210193
// if failed return the error message (do not delete the user config yet)
211194
if (!backupConfigLoad.success) {
@@ -220,9 +203,7 @@ export class ConfigStore {
220203
}
221204

222205
// if successful use the loaded backup configuration
223-
console.log(
224-
'[removeUserConfig] Backup config validation success - using it as config',
225-
);
206+
console.log('[removeUserConfig] Backup config validation success - using it as config');
226207
backupConfigLoad.config.isBackup = true;
227208
this.useBackupConfig(backupConfigLoad.config);
228209

@@ -284,11 +265,7 @@ export class ConfigStore {
284265
}
285266

286267
_currentSignature() {
287-
if (
288-
this.data &&
289-
this.data.signature &&
290-
this.data.signature.config_signature
291-
) {
268+
if (this.data && this.data.signature && this.data.signature.config_signature) {
292269
return this.data.signature.config_signature;
293270
}
294271
return 'INVALID CONFIG, NO SIGNATURE';
@@ -310,6 +287,6 @@ export class ConfigStore {
310287
}
311288

312289
export function makeConfigStore(storeConfig: ConfigStorePaths) {
313-
if (!storeConfig) throw new Error(`ConfigStore params MUST be provided.`)
290+
if (!storeConfig) throw new Error(`ConfigStore params MUST be provided.`);
314291
return new ConfigStore(storeConfig);
315292
}

0 commit comments

Comments
 (0)