Skip to content

Commit

Permalink
Add schema for prettier 1.8.2 (#400)
Browse files Browse the repository at this point in the history
* Add schema for prettier 1.8.2

* Use descriptions from `prettier --help`

They are more succinct than the ones provided on their website.

* Add prettierrc-1.8.2 to the catalog
  • Loading branch information
lukaszmoroz authored and madskristensen committed Feb 5, 2018
1 parent 621445d commit b77c6ff
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/api/json/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,10 @@
"name": "prettierrc.json",
"description": ".prettierrc configuration file",
"fileMatch": [ ".prettierrc", ".prettierrc.json" ],
"url": "http://json.schemastore.org/prettierrc"
"url": "http://json.schemastore.org/prettierrc",
"versions": {
"1.8.2": "http://json.schemastore.org/prettierrc-1.8.2"
}
},
{
"name": "project.json",
Expand Down
138 changes: 138 additions & 0 deletions src/schemas/json/prettierrc-1.8.2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Schema for .prettierrc",

"definitions": {
"optionsDefinition": {
"properties": {
"arrowParens": {
"default": "avoid",
"description": "Include parentheses around a sole arrow function parameter.",
"enum": ["avoid", "always"],
"type": "string"
},
"bracketSpacing": {
"default": true,
"description": "Print spaces between brackets in object literals.",
"type": "boolean"
},
"insertPragma": {
"default": false,
"description": "Insert @format pragma into file's first docblock comment.",
"type": "boolean"
},
"jsxBracketSameLine": {
"default": false,
"description": "Put the > of a multi-line JSX element at the end of the last line instead of being alone on the next line.",
"type": "boolean"
},
"parser": {
"enum": [
"babylon",
"flow",
"typescript",
"postcss",
"json",
"graphql",
"markdown"
],
"description": "Specify which parser to use.",
"default": "babylon",
"type": "string"
},
"printWidth": {
"default": 80,
"description": "Specify the line length that the printer will wrap on.",
"type": "integer"
},
"proseWrap": {
"default": "preserve",
"description": "How to wrap prose.",
"enum": ["always", "never", "preserve"],
"type": "string"
},
"requirePragma": {
"default": false,
"description": "Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.",
"type": "boolean"
},
"semi": {
"default": true,
"description": "Print semicolons at the ends of statements.",
"type": "boolean"
},
"singleQuote": {
"default": false,
"description": "Use single quotes instead of double quotes.",
"type": "boolean"
},
"tabWidth": {
"default": 2,
"description": "Specify the number of spaces per indentation-level.",
"type": "integer"
},
"trailingComma": {
"default": "none",
"description": "Print trailing commas wherever possible.",
"enum": ["none", "all", "es5"],
"type": "string"
},
"useTabs": {
"default": false,
"description": "Indent lines with tabs instead of spaces.",
"type": "boolean"
}
}
},
"overridesDefinition": {
"properties": {
"overrides": {
"description": "Provide a list of patterns to override prettier configuration.",
"items": {
"required": ["files"],
"properties": {
"files": {
"description": "Include these files in this override.",
"oneOf": [
{ "type": "string" },
{
"items": {
"type": "string"
},
"type": "array"
}
]
},
"excludeFiles": {
"description": "Exclude these files from this override.",
"oneOf": [
{ "type": "string" },
{
"items": {
"type": "string"
},
"type": "array"
}
]
},
"options": {
"type": "object",
"description": "The options to apply for this override.",
"$ref": "#/definitions/optionsDefinition"
}
},
"additionalProperties": false,
"type": "object"
},
"type": "array"
}
}
}
},

"type": "object",
"allOf": [
{ "$ref": "#/definitions/optionsDefinition" },
{ "$ref": "#/definitions/overridesDefinition" }
]
}

0 comments on commit b77c6ff

Please sign in to comment.