-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support checksyncrc files #812
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
688a09b
Add @hyperjump/json-schema package
somewhatabstract a1199d9
Add config file schema
somewhatabstract e5f88e1
Added descriptions to schema fields
somewhatabstract 560b6af
Implement config file search and load
somewhatabstract 9d61932
Update workspace settings to support config schema
somewhatabstract a8a34cd
Make sure schema file is shipped
somewhatabstract 3bb1e63
Fix up argument use to cope with how minimist works
somewhatabstract f3772db
Get config file loading working for integration tests
somewhatabstract 947f9ab
Adding lots of tests
somewhatabstract 2dc6946
Add test coverage
somewhatabstract f01667b
Fix up paths in StringLogger
somewhatabstract 92a2983
Remove redundant code
somewhatabstract 9172b38
Put main.js back into coverage
somewhatabstract e1fc3b9
Exclude test files from coverage data
somewhatabstract aa15d3c
Really exclude test files from coverage data
somewhatabstract 695b34c
Add diagnostic check to see what windows says the root dir is
somewhatabstract 9c2766f
Fix the root dir replacement
somewhatabstract 0ac893b
Fix new tests that have path separator issues
somewhatabstract f324961
Update README
somewhatabstract 037a0fc
Tighten regex per review commentary
somewhatabstract File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,18 @@ | ||
{ | ||
"$schema": "./src/checksync.schema.json", | ||
"$comment": "This is the config file for our integration tests. By not specifying it directly, we also test configuration file discovery.", | ||
"autoFix": false, | ||
"comments": [ | ||
"//", | ||
"#", | ||
"{/*" | ||
], | ||
"dryRun": false, | ||
"excludeGlobs": [ | ||
"**/excluded/**" | ||
], | ||
"ignoreFiles": [ | ||
"**/ignore-file.txt" | ||
], | ||
"json": false | ||
} | ||
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/usr/bin/env node | ||
require("@babel/register"); | ||
require("../src/main.js").run(__filename); | ||
require("../src/main.js").runCli(__filename); |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#!/usr/bin/env node | ||
require("../dist/main.js").run(__filename); | ||
require("../dist/main.js").runCli(__filename); |
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,55 @@ | ||
declare module "@hyperjump/json-schema" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pieced this together from typescript and reading the code. |
||
declare opaque type Schema; | ||
|
||
declare type SDoc = { | ||
anchors: mixed, | ||
dynamicAnchors: mixed, | ||
id: string, | ||
pointer: string, | ||
schema: Schema, | ||
schemaVersion: string, | ||
validated: boolean, | ||
value: Schema, | ||
vocabulary: mixed, | ||
}; | ||
|
||
declare opaque type Keywords; | ||
|
||
declare type OutputFormat = "FLAG" | "BASIC" | "DETAILED" | "VERBOSE"; | ||
|
||
declare type OutputUnit = { | ||
absoluteKeywordLocation: string, | ||
errors: $ReadOnlyArray<OutputUnit>, | ||
instanceLocation: string, | ||
keyword: string, | ||
valid: boolean, | ||
}; | ||
|
||
declare type AST = mixed; | ||
|
||
declare type CompiledSchema = { | ||
ast: AST, | ||
schemaUri: string, | ||
}; | ||
|
||
declare interface JsonSchema { | ||
add: (schema: SDoc, url?: string, defaultSchemaVersion?: string) => void, | ||
get: (url: string, contextDoc?: SDoc) => Promise<SDoc>, | ||
validate: (schema: SDoc, value: {...}, outputFormat?: OutputFormat) => Promise<OutputUnit>, | ||
compile: (schema: SDoc) => Promise<CompiledSchema>; | ||
interpret: interface { | ||
(schema: CompiledSchema, value: {...}): (outputFormat?: OutputFormat) => OutputUnit; | ||
(schema: CompiledSchema): (value: {...}, outputFormat?: OutputFormat) => OutputUnit; | ||
(schema: CompiledSchema, value: {...}, outputFormat?: OutputFormat): () => OutputUnit; | ||
}, | ||
setMetaOutputFormat: (outputFormat?: OutputFormat) => void, | ||
setShouldMetaValidate: (isEnabled: boolean) => void, | ||
FLAG: "FLAG", | ||
BASIC: "BASIC", | ||
DETAILED: "DETAILED", | ||
VERBOSE: "VERBOSE", | ||
Keywords: Keywords | ||
} | ||
|
||
declare module.exports: JsonSchema; | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An example config file for checksync. Note that the schema can be specified at the top of the file as per JSON Schema specifications (the schema is shipped with the tool).
Note that folks don't need to include this - their configs will still be validated against this schema, regardless. However, for tools like VSCode, this tells it what schema to use and provides autocomplete/intellisense accordingly.