From ac198b9956effebe2a0bafe12ba763b8a21d7400 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Mon, 27 May 2019 12:10:12 +0300 Subject: [PATCH] ESLint: Forbid unnecessary backticks (#1914) --- .eslintrc.yml | 2 +- src/type/__tests__/serialization-test.js | 2 +- src/type/__tests__/validation-test.js | 23 +++++++++++++-------- src/type/validate.js | 2 +- src/utilities/__tests__/coerceValue-test.js | 10 ++++----- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index d8719a90e9..af0dff524a 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -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] diff --git a/src/type/__tests__/serialization-test.js b/src/type/__tests__/serialization-test.js index f8f1cb9ce3..58316b9415 100644 --- a/src/type/__tests__/serialization-test.js +++ b/src/type/__tests__/serialization-test.js @@ -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'); diff --git a/src/type/__tests__/validation-test.js b/src/type/__tests__/validation-test.js index 506c917219..ee3df4e6b5 100644 --- a/src/type/__tests__/validation-test.js +++ b/src/type/__tests__/validation-test.js @@ -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].', }, ]); }); @@ -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].', }, ]); }); @@ -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].', }, ]); }); @@ -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].', }, ]); }); diff --git a/src/type/validate.js b/src/type/validate.js index 2e5d2df38e..5f7009cabe 100644 --- a/src/type/validate.js +++ b/src/type/validate.js @@ -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( diff --git a/src/utilities/__tests__/coerceValue-test.js b/src/utilities/__tests__/coerceValue-test.js index e6555a3047..3b4ca712aa 100644 --- a/src/utilities/__tests__/coerceValue-test.js +++ b/src/utilities/__tests__/coerceValue-test.js @@ -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]', ]); }); }); @@ -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"', ]); });