Skip to content

Commit

Permalink
chore: update prettier (#5412)
Browse files Browse the repository at this point in the history
  • Loading branch information
smashercosmo authored May 19, 2021
1 parent 4673849 commit 39f1137
Show file tree
Hide file tree
Showing 66 changed files with 1,625 additions and 1,763 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"arrowParens": "avoid",
"trailingComma": "all",
"singleQuote": true,
"printWidth": 100
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
"nock": "^13.0.0",
"node-fetch": "^2.3.0",
"npm-run-all": "^4.1.5",
"prettier": "^1.19.1",
"prettier": "^2.3.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-test-renderer": "^16.8.4",
Expand Down
6 changes: 3 additions & 3 deletions packages/netlify-cms-backend-bitbucket/src/implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ export default class BitbucketBackend implements Implementation {
}

apiRequestFunction = async (req: ApiRequest) => {
const token = (this.refreshedTokenPromise
? await this.refreshedTokenPromise
: this.token) as string;
const token = (
this.refreshedTokenPromise ? await this.refreshedTokenPromise : this.token
) as string;

const authorizedRequest = unsentRequest.withHeaders({ Authorization: `Bearer ${token}` }, req);
const response: Response = await unsentRequest.performRequest(authorizedRequest);
Expand Down
12 changes: 6 additions & 6 deletions packages/netlify-cms-backend-github/src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ export default class API {
let responseStatus = 500;

try {
const req = (unsentRequest.fromFetchArguments(url, {
const req = unsentRequest.fromFetchArguments(url, {
...options,
headers,
}) as unknown) as ApiRequest;
}) as unknown as ApiRequest;
const response = await requestWithBackoff(this, req);
responseStatus = response.status;
const parsedResponse = await parser(response);
Expand Down Expand Up @@ -366,8 +366,7 @@ export default class API {
.catch(() => {
// Meta ref doesn't exist
const readme = {
raw:
'# Netlify CMS\n\nThis tree is used by the Netlify CMS to store metadata information for specific files and branches.',
raw: '# Netlify CMS\n\nThis tree is used by the Netlify CMS to store metadata information for specific files and branches.',
};

return this.uploadBlob(readme)
Expand Down Expand Up @@ -808,7 +807,8 @@ export default class API {
let branches: string[];
if (this.useOpenAuthoring) {
// open authoring branches can exist without a pr
const cmsBranches: Octokit.GitListMatchingRefsResponse = await this.getOpenAuthoringBranches();
const cmsBranches: Octokit.GitListMatchingRefsResponse =
await this.getOpenAuthoringBranches();
branches = cmsBranches.map(b => b.ref.substring('refs/heads/'.length));
// filter irrelevant branches
const branchesWithFilter = await Promise.all(
Expand Down Expand Up @@ -1036,7 +1036,7 @@ export default class API {
author,
committer,
);
return (newCommit as unknown) as GitHubCompareCommit;
return newCommit as unknown as GitHubCompareCommit;
} else {
return commit;
}
Expand Down
6 changes: 2 additions & 4 deletions packages/netlify-cms-backend-github/src/AuthenticationPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ export default class GitHubAuthenticationPage extends React.Component {
};
const auth = new NetlifyAuthenticator(cfg);

const {
open_authoring: openAuthoring = false,
auth_scope: authScope = '',
} = this.props.config.backend;
const { open_authoring: openAuthoring = false, auth_scope: authScope = '' } =
this.props.config.backend;

const scope = authScope || (openAuthoring ? 'public_repo' : 'repo');
auth.authenticate({ provider: 'github', scope }, (err, data) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/netlify-cms-backend-github/src/GraphQLAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export default class GraphQLAPI extends API {

const mapped = pullRequests.nodes.map(transformPullRequest);

return ((mapped as unknown) as Octokit.PullsListResponseItem[]).filter(
return (mapped as unknown as Octokit.PullsListResponseItem[]).filter(
pr => pr.head.ref.startsWith(`${CMS_BRANCH_PREFIX}/`) && predicate(pr),
);
}
Expand Down Expand Up @@ -673,7 +673,7 @@ export default class GraphQLAPI extends API {
},
});
const { pullRequest } = data!.createPullRequest;
return (transformPullRequest(pullRequest) as unknown) as Octokit.PullsCreateResponse;
return transformPullRequest(pullRequest) as unknown as Octokit.PullsCreateResponse;
}

async getFileSha(path: string, { repoURL = this.repoURL, branch = this.branch } = {}) {
Expand Down
6 changes: 3 additions & 3 deletions packages/netlify-cms-backend-github/src/implementation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,9 @@ export default class GitHub implements Implementation {
}

const readFile = (path: string, id: string | null | undefined) =>
this.api!.readFile(path, id, { repoURL: this.api!.originRepoURL }).catch(() => '') as Promise<
string
>;
this.api!.readFile(path, id, { repoURL: this.api!.originRepoURL }).catch(
() => '',
) as Promise<string>;

const entries = await entriesByFiles(
result.files,
Expand Down
6 changes: 2 additions & 4 deletions packages/netlify-cms-backend-gitlab/src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,8 @@ export default class API {
MAINTAINER_ACCESS = 40;

hasWriteAccess = async () => {
const {
shared_with_groups: sharedWithGroups,
permissions,
}: GitLabRepo = await this.requestJSON(this.repoURL);
const { shared_with_groups: sharedWithGroups, permissions }: GitLabRepo =
await this.requestJSON(this.repoURL);

const { project_access: projectAccess, group_access: groupAccess } = permissions;
if (projectAccess && projectAccess.access_level >= this.WRITE_ACCESS) {
Expand Down
10 changes: 2 additions & 8 deletions packages/netlify-cms-backend-gitlab/src/__tests__/gitlab.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,7 @@ describe('gitlab backend', () => {
function interceptFiles(backend, path) {
const api = mockApi(backend);
const url = `${expectedRepoUrl}/repository/files/${encodeURIComponent(path)}/raw`;
api
.get(url)
.query(true)
.reply(200, mockRepo.files[path]);
api.get(url).query(true).reply(200, mockRepo.files[path]);

api
.get(`${expectedRepoUrl}/repository/commits`)
Expand Down Expand Up @@ -391,10 +388,7 @@ describe('gitlab backend', () => {

it('returns an entry from folder collection', async () => {
const entryTree = mockRepo.tree[collectionContentConfig.folder][0];
const slug = entryTree.path
.split('/')
.pop()
.replace('.md', '');
const slug = entryTree.path.split('/').pop().replace('.md', '');

interceptFiles(backend, entryTree.path);
interceptCollection(backend, collectionContentConfig);
Expand Down
2 changes: 1 addition & 1 deletion packages/netlify-cms-backend-proxy/src/implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default class ProxyBackend implements Implementation {
}

authenticate() {
return (Promise.resolve() as unknown) as Promise<User>;
return Promise.resolve() as unknown as Promise<User>;
}

logout() {
Expand Down
4 changes: 2 additions & 2 deletions packages/netlify-cms-backend-test/src/implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function getFile(path: string, tree: RepoTree) {
while (obj && segments.length) {
obj = obj[segments.shift() as string] as RepoTree;
}
return ((obj as unknown) as RepoFile) || {};
return (obj as unknown as RepoFile) || {};
}

function writeFile(path: string, content: string | AssetProxy, tree: RepoTree) {
Expand Down Expand Up @@ -146,7 +146,7 @@ export default class TestBackend implements Implementation {
}

authenticate() {
return (Promise.resolve() as unknown) as Promise<User>;
return Promise.resolve() as unknown as Promise<User>;
}

logout() {
Expand Down
9 changes: 6 additions & 3 deletions packages/netlify-cms-core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,12 @@ declare module 'netlify-cms-core' {
};
}

type GetAssetFunction = (
asset: string,
) => { url: string; path: string; field?: any; fileObj: File };
type GetAssetFunction = (asset: string) => {
url: string;
path: string;
field?: any;
fileObj: File;
};

export type PreviewTemplateComponentProps = {
entry: Map<string, any>;
Expand Down
Loading

0 comments on commit 39f1137

Please sign in to comment.