From 6cfeae136d784153b9c58b6540bac94423fc76ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Sun, 11 Jun 2017 23:58:22 +0100 Subject: [PATCH] chore: fix linting with hoisted eslint --- .gitignore | 2 + lerna.json | 2 +- package.json | 8 +- .../src/schema/mutations/firewall-rules.js | 15 +- .../src/schema/mutations/images.js | 24 +- .../cloudapi-gql/src/schema/mutations/keys.js | 9 +- .../src/schema/mutations/machines.js | 24 +- .../src/schema/mutations/policies.js | 9 +- .../src/schema/mutations/roles.js | 15 +- .../cloudapi-gql/src/schema/queries/images.js | 3 +- .../src/schema/queries/machines.js | 12 +- .../src/schema/queries/packages.js | 3 +- .../cloudapi-gql/src/schema/types/audit.js | 15 +- .../cloudapi-gql/src/schema/types/image.js | 33 +- .../cloudapi-gql/src/schema/types/machine.js | 3 +- .../cloudapi-gql/src/schema/types/network.js | 3 +- packages/cloudapi-gql/src/schema/types/nic.js | 6 +- .../cloudapi-gql/src/schema/types/role.js | 6 +- packages/cp-frontend/.eslintrc | 3 +- packages/cp-frontend/package.json | 3 +- packages/cp-frontend/scripts/postinstall.js | 12 +- .../containers/deployment-groups/create.js | 4 +- .../test/unit/__snapshots__/header.js.snap | 87 +- packages/cp-frontend/test/unit/header.js | 6 +- packages/cp-frontend/test/unit/mocks/store.js | 5 +- packages/cp-frontend/test/unit/mocks/theme.js | 5 +- packages/eslint-config/package.json | 18 +- packages/manifest-editor/package.json | 4 +- .../normalized-styled-components/package.json | 17 +- .../test/__snapshots__/index.js.snap | 189 +-- .../test/index.js | 2 +- packages/portal-data/package.json | 2 +- packages/ui-toolkit/src/boxes/index.js | 4 +- packages/ui-toolkit/src/card/description.js | 5 +- packages/ui-toolkit/src/card/group-view.js | 5 +- packages/ui-toolkit/src/card/options.js | 5 +- packages/ui-toolkit/src/card/outlet.js | 5 +- packages/ui-toolkit/src/card/subtitle.js | 5 +- packages/ui-toolkit/src/card/title.js | 5 +- packages/ui-toolkit/src/form/checkbox.js | 5 +- packages/ui-toolkit/src/form/group.js | 14 +- packages/ui-toolkit/src/form/input.js | 5 +- packages/ui-toolkit/src/form/radio.js | 9 +- packages/ui-toolkit/src/form/select.js | 5 +- packages/ui-toolkit/src/form/toggle.js | 5 +- packages/ui-toolkit/src/header/brand.js | 5 +- packages/ui-toolkit/src/header/index.js | 5 +- packages/ui-toolkit/src/header/item.js | 5 +- packages/ui-toolkit/src/list/li.js | 5 +- packages/ui-toolkit/src/list/ul.js | 5 +- packages/ui-toolkit/src/theme/colors.js | 9 +- packages/ui-toolkit/src/tooltip/button.js | 5 +- packages/ui-toolkit/src/topology/index.js | 15 +- .../ui-toolkit/src/topology/node/button.js | 4 +- .../ui-toolkit/src/topology/node/index.js | 4 +- .../ui-toolkit/src/topology/node/metrics.js | 4 +- .../ui-toolkit/src/topology/node/title.js | 5 +- yarn.lock | 1260 ++--------------- 58 files changed, 499 insertions(+), 1458 deletions(-) diff --git a/.gitignore b/.gitignore index fc78865b..f260ecf9 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,5 @@ _todo packages/*/dist packages/*/buid packages/ui-toolkit/styleguide/ +packages/*/package-lock.json + diff --git a/lerna.json b/lerna.json index e50068c4..5955611f 100644 --- a/lerna.json +++ b/lerna.json @@ -3,7 +3,7 @@ "version": "independent", "npmClient": "yarn", "hoist": true, - "nohoist": ["graphi"], + "nohoist": ["graphi", "eslint", "jest", "jest-cli", "react-scripts"], "packages": [ "packages/*" ] diff --git a/package.json b/package.json index 470d1dc3..0461014a 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,14 @@ "format-staged": "./scripts/format --staged", "lint-license": "./scripts/license-to-fail", "lint-docs": "./scripts/quality-docs", - "lint:root": "eslint scripts/* --fix", + "lint-ci:root": "echo 0 `# eslint scripts/* --format junit --output-file $CIRCLE_TEST_REPORTS/lint/container-pilot-dashboard.xml`", + "lint:root": "echo 0 `# eslint scripts/* --fix`", + "lint-ci:packages": "lerna run lint-ci", "lint:packages": "lerna run lint", + "lint-ci": "redrun -s lint-ci:*", "lint": "redrun -s lint:*", + "test-ci": "lerna run test-ci", "test": "lerna run test", - "lint-ci": "eslint scripts/* --format junit --output-file $CIRCLE_TEST_REPORTS/lint/container-pilot-dashboard.xml", - "test-ci": "echo 0", "clean": "lerna clean --yes", "bootstrap": "lerna bootstrap", "dev": "redrun -p dev:*", diff --git a/packages/cloudapi-gql/src/schema/mutations/firewall-rules.js b/packages/cloudapi-gql/src/schema/mutations/firewall-rules.js index 1e249b50..edd60e24 100644 --- a/packages/cloudapi-gql/src/schema/mutations/firewall-rules.js +++ b/packages/cloudapi-gql/src/schema/mutations/firewall-rules.js @@ -5,11 +5,13 @@ const { GraphQLID, GraphQLBoolean, GraphQLString } = require('graphql'); module.exports.createFirewallRule = { type: FirewallRuleType, - description: "Adds a new firewall rule for the specified account. This rule will be added to all the account's instances where it may be necessary", + description: + "Adds a new firewall rule for the specified account. This rule will be added to all the account's instances where it may be necessary", args: { enabled: { type: GraphQLBoolean, - description: 'Indicates if the rule is enabled (optional, false by default)' + description: + 'Indicates if the rule is enabled (optional, false by default)' }, rule: { type: GraphQLString, @@ -31,7 +33,8 @@ module.exports.createFirewallRule = { module.exports.updateFirewallRule = { type: FirewallRuleType, - description: 'Updates the given rule record and -- depending on rule contents -- adds/removes/updates the rule on all the required instances', + description: + 'Updates the given rule record and -- depending on rule contents -- adds/removes/updates the rule on all the required instances', args: { id: { type: GraphQLID, @@ -39,7 +42,8 @@ module.exports.updateFirewallRule = { }, enabled: { type: GraphQLBoolean, - description: 'Indicates if the rule is enabled (optional, false by default)' + description: + 'Indicates if the rule is enabled (optional, false by default)' }, rule: { type: GraphQLString, @@ -85,7 +89,8 @@ module.exports.disableFirewallRule = { module.exports.deleteFirewallRule = { type: FirewallRuleType, - description: 'Removes the given firewall rule from all the required instances', + description: + 'Removes the given firewall rule from all the required instances', args: { id: { type: GraphQLID, diff --git a/packages/cloudapi-gql/src/schema/mutations/images.js b/packages/cloudapi-gql/src/schema/mutations/images.js index 31644e18..31a8ca50 100644 --- a/packages/cloudapi-gql/src/schema/mutations/images.js +++ b/packages/cloudapi-gql/src/schema/mutations/images.js @@ -15,35 +15,43 @@ module.exports.createImage = { args: { machine: { type: new GraphQLNonNull(GraphQLID), - description: 'The prepared and stopped instance UUID from which the image is to be created' + description: + 'The prepared and stopped instance UUID from which the image is to be created' }, name: { type: new GraphQLNonNull(GraphQLString), - description: 'The name of the custom image, e.g. "my-image". Maximum 512 characters. However, typical names should be much shorter, e.g. 5-20 characters' + description: + 'The name of the custom image, e.g. "my-image". Maximum 512 characters. However, typical names should be much shorter, e.g. 5-20 characters' }, version: { type: new GraphQLNonNull(GraphQLString), - description: 'The version of the custom image, e.g. "1.0.0". Maximum 128 characters' + description: + 'The version of the custom image, e.g. "1.0.0". Maximum 128 characters' }, description: { type: GraphQLString, - description: 'A short prose description of this image. Maximum 512 characters' + description: + 'A short prose description of this image. Maximum 512 characters' }, homepage: { type: GraphQLString, - description: 'Homepage URL where users can find more information about the image. Maximum 128 characters' + description: + 'Homepage URL where users can find more information about the image. Maximum 128 characters' }, eula: { type: GraphQLString, - description: 'URL of the End User License Agreement (EULA) for the image. Maximum 128 characters' + description: + 'URL of the End User License Agreement (EULA) for the image. Maximum 128 characters' }, acl: { type: new GraphQLList(GraphQLID), - description: 'An array of user/account UUIDs to which to give read access to a private image. I.e. this is only relevant for images with public === false' + description: + 'An array of user/account UUIDs to which to give read access to a private image. I.e. this is only relevant for images with public === false' }, tags: { type: DynamicObjectType, - description: 'An object of key/value pairs that allows clients to categorize images by any given criteria' + description: + 'An object of key/value pairs that allows clients to categorize images by any given criteria' } }, resolve: (root, args) => { diff --git a/packages/cloudapi-gql/src/schema/mutations/keys.js b/packages/cloudapi-gql/src/schema/mutations/keys.js index 3cff4ecd..2320015c 100644 --- a/packages/cloudapi-gql/src/schema/mutations/keys.js +++ b/packages/cloudapi-gql/src/schema/mutations/keys.js @@ -5,7 +5,8 @@ const { GraphQLNonNull, GraphQLString, GraphQLID } = require('graphql'); module.exports.createKey = { type: KeyType, - description: 'Uploads a new OpenSSH key to Triton for use in HTTP signing and SSH', + description: + 'Uploads a new OpenSSH key to Triton for use in HTTP signing and SSH', args: { name: { type: new GraphQLNonNull(GraphQLString) @@ -15,7 +16,8 @@ module.exports.createKey = { }, userId: { type: GraphQLID, - description: 'UserId to add this key to. Leaving this in blank will add the key to the account' + description: + 'UserId to add this key to. Leaving this in blank will add the key to the account' } }, resolve: (root, args) => { @@ -36,7 +38,8 @@ module.exports.deleteKey = { }, userId: { type: GraphQLID, - description: 'UserId who this key belongs to. Leaving this in blank will delete an account key' + description: + 'UserId who this key belongs to. Leaving this in blank will delete an account key' } }, resolve: (root, args) => { diff --git a/packages/cloudapi-gql/src/schema/mutations/machines.js b/packages/cloudapi-gql/src/schema/mutations/machines.js index eb402031..eea63c7d 100644 --- a/packages/cloudapi-gql/src/schema/mutations/machines.js +++ b/packages/cloudapi-gql/src/schema/mutations/machines.js @@ -16,11 +16,13 @@ module.exports.createMachine = { args: { name: { type: GraphQLString, - description: 'Friendly name for this instance; default is the first 8 characters of the machine id' + description: + 'Friendly name for this instance; default is the first 8 characters of the machine id' }, package: { type: new GraphQLNonNull(GraphQLString), - description: 'Id of the package to use on provisioning, obtained from ListPackages' + description: + 'Id of the package to use on provisioning, obtained from ListPackages' }, image: { type: new GraphQLNonNull(GraphQLString), @@ -32,11 +34,13 @@ module.exports.createMachine = { }, locality: { type: MachineType.locality, - description: 'Optionally specify which instances the new instance should be near or far from' + description: + 'Optionally specify which instances the new instance should be near or far from' }, metadata: { type: DynamicObjectType, - description: 'An arbitrary set of metadata key/value pairs can be set at provision time' + description: + 'An arbitrary set of metadata key/value pairs can be set at provision time' }, tags: { type: DynamicObjectType, @@ -44,7 +48,8 @@ module.exports.createMachine = { }, firewallEnabled: { type: GraphQLBoolean, - description: 'Completely enable or disable firewall for this instance. Default is false' + description: + 'Completely enable or disable firewall for this instance. Default is false' } }, resolve: (root, args) => { @@ -98,7 +103,8 @@ module.exports.startMachine = { module.exports.startMachineFromSnapshot = { type: MachineType, - description: 'If an instance is in the "stopped" state, you can choose to start the instance from the referenced snapshot', + description: + 'If an instance is in the "stopped" state, you can choose to start the instance from the referenced snapshot', args: { id: { type: new GraphQLNonNull(GraphQLID), @@ -176,7 +182,8 @@ module.exports.deleteMachine = { module.exports.auditMachine = { type: new GraphQLList(DynamicObjectType), - description: "Provides a list of an instance's accomplished actions. Results are sorted from newest to oldest action", + description: + "Provides a list of an instance's accomplished actions. Results are sorted from newest to oldest action", args: { id: { type: new GraphQLNonNull(GraphQLID), @@ -309,7 +316,8 @@ module.exports.deleteMachineTags = { }, tag: { type: GraphQLString, - description: 'Tag name to remove. If value is not supplied, all machine tags are removed' + description: + 'Tag name to remove. If value is not supplied, all machine tags are removed' } }, resolve: (root, args) => { diff --git a/packages/cloudapi-gql/src/schema/mutations/policies.js b/packages/cloudapi-gql/src/schema/mutations/policies.js index 59daa97a..30a2012d 100644 --- a/packages/cloudapi-gql/src/schema/mutations/policies.js +++ b/packages/cloudapi-gql/src/schema/mutations/policies.js @@ -18,7 +18,8 @@ module.exports.createPolicy = { }, rules: { type: new GraphQLNonNull(new GraphQLList(GraphQLString)), - description: 'One or more Aperture sentences to be added to the current policy' + description: + 'One or more Aperture sentences to be added to the current policy' }, description: { type: GraphQLString, @@ -32,7 +33,8 @@ module.exports.createPolicy = { module.exports.updatePolicy = { type: PolicyType, - description: 'Upgrades an existing account policy. Everything but id can be modified', + description: + 'Upgrades an existing account policy. Everything but id can be modified', args: { id: { type: new GraphQLNonNull(GraphQLID) @@ -43,7 +45,8 @@ module.exports.updatePolicy = { }, rules: { type: new GraphQLNonNull(new GraphQLList(GraphQLString)), - description: 'One or more Aperture sentences to be added to the current policy' + description: + 'One or more Aperture sentences to be added to the current policy' }, description: { type: GraphQLString, diff --git a/packages/cloudapi-gql/src/schema/mutations/roles.js b/packages/cloudapi-gql/src/schema/mutations/roles.js index d2323fd2..45a26890 100644 --- a/packages/cloudapi-gql/src/schema/mutations/roles.js +++ b/packages/cloudapi-gql/src/schema/mutations/roles.js @@ -22,11 +22,13 @@ module.exports.createRole = { }, members: { type: new GraphQLList(GraphQLString), - description: "This account's user logins to be added to this role (Optional)" + description: + "This account's user logins to be added to this role (Optional)" }, defaultMembers: { type: new GraphQLList(GraphQLString), - description: "This account's user logins to be added to this role and have it enabled by default (Optional)" + description: + "This account's user logins to be added to this role and have it enabled by default (Optional)" } }, resolve: (root, args) => { @@ -51,11 +53,13 @@ module.exports.updateRole = { }, members: { type: new GraphQLList(GraphQLString), - description: "This account's user logins to be added to this role (Optional)" + description: + "This account's user logins to be added to this role (Optional)" }, defaultMembers: { type: new GraphQLList(GraphQLString), - description: "This account's user logins to be added to this role and have it enabled by default (Optional)" + description: + "This account's user logins to be added to this role and have it enabled by default (Optional)" } }, resolve: (root, args) => { @@ -80,7 +84,8 @@ module.exports.deleteRole = { module.exports.setRoleTags = { type: RoleType.tag, - description: "Sets the given role tags to the provided resource path. resource_path can be the path to any of the CloudAPI resources described in this document: account, keys, users, roles, policies, user's ssh keys, datacenters, images, packages, instances, analytics, instrumentations, firewall rules and networks.", + description: + "Sets the given role tags to the provided resource path. resource_path can be the path to any of the CloudAPI resources described in this document: account, keys, users, roles, policies, user's ssh keys, datacenters, images, packages, instances, analytics, instrumentations, firewall rules and networks.", args: { resource: { type: new GraphQLNonNull(GraphQLString), diff --git a/packages/cloudapi-gql/src/schema/queries/images.js b/packages/cloudapi-gql/src/schema/queries/images.js index 116dc016..4ee79ae3 100644 --- a/packages/cloudapi-gql/src/schema/queries/images.js +++ b/packages/cloudapi-gql/src/schema/queries/images.js @@ -29,7 +29,8 @@ module.exports = { }, state: { type: GraphQLString, - description: 'Filter on image state. By default only active images are shown. Use "all" to list all images' + description: + 'Filter on image state. By default only active images are shown. Use "all" to list all images' }, owner: { type: GraphQLString, diff --git a/packages/cloudapi-gql/src/schema/queries/machines.js b/packages/cloudapi-gql/src/schema/queries/machines.js index 186904a5..32100ec0 100644 --- a/packages/cloudapi-gql/src/schema/queries/machines.js +++ b/packages/cloudapi-gql/src/schema/queries/machines.js @@ -16,7 +16,8 @@ module.exports = { }, name: { type: GraphQLString, - description: 'Machine name to find (will make your list size 1, or 0 if nothing found)' + description: + 'Machine name to find (will make your list size 1, or 0 if nothing found)' }, image: { type: GraphQLString, @@ -36,7 +37,8 @@ module.exports = { }, first: { type: GraphQLInt, - description: 'Return a max of N instances; default is 1000 (which is also the maximum allowable result set size)' + description: + 'Return a max of N instances; default is 1000 (which is also the maximum allowable result set size)' }, after: { type: GraphQLInt, @@ -48,11 +50,13 @@ module.exports = { }, docker: { type: GraphQLString, - description: 'Whether to only list Docker instances, or only non-Docker instances, if present. Defaults to showing all instances.' + description: + 'Whether to only list Docker instances, or only non-Docker instances, if present. Defaults to showing all instances.' }, credentials: { type: GraphQLString, - description: 'Whether to include the generated credentials for instances, if present. Defaults to false' + description: + 'Whether to include the generated credentials for instances, if present. Defaults to false' } }, resolve(root, args) { diff --git a/packages/cloudapi-gql/src/schema/queries/packages.js b/packages/cloudapi-gql/src/schema/queries/packages.js index c516c127..b5cfd5a3 100644 --- a/packages/cloudapi-gql/src/schema/queries/packages.js +++ b/packages/cloudapi-gql/src/schema/queries/packages.js @@ -29,7 +29,8 @@ module.exports = { }, lwps: { type: GraphQLInt, - description: 'Filter on maximum number of light-weight processes (threads) allowed' + description: + 'Filter on maximum number of light-weight processes (threads) allowed' }, vcpus: { type: GraphQLInt, diff --git a/packages/cloudapi-gql/src/schema/types/audit.js b/packages/cloudapi-gql/src/schema/types/audit.js index 5ac4794a..bc28a493 100644 --- a/packages/cloudapi-gql/src/schema/types/audit.js +++ b/packages/cloudapi-gql/src/schema/types/audit.js @@ -7,19 +7,23 @@ const CallerType = new GraphQLObjectType({ fields: { type: { type: GraphQLString, - description: 'Authentication type for the action request. One of "basic", "operator", "signature" or "token"' + description: + 'Authentication type for the action request. One of "basic", "operator", "signature" or "token"' }, user: { type: GraphQLString, - description: 'When the authentication type is "basic", this member will be present and include user login' + description: + 'When the authentication type is "basic", this member will be present and include user login' }, ip: { type: GraphQLString, - description: 'The IP addresses this from which the action was requested. Not present if type is "operator"' + description: + 'The IP addresses this from which the action was requested. Not present if type is "operator"' }, keyId: { type: GraphQLString, - description: 'When authentication type is either "signature" or "token", SSH key identifier' + description: + 'When authentication type is either "signature" or "token", SSH key identifier' } } }); @@ -33,7 +37,8 @@ module.exports = new GraphQLObjectType({ }, parameters: { type: DynamicObjectType, - description: 'The original set of parameters sent when the action was requested' + description: + 'The original set of parameters sent when the action was requested' }, success: { type: GraphQLBoolean, diff --git a/packages/cloudapi-gql/src/schema/types/image.js b/packages/cloudapi-gql/src/schema/types/image.js index 3154af37..4a5683d2 100644 --- a/packages/cloudapi-gql/src/schema/types/image.js +++ b/packages/cloudapi-gql/src/schema/types/image.js @@ -14,7 +14,8 @@ const ErrorType = new GraphQLObjectType({ fields: { code: { type: GraphQLString, - description: 'A CamelCase string code for this error, e.g. "PrepareImageDidNotRun". See GetImage docs for a table of error.code values' + description: + 'A CamelCase string code for this error, e.g. "PrepareImageDidNotRun". See GetImage docs for a table of error.code values' }, message: { type: GraphQLString, @@ -28,11 +29,13 @@ const ImageFileType = new GraphQLObjectType({ fields: { compression: { type: GraphQLString, - description: 'The type of file compression used for the image file. One of "bzip2", "gzip", "none"' + description: + 'The type of file compression used for the image file. One of "bzip2", "gzip", "none"' }, sha1: { type: GraphQLString, - description: 'SHA-1 hex digest of the file content. Used for corruption checking' + description: + 'SHA-1 hex digest of the file content. Used for corruption checking' }, size: { type: GraphQLInt, @@ -43,7 +46,8 @@ const ImageFileType = new GraphQLObjectType({ module.exports = new GraphQLObjectType({ name: 'ImageType', - description: 'An image contains the software packages that will be available on newly-provisioned instance. In the case of hardware virtual machines, the image also includes the operating system', + description: + 'An image contains the software packages that will be available on newly-provisioned instance. In the case of hardware virtual machines, the image also includes the operating system', fields: { id: { type: GraphQLID, @@ -67,15 +71,18 @@ module.exports = new GraphQLObjectType({ }, requirements: { type: DynamicObjectType, - description: 'Contains a grouping of various minimum requirements for provisioning an instance with this image. For example "password" indicates that a password must be provided' + description: + 'Contains a grouping of various minimum requirements for provisioning an instance with this image. For example "password" indicates that a password must be provided' }, homepage: { type: GraphQLString, - description: 'The URL for a web page with more detailed information for this image' + description: + 'The URL for a web page with more detailed information for this image' }, files: { type: new GraphQLList(ImageFileType), - description: 'An array of image files that make up each image. Currently only a single file per image is supported' + description: + 'An array of image files that make up each image. Currently only a single file per image is supported' }, publishedAt: { type: GraphQLString, @@ -94,11 +101,13 @@ module.exports = new GraphQLObjectType({ }, state: { type: GraphQLString, - description: 'The current state of the image. One of "active", "unactivated", "disabled", "creating", "failed"' + description: + 'The current state of the image. One of "active", "unactivated", "disabled", "creating", "failed"' }, tags: { type: DynamicObjectType, - description: 'An object of key/value pairs that allows clients to categorize images by any given criteria' + description: + 'An object of key/value pairs that allows clients to categorize images by any given criteria' }, eula: { type: GraphQLString, @@ -106,11 +115,13 @@ module.exports = new GraphQLObjectType({ }, acl: { type: new GraphQLList(GraphQLString), - description: 'Access Control List. An array of account UUIDs given access to a private image. The field is only relevant to private images' + description: + 'Access Control List. An array of account UUIDs given access to a private image. The field is only relevant to private images' }, error: { type: ErrorType, - description: 'If state=="failed", resulting from CreateImageFromMachine failure, then there may be an error object of the form {"code": "", "message": ""}' + description: + 'If state=="failed", resulting from CreateImageFromMachine failure, then there may be an error object of the form {"code": "", "message": ""}' } } }); diff --git a/packages/cloudapi-gql/src/schema/types/machine.js b/packages/cloudapi-gql/src/schema/types/machine.js index 62f2e16c..f04688e9 100644 --- a/packages/cloudapi-gql/src/schema/types/machine.js +++ b/packages/cloudapi-gql/src/schema/types/machine.js @@ -14,7 +14,8 @@ const { module.exports = new GraphQLObjectType({ name: 'MachineType', - description: 'An image contains the software packages that will be available on newly-provisioned instance. In the case of hardware virtual machines, the image also includes the operating system', + description: + 'An image contains the software packages that will be available on newly-provisioned instance. In the case of hardware virtual machines, the image also includes the operating system', // Function to allow circular dependencies fields: () => ({ id: { diff --git a/packages/cloudapi-gql/src/schema/types/network.js b/packages/cloudapi-gql/src/schema/types/network.js index 2aba7b95..d844ffed 100644 --- a/packages/cloudapi-gql/src/schema/types/network.js +++ b/packages/cloudapi-gql/src/schema/types/network.js @@ -10,7 +10,8 @@ const { module.exports = new GraphQLObjectType({ name: 'NetworkType', - description: 'Logical networks in Triton model core network configurations to enable Triton to define Virtual Network Interfaces and IP addresses for instances', + description: + 'Logical networks in Triton model core network configurations to enable Triton to define Virtual Network Interfaces and IP addresses for instances', fields: { id: { type: GraphQLID, diff --git a/packages/cloudapi-gql/src/schema/types/nic.js b/packages/cloudapi-gql/src/schema/types/nic.js index 7cae5e1a..12e0f2aa 100644 --- a/packages/cloudapi-gql/src/schema/types/nic.js +++ b/packages/cloudapi-gql/src/schema/types/nic.js @@ -2,7 +2,8 @@ const { GraphQLBoolean, GraphQLObjectType, GraphQLString } = require('graphql'); module.exports = new GraphQLObjectType({ name: 'NicType', - description: 'Logical networks are used both on head nodes and compute nodes, and are associated with physical interfaces by using a system called NIC Tags', + description: + 'Logical networks are used both on head nodes and compute nodes, and are associated with physical interfaces by using a system called NIC Tags', fields: { ip: { type: GraphQLString, @@ -29,7 +30,8 @@ module.exports = new GraphQLObjectType({ }, state: { type: GraphQLString, - description: 'Describes the state of the NIC (e.g. provisioning, running, or stopped)' + description: + 'Describes the state of the NIC (e.g. provisioning, running, or stopped)' }, network: { type: GraphQLString, diff --git a/packages/cloudapi-gql/src/schema/types/role.js b/packages/cloudapi-gql/src/schema/types/role.js index 196332d5..2a7442ff 100644 --- a/packages/cloudapi-gql/src/schema/types/role.js +++ b/packages/cloudapi-gql/src/schema/types/role.js @@ -7,7 +7,8 @@ const { module.exports = new GraphQLObjectType({ name: 'RoleType', - description: 'Roles are lists of users and policies. Roles describe which users are allowed access according to the policies', + description: + 'Roles are lists of users and policies. Roles describe which users are allowed access according to the policies', fields: { id: { type: GraphQLID, @@ -27,7 +28,8 @@ module.exports = new GraphQLObjectType({ }, defaultMembers: { type: new GraphQLList(GraphQLString), - description: "This account's user logins this role applies to by default (Optional)" + description: + "This account's user logins this role applies to by default (Optional)" } } }); diff --git a/packages/cp-frontend/.eslintrc b/packages/cp-frontend/.eslintrc index c02f3ac3..b17555dc 100644 --- a/packages/cp-frontend/.eslintrc +++ b/packages/cp-frontend/.eslintrc @@ -1,6 +1,7 @@ { "extends": "joyent-portal", "rules": { - "no-console": 0 + "no-console": 0, + "new-cap": 0 } } diff --git a/packages/cp-frontend/package.json b/packages/cp-frontend/package.json index ca69c129..366eabbc 100644 --- a/packages/cp-frontend/package.json +++ b/packages/cp-frontend/package.json @@ -15,7 +15,7 @@ "lint-ci:js": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/cp-frontend.xml", "lint-ci": "redrun -p lint-ci:*", "test": "NODE_ENV=test ./test/run --env=jsdom", - "test-ci": "NODE_ENV=test JEST_JUNIT_OUTPUT=$CIRCLE_TEST_REPORTS/test/cp-frontend.xml ./test/run --env=jsdom --coverage --coverageDirectory=$CIRCLE_ARTIFACTS/cp-frontend --testResultsProcessor='./node_modules/jest-junit'", + "test-ci": "NODE_ENV=test JEST_JUNIT_OUTPUT=$CIRCLE_TEST_REPORTS/test/cp-frontend.xml ./test/run --env=jsdom --coverage --coverageDirectory=$CIRCLE_ARTIFACTS/cp-frontend --testResultsProcessor=$(node -e \"console.log(require.resolve('jest-junit'))\")", "postinstall": "node scripts/postinstall" }, "dependencies": { @@ -23,6 +23,7 @@ "apr-intercept": "^1.0.4", "constant-case": "^2.0.0", "graphql-tag": "^2.2.2", + "jest-cli": "^20.0.4", "joyent-manifest-editor": "^1.0.0", "joyent-ui-toolkit": "^1.1.0", "lodash.isstring": "^4.0.1", diff --git a/packages/cp-frontend/scripts/postinstall.js b/packages/cp-frontend/scripts/postinstall.js index 2ddce2b8..010ecb23 100644 --- a/packages/cp-frontend/scripts/postinstall.js +++ b/packages/cp-frontend/scripts/postinstall.js @@ -4,6 +4,7 @@ const forEach = require('apr-for-each'); const find = require('apr-find'); const path = require('path'); +const ROOT = path.join(__dirname, '../node_modules/react-scripts/config'); const configs = ['webpack.config.dev', 'webpack.config.prod']; const toCopy = [ @@ -12,8 +13,6 @@ const toCopy = [ 'webpack.config.prod' ]; -let ROOT; - const backup = async file => { const backupPath = path.join(ROOT, `${file}.original.js`); const backupExists = await exists(backupPath); @@ -37,15 +36,6 @@ const copy = async file => { main( (async () => { - ROOT = await find([ - path.join(__dirname, '../node_modules/react-scripts/config'), - path.join(__dirname, '../../../node_modules/react-scripts/config') - ], exists); - - if (!ROOT) { - throw new Error('react-scripts not found'); - } - await forEach(configs, backup); await forEach(toCopy, copy); })() diff --git a/packages/cp-frontend/src/containers/deployment-groups/create.js b/packages/cp-frontend/src/containers/deployment-groups/create.js index 6b74e525..a95e6da9 100644 --- a/packages/cp-frontend/src/containers/deployment-groups/create.js +++ b/packages/cp-frontend/src/containers/deployment-groups/create.js @@ -3,7 +3,6 @@ import { reduxForm } from 'redux-form'; import { compose, graphql } from 'react-apollo'; import { Redirect } from 'react-router-dom'; import intercept from 'apr-intercept'; -import PropTypes from 'prop-types'; import paramCase from 'param-case'; import DeploymentGroupBySlug from '@graphql/DeploymentGroupBySlug.gql'; @@ -29,6 +28,7 @@ const validateName = async ({ name = '' }) => { }); if (data.deploymentGroups.length) { + // eslint-disable-next-line no-throw-literal throw { name: `"${name}" already exists!` }; } }; @@ -132,7 +132,7 @@ class DeploymentGroupCreate extends Component { const { manifest } = this.state; const { provisionManifest } = this.props; - const [err, { data }] = await intercept( + const [err] = await intercept( provisionManifest({ deploymentGroupId, type: 'COMPOSE', diff --git a/packages/cp-frontend/test/unit/__snapshots__/header.js.snap b/packages/cp-frontend/test/unit/__snapshots__/header.js.snap index 3ba63072..361e0c3d 100644 --- a/packages/cp-frontend/test/unit/__snapshots__/header.js.snap +++ b/packages/cp-frontend/test/unit/__snapshots__/header.js.snap @@ -1,6 +1,85 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders
without throwing 1`] = ` +.iKAUmn { + font-family: "Libre Franklin",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica,sans-serif; + font-weight: 500; + font-size: 1.5rem; + -webkit-text-transform: uppercase; + text-transform: uppercase; + color: ; + font-size: 1.8125rem; + margin: 0; +} + +.eVSukw { + -webkit-flex: 1 1 auto; + -ms-flex: 1 1 auto; + flex: 1 1 auto; + -webkit-align-self: stretch; + -ms-flex-item-align: stretch; + align-self: stretch; + -webkit-order: 0; + -ms-flex-order: 0; + order: 0; + padding: 0.9375rem 0; +} + +.facVTr { + font-family: "Libre Franklin",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica,sans-serif; + font-weight: 400; + line-height: 1.5rem; + font-size: 0.9375rem; + font-weight: 600; + text-align: center; + color: ; + margin: 0; +} + +.hnPDgK { + -webkit-flex: 0 1 auto; + -ms-flex: 0 1 auto; + flex: 0 1 auto; + -webkit-align-self: auto; + -ms-flex-item-align: auto; + align-self: auto; + -webkit-order: 0; + -ms-flex-order: 0; + order: 0; + padding: 0.9375rem 0; + width: 6.25rem; + max-width: 6.25rem; +} + +.fAWQXE { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + -webkit-flex-wrap: nowrap; + -ms-flex-wrap: nowrap; + flex-wrap: nowrap; + -webkit-box-pack: space-between; + -webkit-justify-content: space-between; + -ms-flex-pack: space-between; + justify-content: space-between; + -webkit-align-content: stretch; + -ms-flex-line-pack: stretch; + align-content: stretch; + -webkit-align-items: stretch; + -webkit-box-align: stretch; + -ms-flex-align: stretch; + align-items: stretch; + background-color: ; + max-height: 3.3125rem; + min-height: 3.3125rem; + padding: 0 1.125rem; + line-height: 1.5625rem; +} +
@@ -8,14 +87,14 @@ exports[`renders
without throwing 1`] = ` className="brand__Box-cSEQoZ eVSukw" >

@@ -25,14 +104,14 @@ exports[`renders
without throwing 1`] = ` className="item__Box-hzIdkQ hnPDgK" >

diff --git a/packages/cp-frontend/test/unit/header.js b/packages/cp-frontend/test/unit/header.js index 194a7f57..ce946771 100644 --- a/packages/cp-frontend/test/unit/header.js +++ b/packages/cp-frontend/test/unit/header.js @@ -2,14 +2,14 @@ * @jest-environment node */ -// import 'jest-styled-components'; - import React from 'react'; import renderer from 'react-test-renderer'; +import 'jest-styled-components'; + import Header from '@components/navigation/header'; import { Router } from './mocks'; it('renders
without throwing', () => { const tree = renderer.create(
).toJSON(); - expect(tree).toMatchSnapshot(); + expect(tree).toMatchStyledComponentsSnapshot(); }); diff --git a/packages/cp-frontend/test/unit/mocks/store.js b/packages/cp-frontend/test/unit/mocks/store.js index e125d5c0..b0d828c0 100644 --- a/packages/cp-frontend/test/unit/mocks/store.js +++ b/packages/cp-frontend/test/unit/mocks/store.js @@ -2,6 +2,5 @@ import React from 'react'; import { client, store } from '@state/store'; import { ApolloProvider } from 'react-apollo'; -export default ({ children }) => ( - {children} -); +export default ({ children }) => + {children}; diff --git a/packages/cp-frontend/test/unit/mocks/theme.js b/packages/cp-frontend/test/unit/mocks/theme.js index 5b1a2a45..f209a958 100644 --- a/packages/cp-frontend/test/unit/mocks/theme.js +++ b/packages/cp-frontend/test/unit/mocks/theme.js @@ -2,6 +2,5 @@ import React from 'react'; import { ThemeProvider } from 'styled-components'; import { theme } from 'joyent-ui-toolkit'; -export default ({ children }) => ( - {children} -); +export default ({ children }) => + {children}; diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 4d606232..722bab32 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -10,14 +10,26 @@ "test": "echo 0", "test-ci": "echo 0" }, + "devDependencies": { + "babel-eslint": "^7.2.3", + "eslint": "^3.19.0", + "eslint-config-prettier": "^2.1.1", + "eslint-config-react-app": "^1.0.4", + "eslint-config-xo-space": "^0.16.0", + "eslint-plugin-flowtype": "^2.34.0", + "eslint-plugin-import": "^2.3.0", + "eslint-plugin-jsx-a11y": "^5.0.3", + "eslint-plugin-prettier": "^2.1.1", + "eslint-plugin-react": "^7.0.1" + }, "peerDependencies": { "babel-eslint": "^7.2.3", "eslint": "^3.19.0", "eslint-config-prettier": "^2.1.1", - "eslint-config-react-app": "^0.6.2", + "eslint-config-react-app": "^1.0.4", "eslint-config-xo-space": "^0.16.0", - "eslint-plugin-flowtype": "^2.33.0", - "eslint-plugin-import": "^2.2.0", + "eslint-plugin-flowtype": "^2.34.0", + "eslint-plugin-import": "^2.3.0", "eslint-plugin-jsx-a11y": "^5.0.3", "eslint-plugin-prettier": "^2.1.1", "eslint-plugin-react": "^7.0.1" diff --git a/packages/manifest-editor/package.json b/packages/manifest-editor/package.json index 9007131c..1ce583e3 100644 --- a/packages/manifest-editor/package.json +++ b/packages/manifest-editor/package.json @@ -17,8 +17,8 @@ "lint-ci:js": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/manifest-editor.xml", "lint": "redrun -s lint:*", "lint-ci": "redrun -p lint-ci:*", - "test": "echo 0 # bup && NODE_ENV=test jest --coverage", - "test-ci": "echo 0 # NODE_ENV=test JEST_JUNIT_OUTPUT=$CIRCLE_TEST_REPORTS/test/manifest-editor.xml jest --coverage --coverageDirectory=$CIRCLE_ARTIFACTS/manifest-editor --testResultsProcessor='./node_modules/jest-junit'", + "test": "echo 0 `# bup && NODE_ENV=test jest --coverage`", + "test-ci": "echo 0 `# NODE_ENV=test JEST_JUNIT_OUTPUT=$CIRCLE_TEST_REPORTS/test/manifest-editor.xml jest --coverage --coverageDirectory=$CIRCLE_ARTIFACTS/manifest-editor --testResultsProcessor=$(node -e \"console.log(require.resolve('jest-junit'))\")`", "build": "bup", "prepublish": "redrun build" }, diff --git a/packages/normalized-styled-components/package.json b/packages/normalized-styled-components/package.json index 1b60c53f..613844fb 100644 --- a/packages/normalized-styled-components/package.json +++ b/packages/normalized-styled-components/package.json @@ -25,7 +25,7 @@ "lint": "redrun -s lint:*", "lint-ci": "redrun -p lint-ci:*", "test": "bup && NODE_ENV=test jest --coverage", - "test-ci": "NODE_ENV=test JEST_JUNIT_OUTPUT=$CIRCLE_TEST_REPORTS/test/normalized-styled-components.xml jest --coverage --coverageDirectory=$CIRCLE_ARTIFACTS/normalized-styled-components --testResultsProcessor='./node_modules/jest-junit'", + "test-ci": "NODE_ENV=test JEST_JUNIT_OUTPUT=$CIRCLE_TEST_REPORTS/test/normalized-styled-components.xml jest --coverage --coverageDirectory=$CIRCLE_ARTIFACTS/normalized-styled-components --testResultsProcessor=$(node -e \"console.log(require.resolve('jest-junit'))\")", "build": "bup", "prepublish": "redrun build" }, @@ -46,6 +46,7 @@ "jest-snapshot": "^20.0.3", "jest-styled-components": "^3.0.0-2", "react": "^15.5.4", + "react-scripts": "^1.0.7", "react-test-renderer": "^15.5.4", "redrun": "^5.9.14", "strip-ansi": "^3.0.1", @@ -60,7 +61,19 @@ "styled-components": "*" }, "jest": { + "testEnvironment": "jsdom", + "testRegex": "test/index.js", + "setupFiles": [ + "/node_modules/react-scripts/config/polyfills.js" + ], "testEnvironment": "node", - "testRegex": "test/index.js" + "transform": { + "^.+\\.(js|jsx)$": "/node_modules/react-scripts/config/jest/babelTransform.js", + "^(?!.*\\.(js|jsx|css|json)$)": "/node_modules/react-scripts/config/jest/fileTransform.js" + }, + "transformIgnorePatterns": [ + "[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$" + ], + "rootDir": "." } } diff --git a/packages/normalized-styled-components/test/__snapshots__/index.js.snap b/packages/normalized-styled-components/test/__snapshots__/index.js.snap index bd4f1669..43754094 100644 --- a/packages/normalized-styled-components/test/__snapshots__/index.js.snap +++ b/packages/normalized-styled-components/test/__snapshots__/index.js.snap @@ -1,13 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders correctly 1`] = ` -.lovCuy { +.jleQxG { background-color: transparent; + -webkit-text-decoration-skip: objects; text-decoration-skip: objects; } `; @@ -15,215 +16,216 @@ exports[`renders correctly 1`] = ` `; exports[`renders
correctly 1`] = ` -.ikMeRt { +.fpcbkF { display: block; }
`; exports[`renders