Skip to content
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

ESLint: Forbid unnecessary backticks #1914

Merged
merged 1 commit into from May 27, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.yml
Expand Up @@ -253,7 +253,7 @@ rules:
operator-assignment: [error, always]
padding-line-between-statements: off
prefer-object-spread: error
quotes: [error, single, { avoidEscape: true, allowTemplateLiterals: true }]
quotes: [error, single, { avoidEscape: true, allowTemplateLiterals: false }]
sort-keys: off
sort-vars: off
spaced-comment: [error, always]
Expand Down
2 changes: 1 addition & 1 deletion src/type/__tests__/serialization-test.js
Expand Up @@ -104,7 +104,7 @@ describe('Type System: Scalar coercion', () => {
);
});

it(`serializes output as String`, () => {
it('serializes output as String', () => {
expect(GraphQLString.serialize('string')).to.equal('string');
expect(GraphQLString.serialize(1)).to.equal('1');
expect(GraphQLString.serialize(-1.1)).to.equal('-1.1');
Expand Down
23 changes: 14 additions & 9 deletions src/type/__tests__/validation-test.js
Expand Up @@ -909,10 +909,11 @@ describe('Type System: Object fields must have output types', () => {
const schema = schemaWithObjectFieldOfType(Number);
expect(validateSchema(schema)).to.deep.equal([
{
message: `The type of BadObject.badField must be Output Type but got: [function Number].`,
message:
'The type of BadObject.badField must be Output Type but got: [function Number].',
},
{
message: `Expected GraphQL named type but got: [function Number].`,
message: 'Expected GraphQL named type but got: [function Number].',
},
]);
});
Expand Down Expand Up @@ -1224,13 +1225,15 @@ describe('Type System: Interface fields must have output types', () => {
const schema = schemaWithInterfaceFieldOfType(Number);
expect(validateSchema(schema)).to.deep.equal([
{
message: `The type of BadInterface.badField must be Output Type but got: [function Number].`,
message:
'The type of BadInterface.badField must be Output Type but got: [function Number].',
},
{
message: `Expected GraphQL named type but got: [function Number].`,
message: 'Expected GraphQL named type but got: [function Number].',
},
{
message: `The type of BadImplementing.badField must be Output Type but got: [function Number].`,
message:
'The type of BadImplementing.badField must be Output Type but got: [function Number].',
},
]);
});
Expand Down Expand Up @@ -1342,10 +1345,11 @@ describe('Type System: Field arguments must have input types', () => {
const schema = schemaWithArgOfType(Number);
expect(validateSchema(schema)).to.deep.equal([
{
message: `The type of BadObject.badField(badArg:) must be Input Type but got: [function Number].`,
message:
'The type of BadObject.badField(badArg:) must be Input Type but got: [function Number].',
},
{
message: `Expected GraphQL named type but got: [function Number].`,
message: 'Expected GraphQL named type but got: [function Number].',
},
]);
});
Expand Down Expand Up @@ -1431,10 +1435,11 @@ describe('Type System: Input Object fields must have input types', () => {
const schema = schemaWithInputFieldOfType(Number);
expect(validateSchema(schema)).to.deep.equal([
{
message: `The type of BadInputObject.badField must be Input Type but got: [function Number].`,
message:
'The type of BadInputObject.badField must be Input Type but got: [function Number].',
},
{
message: `Expected GraphQL named type but got: [function Number].`,
message: 'Expected GraphQL named type but got: [function Number].',
},
]);
});
Expand Down
2 changes: 1 addition & 1 deletion src/type/validate.js
Expand Up @@ -114,7 +114,7 @@ function validateRootTypes(context) {
const schema = context.schema;
const queryType = schema.getQueryType();
if (!queryType) {
context.reportError(`Query root type must be provided.`, schema.astNode);
context.reportError('Query root type must be provided.', schema.astNode);
} else if (!isObjectType(queryType)) {
context.reportError(
`Query root type must be Object type, it cannot be ${inspect(
Expand Down
10 changes: 5 additions & 5 deletions src/utilities/__tests__/coerceValue-test.js
Expand Up @@ -33,20 +33,20 @@ function expectErrors(result) {
}

describe('coerceValue', () => {
describe(`for GraphQLString`, () => {
describe('for GraphQLString', () => {
it('returns error for array input as string', () => {
const result = coerceValue([1, 2, 3], GraphQLString);
expectErrors(result).to.deep.equal([
`Expected type String; String cannot represent a non string value: [1, 2, 3]`,
'Expected type String; String cannot represent a non string value: [1, 2, 3]',
]);
});
});

describe(`for GraphQLID`, () => {
describe('for GraphQLID', () => {
it('returns error for array input as ID', () => {
const result = coerceValue([1, 2, 3], GraphQLID);
expectErrors(result).to.deep.equal([
`Expected type ID; ID cannot represent value: [1, 2, 3]`,
'Expected type ID; ID cannot represent value: [1, 2, 3]',
]);
});
});
Expand All @@ -60,7 +60,7 @@ describe('coerceValue', () => {
it('returns error for numeric looking string', () => {
const result = coerceValue('1', GraphQLInt);
expectErrors(result).to.deep.equal([
`Expected type Int; Int cannot represent non-integer value: "1"`,
'Expected type Int; Int cannot represent non-integer value: "1"',
]);
});

Expand Down