Skip to content

Commit

Permalink
run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Dec 19, 2024
1 parent f94f393 commit 441c61e
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 98 deletions.
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src/language-server/graphqlTypes.ts
src/language-server/__tests__/fixtures/documents/commentWithTemplate.ts
README.md
2 changes: 1 addition & 1 deletion sampleWorkspace/configFileTypes/cjsConfig/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "test",
"type": "module"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "test",
"type": "module"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "test",
"type": "commonjs"
}
}
2 changes: 1 addition & 1 deletion sampleWorkspace/configFileTypes/mjsConfig/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "test",
"type": "commonjs"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "test",
"type": "module"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "test",
"type": "commonjs"
}
}
2 changes: 1 addition & 1 deletion sampleWorkspace/localSchemaArray/apollo.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"localSchemaFile": ["./starwarsSchema.graphql", "./planets.graphql"]
}
}
}
}
22 changes: 11 additions & 11 deletions sampleWorkspace/sampleWorkspace.code-workspace
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
"folders": [
{
"path": "localSchema"
"path": "localSchema",
},
{
"path": "clientSchema"
"path": "clientSchema",
},
{
"path": "spotifyGraph"
"path": "spotifyGraph",
},
{
"path": "httpSchema"
"path": "httpSchema",
},
{
"path": "localSchemaArray"
"path": "localSchemaArray",
},
{
"path": "rover"
"path": "rover",
},
{
"path": "configFileTypes"
"path": "configFileTypes",
},
{
"path": "../src/language-server/__tests__/fixtures/documents"
}
"path": "../src/language-server/__tests__/fixtures/documents",
},
],
"settings": {
"apollographql.devTools.showPanel": "detect",
"apollographql.devTools.serverPort": 7095
}
"apollographql.devTools.serverPort": 7095,
},
}
32 changes: 8 additions & 24 deletions schemas/apollo.config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"$ref": "#/definitions/clientConfig"
}
},
"required": [
"client"
],
"required": ["client"],
"additionalProperties": false
},
{
Expand All @@ -24,9 +22,7 @@
"$ref": "#/definitions/roverConfig"
}
},
"required": [
"rover"
],
"required": ["rover"],
"additionalProperties": false
}
]
Expand Down Expand Up @@ -67,9 +63,7 @@
"description": "Skip SSL validation. May be required for self-signed certificates."
}
},
"required": [
"url"
],
"required": ["url"],
"additionalProperties": false,
"description": "Configuration for using a local schema from a URL."
},
Expand Down Expand Up @@ -97,9 +91,7 @@
"description": "Path to a local schema file to use as GraphQL Schema for this project. Can be a string or an array of strings to merge multiple partial schemas into one."
}
},
"required": [
"localSchemaFile"
],
"required": ["localSchemaFile"],
"additionalProperties": false,
"description": "Configuration for using a local schema from a file."
}
Expand Down Expand Up @@ -127,10 +119,7 @@
"items": {
"type": "string"
},
"default": [
"**/node_modules",
"**/__tests__"
],
"default": ["**/node_modules", "**/__tests__"],
"description": "Files to exclude from this project. The Apollo GraphQL extension will not provide IntelliSense-like features in these files."
},
"tagName": {
Expand All @@ -157,9 +146,7 @@
"description": "This option is no longer supported, please remove it from your configuration file."
}
},
"required": [
"service"
],
"required": ["service"],
"additionalProperties": false,
"description": "Configuration for a Client project."
},
Expand All @@ -175,10 +162,7 @@
"description": "The name of the profile to use."
},
"supergraphConfig": {
"type": [
"string",
"null"
],
"type": ["string", "null"],
"description": "The path to your `supergraph.yaml` file. \nDefaults to a `supergraph.yaml` in the folder of your `apollo.config.json`, if there is one."
},
"extraArgs": {
Expand Down Expand Up @@ -231,4 +215,4 @@
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
35 changes: 8 additions & 27 deletions schemas/supergraph_config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"title": "SupergraphConfig",
"description": "The configuration for a single supergraph composed of multiple subgraphs.",
"type": "object",
"required": [
"subgraphs"
],
"required": ["subgraphs"],
"properties": {
"federation_version": {
"anyOf": [
Expand Down Expand Up @@ -33,9 +31,7 @@
"anyOf": [
{
"type": "object",
"required": [
"file"
],
"required": ["file"],
"properties": {
"file": {
"type": "string"
Expand All @@ -44,15 +40,10 @@
},
{
"type": "object",
"required": [
"subgraph_url"
],
"required": ["subgraph_url"],
"properties": {
"introspection_headers": {
"type": [
"object",
"null"
],
"type": ["object", "null"],
"additionalProperties": {
"type": "string"
}
Expand All @@ -65,10 +56,7 @@
},
{
"type": "object",
"required": [
"graphref",
"subgraph"
],
"required": ["graphref", "subgraph"],
"properties": {
"graphref": {
"type": "string"
Expand All @@ -80,9 +68,7 @@
},
{
"type": "object",
"required": [
"sdl"
],
"required": ["sdl"],
"properties": {
"sdl": {
"type": "string"
Expand All @@ -94,16 +80,11 @@
"SubgraphConfig": {
"description": "Config for a single [subgraph](https://www.apollographql.com/docs/federation/subgraphs/)",
"type": "object",
"required": [
"schema"
],
"required": ["schema"],
"properties": {
"routing_url": {
"description": "The routing URL for the subgraph. This will appear in supergraph SDL and instructs the graph router to send all requests for this subgraph to this URL.",
"type": [
"string",
"null"
]
"type": ["string", "null"]
},
"schema": {
"description": "The location of the subgraph's SDL",
Expand Down
4 changes: 2 additions & 2 deletions src/language-server/project/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ export abstract class GraphQLInternalProject
localSchemaFile === undefined
? []
: Array.isArray(localSchemaFile)
? localSchemaFile
: [localSchemaFile]
? localSchemaFile
: [localSchemaFile]
).map((filePath) =>
path.relative(this.rootURI.fsPath, path.join(process.cwd(), filePath)),
);
Expand Down
12 changes: 6 additions & 6 deletions src/language-server/providers/schema/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export class FileSchemaProvider implements GraphQLSchemaProvider {
const documents = path
? [this.loadFileAndGetDocument(path)]
: paths
? paths.map(this.loadFileAndGetDocument, this)
: undefined;
? paths.map(this.loadFileAndGetDocument, this)
: undefined;

if (!documents)
throw new Error(
Expand Down Expand Up @@ -73,8 +73,8 @@ export class FileSchemaProvider implements GraphQLSchemaProvider {
const __schema = parsed.data
? parsed.data.__schema
: parsed.__schema
? parsed.__schema
: parsed;
? parsed.__schema
: parsed;

const schema = buildClientSchema({ __schema });
return parse(printSchema(schema));
Expand Down Expand Up @@ -105,8 +105,8 @@ export class FileSchemaProvider implements GraphQLSchemaProvider {
const SDLs = path
? [this.loadFileAndGetSDL(path)]
: paths
? paths.map(this.loadFileAndGetSDL, this)
: undefined;
? paths.map(this.loadFileAndGetSDL, this)
: undefined;

if (!SDLs || SDLs.filter((s) => !Boolean(s)).length > 0)
return Debug.error(
Expand Down
22 changes: 10 additions & 12 deletions src/language-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ workspace.onConfigFilesFound(async (params) => {
!value
? value
: value instanceof Error || isValidationError(value)
? { message: value.message, stack: value.stack }
: value,
? { message: value.message, stack: value.stack }
: value,
),
);
});
Expand Down Expand Up @@ -181,18 +181,16 @@ documents.onDidChangeContent((params) => {
project.documentDidChange(params.document);
});

documents.onDidOpen(
(params) =>
workspace
.projectForFile(params.document.uri, params.document.languageId)
?.onDidOpen?.(params),
documents.onDidOpen((params) =>
workspace
.projectForFile(params.document.uri, params.document.languageId)
?.onDidOpen?.(params),
);

documents.onDidClose(
(params) =>
workspace
.projectForFile(params.document.uri, params.document.languageId)
?.onDidClose?.(params),
documents.onDidClose((params) =>
workspace
.projectForFile(params.document.uri, params.document.languageId)
?.onDidClose?.(params),
);

connection.onDidChangeWatchedFiles((params) => {
Expand Down
18 changes: 9 additions & 9 deletions src/language-server/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ export class GraphQLWorkspace {
clientIdentity,
})
: isRoverConfig(config)
? new RoverProject({
config,
loadingHandler: this.LanguageServerLoadingHandler,
configFolderURI: URI.parse(folder.uri),
capabilities: this.capabilities!, // TODO?
})
: (() => {
throw new Error("Impossible config!");
})();
? new RoverProject({
config,
loadingHandler: this.LanguageServerLoadingHandler,
configFolderURI: URI.parse(folder.uri),
capabilities: this.capabilities!, // TODO?
})
: (() => {
throw new Error("Impossible config!");
})();

project.onDiagnostics((params) => {
this._onDiagnostics && this._onDiagnostics(params);
Expand Down

0 comments on commit 441c61e

Please sign in to comment.