-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* npm i --save-dev @types/pg * Convert rules to typescript * Convert engine to typescript * Convert cli to typescript * Move DeepPartial to dedicated file to be used from multiple files * Convert test files to typescript * Replace test.each`...` with test.each([...]) * Fix test names * Introduce index.ts to export major types from package root * Add type assertion * No longer allow js * Specify types * Use import instead of require
- Loading branch information
Showing
14 changed files
with
396 additions
and
183 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { ClientConfig } from "pg"; | ||
|
||
/** | ||
* The configuration for schemalint. | ||
*/ | ||
type Config = { | ||
/** | ||
* The connection configuration for the database. | ||
* @see https://node-postgres.com/apis/client | ||
*/ | ||
connection: ClientConfig; | ||
/** | ||
* The plugins to be used. | ||
*/ | ||
plugins?: string[]; | ||
/** | ||
* The rules to be used. | ||
*/ | ||
rules: Record<string, RuleConfig>; | ||
/** | ||
* The schemas to be linted. | ||
*/ | ||
schemas: SchemaConfig[]; | ||
/** | ||
* The configuration for ignoring problems. | ||
*/ | ||
ignores?: IgnoreConfig[]; | ||
}; | ||
|
||
/** | ||
* A schema to be linted. | ||
*/ | ||
export type SchemaConfig = { | ||
/** | ||
* The name of the schema to be linted. | ||
*/ | ||
name: string; | ||
/** | ||
* The rules to be used spefically for this schema. These rules will be merged with the global rules. | ||
*/ | ||
rules?: Record<string, RuleConfig>; | ||
}; | ||
|
||
/** | ||
* A rule configuration. The first element is the severity of the rule, and the rest of the elements are the options for the rule. | ||
*/ | ||
export type RuleConfig = [Severity, ...unknown[]]; | ||
|
||
/** | ||
* The severity of a rule. `off` means the rule is disabled, `error` means the rule is enabled. | ||
*/ | ||
export type Severity = "off" | "error"; | ||
|
||
/** | ||
* A configuration for ignoring problems. | ||
*/ | ||
export type IgnoreConfig = { | ||
/** | ||
* The rule name to ignore. `rule` or `rulePattern` must be provided. | ||
*/ | ||
rule?: string; | ||
/** | ||
* A pattern to match against the rule name. `rule` or `rulePattern` must be provided. | ||
*/ | ||
rulePattern?: string; | ||
/** | ||
* The identifier to ignore. `identifier` or `identifierPattern` must be provided. | ||
*/ | ||
identifier?: string; | ||
/** | ||
* A pattern to match against the identifier. `identifier` or `identifierPattern` must be provided. | ||
*/ | ||
identifierPattern?: string; | ||
}; | ||
|
||
export default Config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export type { default as Config } from "./Config"; | ||
export * from "./engine"; | ||
export type { default as Rule } from "./Rule"; |
File renamed without changes.
Oops, something went wrong.