Skip to content

Commit

Permalink
Fix prettier update
Browse files Browse the repository at this point in the history
  • Loading branch information
kristiandupont committed Jul 12, 2023
1 parent 2ddb37f commit 1cb8106
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function main() {
console.info(`${chalk.greenBright('schema-lint')}`);
const configFile = path.join(
process.cwd(),
options.config || '.schemalintrc.js'
options.config || '.schemalintrc.js',
);

try {
Expand Down
14 changes: 7 additions & 7 deletions src/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as builtinRules from './rules';

function consoleReporter({ rule, identifier, message }) {
console.error(
`${chalk.yellow(identifier)}: error ${chalk.red(rule)} : ${message}`
`${chalk.yellow(identifier)}: error ${chalk.red(rule)} : ${message}`,
);
}

Expand Down Expand Up @@ -41,14 +41,14 @@ export async function processDatabase({
const pluginRules = plugins.map((p) => require(path.join(process.cwd(), p)));
const allRules = [builtinRules, ...pluginRules].reduce(
(acc, elem) => ({ ...acc, ...elem }),
{}
{},
);
const registeredRules = indexBy(prop('name'), values(allRules));

console.info(
`Connecting to ${chalk.greenBright(connection.database)} on ${
connection.host
}`
}`,
);

const ignoreMatchers = ignores.map((i) => (rule, identifier) => {
Expand All @@ -60,8 +60,8 @@ export async function processDatabase({
} else {
throw new Error(
`Ignore object is missing a rule or rulePattern property: ${JSON.stringify(
i
)}`
i,
)}`,
);
}

Expand All @@ -73,8 +73,8 @@ export async function processDatabase({
} else {
throw new Error(
`Ignore object is missing an identifier or identifierPattern property: ${JSON.stringify(
i
)}`
i,
)}`,
);
}

Expand Down
24 changes: 12 additions & 12 deletions src/rules/nameCasing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ describe('nameCasing', () => {
identifier: 'schema.Th-IsIsNoSnA_kECaSE',
message: `The table Th-IsIsNoSnA_kECaSE seems to be mixed-cased rather than ${param}-cased.`,
suggestedMigration: `ALTER TABLE "Th-IsIsNoSnA_kECaSE" RENAME TO "${expected1}";`,
})
}),
);
expect(mockReporter).toBeCalledWith(
expect.objectContaining({
rule: 'name-casing',
identifier: 'schema.neit_he-rIsThis',
message: `The table neit_he-rIsThis seems to be mixed-cased rather than ${param}-cased.`,
suggestedMigration: `ALTER TABLE "neit_he-rIsThis" RENAME TO "${expected2}";`,
})
}),
);
}
},
);

test.each`
Expand Down Expand Up @@ -102,17 +102,17 @@ describe('nameCasing', () => {
identifier: 'schema.Th-IsIsNoSnA_kECaSE',
message: `The view Th-IsIsNoSnA_kECaSE seems to be mixed-cased rather than ${param}-cased.`,
suggestedMigration: `ALTER VIEW "Th-IsIsNoSnA_kECaSE" RENAME TO "${expected1}";`,
})
}),
);
expect(mockReporter).toBeCalledWith(
expect.objectContaining({
rule: 'name-casing',
identifier: 'schema.neit_he-rIsThis',
message: `The view neit_he-rIsThis seems to be mixed-cased rather than ${param}-cased.`,
suggestedMigration: `ALTER VIEW "neit_he-rIsThis" RENAME TO "${expected2}";`,
})
}),
);
}
},
);

test.each`
Expand Down Expand Up @@ -159,17 +159,17 @@ describe('nameCasing', () => {
identifier: 'schema.one_table.Th-IsIsNoSnA_kECaSE',
message: `The column Th-IsIsNoSnA_kECaSE on the table one_table seems to be mixed-cased rather than ${param}-cased.`,
suggestedMigration: `ALTER TABLE "one_table" RENAME COLUMN "Th-IsIsNoSnA_kECaSE" TO "${expected1}";`,
})
}),
);
expect(mockReporter).toBeCalledWith(
expect.objectContaining({
rule: 'name-casing',
identifier: 'schema.two_table.neit_he-rIsThis',
message: `The column neit_he-rIsThis on the table two_table seems to be mixed-cased rather than ${param}-cased.`,
suggestedMigration: `ALTER TABLE "two_table" RENAME COLUMN "neit_he-rIsThis" TO "${expected2}";`,
})
}),
);
}
},
);

test.each`
Expand Down Expand Up @@ -216,16 +216,16 @@ describe('nameCasing', () => {
identifier: 'schema.one_view.Th-IsIsNoSnA_kECaSE',
message: `The column Th-IsIsNoSnA_kECaSE on the view one_view seems to be mixed-cased rather than ${param}-cased.`,
suggestedMigration: `ALTER VIEW "one_view" RENAME COLUMN "Th-IsIsNoSnA_kECaSE" TO "${expected1}";`,
})
}),
);
expect(mockReporter).toBeCalledWith(
expect.objectContaining({
rule: 'name-casing',
identifier: 'schema.two_view.neit_he-rIsThis',
message: `The column neit_he-rIsThis on the view two_view seems to be mixed-cased rather than ${param}-cased.`,
suggestedMigration: `ALTER VIEW "two_view" RENAME COLUMN "neit_he-rIsThis" TO "${expected2}";`,
})
}),
);
}
},
);
});
4 changes: 2 additions & 2 deletions src/rules/nameCasing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const nameCasing: Rule = {
suggestedMigration: `ALTER ${entityType.toUpperCase()} "${entityName}" RENAME TO "${recase(
casing,
expectedCasing,
entityName
entityName,
)}";`,
});
}
Expand All @@ -48,7 +48,7 @@ export const nameCasing: Rule = {
suggestedMigration: `ALTER ${entityType.toUpperCase()} "${entityName}" RENAME COLUMN "${columnName}" TO "${recase(
casing,
expectedCasing,
columnName
columnName,
)}";`,
});
}
Expand Down
12 changes: 6 additions & 6 deletions src/rules/nameInflection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ describe('nameInflection', () => {
rule: 'name-inflection',
identifier: `schema.${actual1}`,
message: `Expected ${param} names, but '${actual1}' seems to be ${opposite}`,
})
}),
);
expect(mockReporter).toBeCalledWith(
expect.objectContaining({
rule: 'name-inflection',
identifier: `schema.${actual2}`,
message: `Expected ${param} names, but '${actual2}' seems to be ${opposite}`,
})
}),
);
}
},
);
test.each`
type | param | actual1 | actual 2 | expected1 | expected2
Expand Down Expand Up @@ -97,15 +97,15 @@ describe('nameInflection', () => {
rule: 'name-inflection',
identifier: `schema.${actual1}`,
message: `Expected ${param} names, but '${actual1}' seems to be ${opposite}`,
})
}),
);
expect(mockReporter).toBeCalledWith(
expect.objectContaining({
rule: 'name-inflection',
identifier: `schema.${actual2}`,
message: `Expected ${param} names, but '${actual2}' seems to be ${opposite}`,
})
}),
);
}
},
);
});
2 changes: 1 addition & 1 deletion src/rules/requirePrimaryKey.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const requirePrimaryKey = {
.filter(
(table) =>
!ignorePatternsMatch ||
!ignorePatternsMatch.test(`${schemaObject.name}.${table.name}`)
!ignorePatternsMatch.test(`${schemaObject.name}.${table.name}`),
)
.forEach(validator);
},
Expand Down
Loading

0 comments on commit 1cb8106

Please sign in to comment.