Skip to content

Commit

Permalink
Fix formatting with Nx formatter (amplication#4357)
Browse files Browse the repository at this point in the history
* Reintroduce formatting and format all

* Update snapshots
  • Loading branch information
arielweinberger authored Nov 14, 2022
1 parent 27dbd79 commit 8f30925
Show file tree
Hide file tree
Showing 577 changed files with 55,036 additions and 5,326 deletions.
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package-lock.json
/coverage
/**/models.ts
helm
.github
.amplication
/generated
/build
/build
__snapshots__
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$schema": "http://json.schemastore.org/prettierrc",
"singleQuote": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"$schema": "http://json.schemastore.org/prettierrc",
"singleQuote": true,
"trailingComma": "all"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "1.0.3",
"scripts": {
"postinstall": "nx run-many --target=install",
"format:check": "npx nx format:check",
"format:write": "npx nx format:write",
"format:check": "npx nx format:check --all",
"format:write": "npx nx format:write --all",
"build": "nx run-many --target=build",
"setup:dev": "ts-node ./script/setup.ts",
"clean": "nx clear-cache",
Expand Down
76 changes: 38 additions & 38 deletions packages/amplication-cli/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
const path = require('path');
const path = require("path");

module.exports = {
parser: '@typescript-eslint/parser',
parser: "@typescript-eslint/parser",
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module'
project: "tsconfig.json",
sourceType: "module",
},
plugins: ['@typescript-eslint/eslint-plugin', 'import'],
plugins: ["@typescript-eslint/eslint-plugin", "import"],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript'
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
],
root: true,
env: {
node: true,
jest: true
jest: true,
},
settings: {
'import/resolver': {
"import/resolver": {
node: {
paths: ['.']
paths: ["."],
},
'eslint-import-resolver-lerna': {
packages: path.resolve(__dirname, '..')
}
}
"eslint-import-resolver-lerna": {
packages: path.resolve(__dirname, ".."),
},
},
},
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'import/no-cycle': 'error',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/naming-convention': [
'error',
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"import/no-cycle": "error",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/naming-convention": [
"error",
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow'
selector: "default",
format: ["camelCase"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow'
selector: "variable",
format: ["camelCase", "UPPER_CASE"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: 'typeLike',
format: ['PascalCase']
selector: "typeLike",
format: ["PascalCase"],
},
{ selector: 'enumMember', format: ['PascalCase'] }
{ selector: "enumMember", format: ["PascalCase"] },
],
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
'@typescript-eslint/no-floating-promises': 'error'
}
"@typescript-eslint/no-unused-vars": ["error", { args: "none" }],
"@typescript-eslint/no-floating-promises": "error",
},
};
6 changes: 3 additions & 3 deletions packages/amplication-cli/src/api/entities-create.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloClient, gql, NormalizedCacheObject } from '@apollo/client/core';
import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client/core";

import * as models from '../models';
import * as models from "../models";

const CREATE_ENTITY = gql`
mutation createEntity($data: EntityCreateInput!) {
Expand Down Expand Up @@ -39,7 +39,7 @@ export async function createEntity(
});

if (!entityData) {
throw new Error('no data');
throw new Error("no data");
}

return entityData?.createOneEntity;
Expand Down
4 changes: 2 additions & 2 deletions packages/amplication-cli/src/api/entities-get.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloClient, gql, NormalizedCacheObject } from '@apollo/client/core';
import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client/core";

import * as models from '../models';
import * as models from "../models";

const GET_ENTITY = gql`
query getEntity($id: String!) {
Expand Down
4 changes: 2 additions & 2 deletions packages/amplication-cli/src/api/entities-list.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloClient, gql, NormalizedCacheObject } from '@apollo/client/core';
import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client/core";

import * as models from '../models';
import * as models from "../models";

const GET_ENTITIES = gql`
query getEntities(
Expand Down
6 changes: 3 additions & 3 deletions packages/amplication-cli/src/api/entities-update.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloClient, gql, NormalizedCacheObject } from '@apollo/client/core';
import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client/core";

import * as models from '../models';
import * as models from "../models";

const UPDATE_ENTITY = gql`
mutation updateEntity($data: EntityUpdateInput!, $where: WhereUniqueInput!) {
Expand Down Expand Up @@ -41,7 +41,7 @@ export async function updateEntity(
});

if (!entityData) {
throw new Error('no data');
throw new Error("no data");
}

return entityData?.updateEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloClient, gql, NormalizedCacheObject } from '@apollo/client/core';
import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client/core";

import * as models from '../models';
import * as models from "../models";

const CREATE_ENTITY_FIELD = gql`
mutation createEntityFieldByDisplayName(
Expand Down Expand Up @@ -35,7 +35,7 @@ export async function createFieldByDisplayName(
});

if (!fieldData) {
throw new Error('no data');
throw new Error("no data");
}

return fieldData.createEntityFieldByDisplayName;
Expand Down
4 changes: 2 additions & 2 deletions packages/amplication-cli/src/api/fields-list.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloClient, gql, NormalizedCacheObject } from '@apollo/client/core';
import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client/core";

import * as models from '../models';
import * as models from "../models";

const GET_FIELDS = gql`
query getEntityFields(
Expand Down
6 changes: 3 additions & 3 deletions packages/amplication-cli/src/api/fields-update.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloClient, gql, NormalizedCacheObject } from '@apollo/client/core';
import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client/core";

