Skip to content
This repository was archived by the owner on Sep 2, 2020. It is now read-only.

Fix build: bump prettier #235

Merged
merged 2 commits into from
Jun 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@
"graphql-language-service-utils": "^1.0.0-0",
"lerna": "^2.0.0",
"mocha": "4.1.0",
"prettier": "^1.5.3"
"prettier": "1.13"
}
}
5 changes: 3 additions & 2 deletions packages/interface/src/getAutocompleteSuggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,9 @@ function getSuggestionsForFragmentSpread(
relevantFrags.map(frag => ({
label: frag.name.value,
detail: String(typeMap[frag.typeCondition.name.value]),
documentation: `fragment ${frag.name.value} on ${frag.typeCondition.name
.value}`,
documentation: `fragment ${frag.name.value} on ${
frag.typeCondition.name.value
}`,
})),
);
}
Expand Down
7 changes: 3 additions & 4 deletions packages/interface/src/getDefinition.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ export async function getDefinitionQueryResultForFragmentSpread(
process.stderr.write(`Definition not found for GraphQL fragment ${name}`);
return {queryRange: [], definitions: []};
}
const definitions: Array<
Definition,
> = defNodes.map(({filePath, content, definition}) =>
getDefinitionForFragmentDefinition(filePath || '', content, definition),
const definitions: Array<Definition> = defNodes.map(
({filePath, content, definition}) =>
getDefinitionForFragmentDefinition(filePath || '', content, definition),
);
return {
definitions,
Expand Down
4 changes: 3 additions & 1 deletion packages/interface/src/getDiagnostics.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ function annotations(
const highlightNode =
node.kind !== 'Variable' && node.name
? node.name
: node.variable ? node.variable : node;
: node.variable
? node.variable
: node;

invariant(error.locations, 'GraphQL validation error requires locations.');
const loc = error.locations[0];
Expand Down
8 changes: 5 additions & 3 deletions packages/parser/src/Rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import type {
import {opt, list, butNot, t, p} from './RuleHelpers';

/**
* Whitespace tokens defined in GraphQL spec.
*/
* Whitespace tokens defined in GraphQL spec.
*/
export const isIgnored = (ch: string) =>
ch === ' ' ||
ch === '\t' ||
Expand Down Expand Up @@ -120,7 +120,9 @@ export const ParseRules: {[name: string]: ParseRule} = {
? stream.match(/[\s\u00a0,]*(on\b|@|{)/, false)
? 'InlineFragment'
: 'FragmentSpread'
: stream.match(/[\s\u00a0,]*:/, false) ? 'AliasedField' : 'Field';
: stream.match(/[\s\u00a0,]*:/, false)
? 'AliasedField'
: 'Field';
},
// Note: this minor deviation of "AliasedField" simplifies the lookahead.
AliasedField: [
Expand Down
4 changes: 3 additions & 1 deletion packages/parser/src/onlineParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ function getToken(
// the current token, otherwise expect based on the current step.
let expected: any =
typeof state.rule === 'function'
? state.step === 0 ? state.rule(token, stream) : null
? state.step === 0
? state.rule(token, stream)
: null
: state.rule[state.step];

// Seperator between list elements if necessary.
Expand Down
32 changes: 16 additions & 16 deletions packages/server/src/GraphQLCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,9 @@ export class GraphQLCache implements GraphQLCacheInterface {
}

/**
* Given a list of GraphQL file metadata, read all files collected from watchman
* and create fragmentDefinitions and GraphQL files cache.
*/
* Given a list of GraphQL file metadata, read all files collected from watchman
* and create fragmentDefinitions and GraphQL files cache.
*/
readAllGraphQLFiles = async (
list: Array<GraphQLFileMetadata>,
): Promise<{
Expand All @@ -561,13 +561,13 @@ export class GraphQLCache implements GraphQLCacheInterface {
this.promiseToReadGraphQLFile(fileInfo.filePath)
.catch(error => {
/**
* fs emits `EMFILE | ENFILE` error when there are too many
* open files - this can cause some fragment files not to be
* processed. Solve this case by implementing a queue to save
* files failed to be processed because of `EMFILE` error,
* and await on Promises created with the next batch from the
* queue.
*/
* fs emits `EMFILE | ENFILE` error when there are too many
* open files - this can cause some fragment files not to be
* processed. Solve this case by implementing a queue to save
* files failed to be processed because of `EMFILE` error,
* and await on Promises created with the next batch from the
* queue.
*/
if (error.code === 'EMFILE' || error.code === 'ENFILE') {
queue.push(fileInfo);
}
Expand All @@ -587,9 +587,9 @@ export class GraphQLCache implements GraphQLCacheInterface {
};

/**
* Takes an array of GraphQL File information and batch-processes into a
* map of fragmentDefinitions and GraphQL file cache.
*/
* Takes an array of GraphQL File information and batch-processes into a
* map of fragmentDefinitions and GraphQL file cache.
*/
processGraphQLFiles = (
responses: Array<GraphQLFileInfo>,
): {
Expand Down Expand Up @@ -630,9 +630,9 @@ export class GraphQLCache implements GraphQLCacheInterface {
};

/**
* Returns a Promise to read a GraphQL file and return a GraphQL metadata
* including a parsed AST.
*/
* Returns a Promise to read a GraphQL file and return a GraphQL metadata
* including a parsed AST.
*/
promiseToReadGraphQLFile = (
filePath: Uri,
): Promise<{
Expand Down
5 changes: 3 additions & 2 deletions packages/server/src/Logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ export class Logger implements VSCodeLogger {

this._logFilePath = join(
dir,
`graphql-language-service-log-${os.userInfo()
.username}-${getDateString()}.log`,
`graphql-language-service-log-${
os.userInfo().username
}-${getDateString()}.log`,
);

this._stream = null;
Expand Down
66 changes: 33 additions & 33 deletions packages/types/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ import type {GraphQLConfig, GraphQLProjectConfig} from 'graphql-config';
export type TokenPattern = string | ((char: string) => boolean) | RegExp;

export interface CharacterStream {
getStartOfToken: () => number,
getCurrentPosition: () => number,
eol: () => boolean,
sol: () => boolean,
peek: () => string | null,
next: () => string,
eat: (pattern: TokenPattern) => string | void,
eatWhile: (match: TokenPattern) => boolean,
eatSpace: () => boolean,
skipToEnd: () => void,
skipTo: (position: number) => void,
getStartOfToken: () => number;
getCurrentPosition: () => number;
eol: () => boolean;
sol: () => boolean;
peek: () => string | null;
next: () => string;
eat: (pattern: TokenPattern) => string | void;
eatWhile: (match: TokenPattern) => boolean;
eatSpace: () => boolean;
skipToEnd: () => void;
skipTo: (position: number) => void;
match: (
pattern: TokenPattern,
consume: ?boolean,
caseFold: ?boolean,
) => Array<string> | boolean,
backUp: (num: number) => void,
column: () => number,
indentation: () => number,
current: () => string,
) => Array<string> | boolean;
backUp: (num: number) => void;
column: () => number;
indentation: () => number;
current: () => string;
}

// Cache and config-related.
Expand Down Expand Up @@ -80,56 +80,56 @@ export type GraphQLConfigurationExtension = {
};

export interface GraphQLCache {
getGraphQLConfig: () => GraphQLConfig,
getGraphQLConfig: () => GraphQLConfig;

getFragmentDependencies: (
query: string,
fragmentDefinitions: ?Map<string, FragmentInfo>,
) => Promise<Array<FragmentInfo>>,
) => Promise<Array<FragmentInfo>>;

getFragmentDependenciesForAST: (
parsedQuery: ASTNode,
fragmentDefinitions: Map<string, FragmentInfo>,
) => Promise<Array<FragmentInfo>>,
) => Promise<Array<FragmentInfo>>;

getFragmentDefinitions: (
graphQLConfig: GraphQLProjectConfig,
) => Promise<Map<string, FragmentInfo>>,
) => Promise<Map<string, FragmentInfo>>;

+updateFragmentDefinition: (
rootDir: Uri,
filePath: Uri,
contents: Array<CachedContent>,
) => Promise<void>,
) => Promise<void>;

+updateFragmentDefinitionCache: (
rootDir: Uri,
filePath: Uri,
exists: boolean,
) => Promise<void>,
) => Promise<void>;

getSchema: (
appName: ?string,
queryHasExtensions?: ?boolean,
) => Promise<?GraphQLSchema>,
) => Promise<?GraphQLSchema>;

handleWatchmanSubscribeEvent: (
rootDir: string,
projectConfig: GraphQLProjectConfig,
) => (result: Object) => void,
) => (result: Object) => void;
}

// online-parser related
export interface Position {
line: number,
character: number,
lessThanOrEqualTo: (position: Position) => boolean,
line: number;
character: number;
lessThanOrEqualTo: (position: Position) => boolean;
}

export interface Range {
start: Position,
end: Position,
containsPosition: (position: Position) => boolean,
start: Position;
end: Position;
containsPosition: (position: Position) => boolean;
}

export type CachedContent = {
Expand Down Expand Up @@ -280,11 +280,11 @@ export type Outline = {
};

export interface DidChangeWatchedFilesParams {
changes: FileEvent[],
changes: FileEvent[];
}
export interface FileEvent {
uri: string,
type: FileChangeType,
uri: string;
type: FileChangeType;
}
export const FileChangeTypeKind = {
Created: 1,
Expand Down
2 changes: 1 addition & 1 deletion resources/pretty.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const {stdout, stderr, status, error} = spawnSync(executable, [
glob,
]);
const out = stdout.toString().trim();
const err = stdout.toString().trim();
const err = stderr.toString().trim();

function print(message) {
if (message) {
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2673,9 +2673,9 @@ preserve@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"

prettier@^1.5.3:
version "1.7.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.7.0.tgz#47481588f41f7c90f63938feb202ac82554e7150"
prettier@1.13:
version "1.13.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.3.tgz#e74c09a7df6519d472ca6febaa37cf7addb48a20"

private@^0.1.6, private@^0.1.7:
version "0.1.7"
Expand Down