diff --git a/package.json b/package.json index 922478bf6..8cbc2708a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "graphql-scalars", - "version": "1.4.1", + "version": "1.5.0", "description": "A collection of scalar types not included in base GraphQL.", "repository": { "type": "git", @@ -51,7 +51,7 @@ "bob-the-bundler": "1.1.0", "eslint": "7.13.0", "eslint-config-prettier": "6.15.0", - "eslint-config-standard": "14.1.1", + "eslint-config-standard": "16.0.2", "eslint-plugin-import": "2.22.1", "eslint-plugin-node": "11.1.0", "eslint-plugin-promise": "4.2.1", diff --git a/src/RegularExpression.ts b/src/RegularExpression.ts index fdb2b63a6..320247082 100644 --- a/src/RegularExpression.ts +++ b/src/RegularExpression.ts @@ -12,7 +12,7 @@ export class RegularExpression extends GraphQLScalarType { regex: RegExp, options: RegularExpressionOptions = {}, ) { - const REGEX = /*#__PURE__*/ new RegExp(regex); + const REGEX = /*#__PURE__*/ regex; const errorMessage: RegularExpressionErrorMessageFn = options.errorMessage ? options.errorMessage : (r, v) => `Value does not match the regular expression ${r}: ${v}`; diff --git a/src/scalars/ObjectID.ts b/src/scalars/ObjectID.ts index 7b8b3b5ba..74b28cdfe 100644 --- a/src/scalars/ObjectID.ts +++ b/src/scalars/ObjectID.ts @@ -1,6 +1,6 @@ import { Kind, GraphQLError, GraphQLScalarType, ValueNode } from 'graphql'; -const MONGODB_OBJECTID_REGEX = /*#__PURE__*/ new RegExp(/^[A-Fa-f0-9]{24}$/); +const MONGODB_OBJECTID_REGEX = /*#__PURE__*/ /^[A-Fa-f0-9]{24}$/; export const GraphQLObjectID = /*#__PURE__*/ new GraphQLScalarType({ name: 'ObjectID', diff --git a/src/scalars/PostalCode.ts b/src/scalars/PostalCode.ts index 16493c81c..24ce0b65d 100644 --- a/src/scalars/PostalCode.ts +++ b/src/scalars/PostalCode.ts @@ -32,23 +32,23 @@ import { Kind, GraphQLError, GraphQLScalarType } from 'graphql'; // prettier-ignore const POSTAL_CODE_REGEXES = [ - /* US */ /*#__PURE__*/new RegExp(/^\d{5}([-]?\d{4})?$/), - /* UK */ /*#__PURE__*/new RegExp(/^(GIR|[A-Z]\d[A-Z\d]??|[A-Z]{2}\d[A-Z\d]??)[ ]??(\d[A-Z]{2})$/), - /* DE */ /*#__PURE__*/new RegExp(/\b((?:0[1-46-9]\d{3})|(?:[1-357-9]\d{4})|(?:[4][0-24-9]\d{3})|(?:[6][013-9]\d{3}))\b/), - /* CA */ /*#__PURE__*/new RegExp(/^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ]) {0,1}(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$/), - /* FR */ /*#__PURE__*/new RegExp(/^(F-)?((2[A|B])|[0-9]{2})[0-9]{3}$/), - /* IT */ /*#__PURE__*/new RegExp(/^(V-|I-)?[0-9]{5}$/), - /* AU */ /*#__PURE__*/new RegExp(/^(0[289][0-9]{2})|([1345689][0-9]{3})|(2[0-8][0-9]{2})|(290[0-9])|(291[0-4])|(7[0-4][0-9]{2})|(7[8-9][0-9]{2})$/), - /* NL */ /*#__PURE__*/new RegExp(/^[1-9][0-9]{3}\s?([a-zA-Z]{2})?$/), - /* ES */ /*#__PURE__*/new RegExp(/^([1-9]{2}|[0-9][1-9]|[1-9][0-9])[0-9]{3}$/), - /* DK */ /*#__PURE__*/new RegExp(/^([D|d][K|k]( |-))?[1-9]{1}[0-9]{3}$/), - /* SE */ /*#__PURE__*/new RegExp(/^(s-|S-){0,1}[0-9]{3}\s?[0-9]{2}$/), - /* BE */ /*#__PURE__*/new RegExp(/^[1-9]{1}[0-9]{3}$/), - /* IN */ /*#__PURE__*/new RegExp(/^\d{6}$/), - /* AT */ /*#__PURE__*/new RegExp(/^\d{4}$/), - /* PT */ /*#__PURE__*/new RegExp(/^\d{4}([\-]\d{3})?$/), - /* CH */ /*#__PURE__*/new RegExp(/^\d{4}$/), - /* LU */ /*#__PURE__*/new RegExp(/^\d{4}$/), + /* US */ /*#__PURE__*//^\d{5}([-]?\d{4})?$/, + /* UK */ /*#__PURE__*//^(GIR|[A-Z]\d[A-Z\d]??|[A-Z]{2}\d[A-Z\d]??)[ ]??(\d[A-Z]{2})$/, + /* DE */ /*#__PURE__*//\b((?:0[1-46-9]\d{3})|(?:[1-357-9]\d{4})|(?:[4][0-24-9]\d{3})|(?:[6][013-9]\d{3}))\b/, + /* CA */ /*#__PURE__*//^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ]) {0,1}(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$/, + /* FR */ /*#__PURE__*//^(F-)?((2[A|B])|[0-9]{2})[0-9]{3}$/, + /* IT */ /*#__PURE__*//^(V-|I-)?[0-9]{5}$/, + /* AU */ /*#__PURE__*//^(0[289][0-9]{2})|([1345689][0-9]{3})|(2[0-8][0-9]{2})|(290[0-9])|(291[0-4])|(7[0-4][0-9]{2})|(7[8-9][0-9]{2})$/, + /* NL */ /*#__PURE__*//^[1-9][0-9]{3}\s?([a-zA-Z]{2})?$/, + /* ES */ /*#__PURE__*//^([1-9]{2}|[0-9][1-9]|[1-9][0-9])[0-9]{3}$/, + /* DK */ /*#__PURE__*//^([D|d][K|k]( |-))?[1-9]{1}[0-9]{3}$/, + /* SE */ /*#__PURE__*//^(s-|S-){0,1}[0-9]{3}\s?[0-9]{2}$/, + /* BE */ /*#__PURE__*//^[1-9]{1}[0-9]{3}$/, + /* IN */ /*#__PURE__*//^\d{6}$/, + /* AT */ /*#__PURE__*//^\d{4}$/, + /* PT */ /*#__PURE__*//^\d{4}([\-]\d{3})?$/, + /* CH */ /*#__PURE__*//^\d{4}$/, + /* LU */ /*#__PURE__*//^\d{4}$/, ]; function _testPostalCode(postalCode: string) {