import * as models from '../models';
import * as models from "../models";

const UPDATE_ENTITY_FIELD = gql`
mutation updateEntityField(
Expand Down Expand Up @@ -49,7 +49,7 @@ export async function updateField(
});

if (!fieldData) {
throw new Error('no data');
throw new Error("no data");
}

return fieldData.updateEntityField;
Expand Down
24 changes: 12 additions & 12 deletions packages/amplication-cli/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export { getResource } from './resources-get';
export { getResources } from './resources-list';
export { createService } from './resources-create';
export { updateResource } from './resources-update';
export { commitChanges } from './resources-commit';
export { getResource } from "./resources-get";
export { getResources } from "./resources-list";
export { createService } from "./resources-create";
export { updateResource } from "./resources-update";
export { commitChanges } from "./resources-commit";

export { getEntities } from './entities-list';
export { getEntity } from './entities-get';
export { createEntity } from './entities-create';
export { updateEntity } from './entities-update';
export { getEntities } from "./entities-list";
export { getEntity } from "./entities-get";
export { createEntity } from "./entities-create";
export { updateEntity } from "./entities-update";

export { getFields } from './fields-list';
export { createFieldByDisplayName } from './fields-create-by-display-name';
export { updateField } from './fields-update';
export { getFields } from "./fields-list";
export { createFieldByDisplayName } from "./fields-create-by-display-name";
export { updateField } from "./fields-update";
6 changes: 3 additions & 3 deletions packages/amplication-cli/src/api/resources-commit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloClient, gql, NormalizedCacheObject } from '@apollo/client/core';
import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client/core";

import * as models from '../models';
import * as models from "../models";

const COMMIT_CHANGES = gql`
mutation commit($message: String!, $resourceId: String!) {
Expand Down Expand Up @@ -32,7 +32,7 @@ export async function commitChanges(
});

if (!data) {
throw new Error('no data');
throw new Error("no data");
}

return data.commit;
Expand Down
6 changes: 3 additions & 3 deletions packages/amplication-cli/src/api/resources-create.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloClient, gql, NormalizedCacheObject } from '@apollo/client/core';
import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client/core";

import * as models from '../models';
import * as models from "../models";

const CREATE_RESOURCE = gql`
mutation createService($data: ResourceCreateInput!) {
Expand Down Expand Up @@ -43,7 +43,7 @@ export async function createService(
});

if (!data) {
throw new Error('no data');
throw new Error("no data");
}

return data.createService;
Expand Down
4 changes: 2 additions & 2 deletions packages/amplication-cli/src/api/resources-get.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloClient, gql, NormalizedCacheObject } from '@apollo/client/core';
import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client/core";

import * as models from '../models';
import * as models from "../models";

const GET_RESOURCE = gql`
query resource($id: String!) {
Expand Down
4 changes: 2 additions & 2 deletions packages/amplication-cli/src/api/resources-list.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloClient, gql, NormalizedCacheObject } from '@apollo/client/core';
import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client/core";

import * as models from '../models';
import * as models from "../models";

const GET_RESOURCES = gql`
query resources {
Expand Down
6 changes: 3 additions & 3 deletions packages/amplication-cli/src/api/resources-update.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloClient, gql, NormalizedCacheObject } from '@apollo/client/core';
import { ApolloClient, gql, NormalizedCacheObject } from "@apollo/client/core";

import * as models from '../models';
import * as models from "../models";

const UPDATE_RESOURCE = gql`
mutation updateResource($data: ResourceUpdateInput!, $resourceId: String!) {
Expand Down Expand Up @@ -30,7 +30,7 @@ export async function updateResource(
});

if (!resourceData) {
throw new Error('no data');
throw new Error("no data");
}

return resourceData.updateResource;
Expand Down
16 changes: 8 additions & 8 deletions packages/amplication-cli/src/commands/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ConfiguredCommand } from '../configured-command';
import { gql } from '@apollo/client/core';
import * as models from '../models';
import { ConfiguredCommand } from "../configured-command";
import { gql } from "@apollo/client/core";
import * as models from "../models";

type TData = {
me: models.User;
Expand All @@ -20,25 +20,25 @@ const AUTH_QUERY = gql`

export default class Auth extends ConfiguredCommand {
static description =
'authenticate using token generated on amplication server UI';
"authenticate using token generated on amplication server UI";

static args = [{ name: 'token', required: true }];
static args = [{ name: "token", required: true }];

async command() {
const { args } = this.parse(Auth);
this.setConfig('token', args.token);
this.setConfig("token", args.token);

try {
const authData = await this.client.query<TData>({
query: AUTH_QUERY,
});
this.debug('tokenData:', authData);
this.debug("tokenData:", authData);
if (authData.data.me.id)
this.log(
`successfully logged in to Amplication with user ${authData.data.me.account?.firstName} ${authData.data.me.account?.lastName}`
);
} catch (error) {
this.error('Could not authorize user');
this.error("Could not authorize user");
}
}
}
Loading

0 comments on commit 8f30925

Please sign in to comment.