Upgrade prettier to latest (v1.18.2)

Upgrades prettier to the latest version, and auto-corrects files with
yarn prettier-all-save

The diffs all seem to stem from formatting changes in brackets within
template literals. Nothing major.

Relevant changelogs here:

https://prettier.io/blog/2019/04/12/1.17.0.html
https://prettier.io/blog/2019/06/06/1.18.0.html
上级 76f49de4
...@@ -201,9 +201,7 @@ class GfmAutoComplete { ...@@ -201,9 +201,7 @@ class GfmAutoComplete {
const autoCompleteAvatar = m.avatar_url || m.username.charAt(0).toUpperCase(); const autoCompleteAvatar = m.avatar_url || m.username.charAt(0).toUpperCase();
const rectAvatarClass = m.type === GROUP_TYPE ? 'rect-avatar' : ''; const rectAvatarClass = m.type === GROUP_TYPE ? 'rect-avatar' : '';
const imgAvatar = `<img src="${m.avatar_url}" alt="${ const imgAvatar = `<img src="${m.avatar_url}" alt="${m.username}" class="avatar ${rectAvatarClass} avatar-inline center s26"/>`;
m.username
}" class="avatar ${rectAvatarClass} avatar-inline center s26"/>`;
const txtAvatar = `<div class="avatar ${rectAvatarClass} center avatar-inline s26">${autoCompleteAvatar}</div>`; const txtAvatar = `<div class="avatar ${rectAvatarClass} center avatar-inline s26">${autoCompleteAvatar}</div>`;
return { return {
......
...@@ -77,9 +77,7 @@ export default function groupsSelect() { ...@@ -77,9 +77,7 @@ export default function groupsSelect() {
} }
}, },
formatResult(object) { formatResult(object) {
return `<div class='group-result'> <div class='group-name'>${ return `<div class='group-result'> <div class='group-name'>${object.full_name}</div> <div class='group-path'>${object.full_path}</div> </div>`;
object.full_name
}</div> <div class='group-path'>${object.full_path}</div> </div>`;
}, },
formatSelection(object) { formatSelection(object) {
return object.full_name; return object.full_name;
......
...@@ -63,9 +63,7 @@ export const setLastCommitMessage = ({ commit, rootGetters }, data) => { ...@@ -63,9 +63,7 @@ export const setLastCommitMessage = ({ commit, rootGetters }, data) => {
const commitMsg = sprintf( const commitMsg = sprintf(
__('Your changes have been committed. Commit %{commitId} %{commitStats}'), __('Your changes have been committed. Commit %{commitId} %{commitStats}'),
{ {
commitId: `<a href="${currentProject.web_url}/commit/${data.short_id}" class="commit-sha">${ commitId: `<a href="${currentProject.web_url}/commit/${data.short_id}" class="commit-sha">${data.short_id}</a>`,
data.short_id
}</a>`,
commitStats, commitStats,
}, },
false, false,
...@@ -215,9 +213,7 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo ...@@ -215,9 +213,7 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo
if (rootGetters.activeFile) { if (rootGetters.activeFile) {
router.push( router.push(
`/project/${rootState.currentProjectId}/blob/${getters.branchName}/-/${ `/project/${rootState.currentProjectId}/blob/${getters.branchName}/-/${rootGetters.activeFile.path}`,
rootGetters.activeFile.path
}`,
); );
} }
} }
......
...@@ -86,9 +86,7 @@ export default { ...@@ -86,9 +86,7 @@ export default {
return sprintf( return sprintf(
'%{startLink}%{name}%{endLink}', '%{startLink}%{name}%{endLink}',
{ {
startLink: `<a href="${ startLink: `<a href="${this.deploymentStatus.environment.environment_path}" class="js-environment-link">`,
this.deploymentStatus.environment.environment_path
}" class="js-environment-link">`,
name: _.escape(this.deploymentStatus.environment.name), name: _.escape(this.deploymentStatus.environment.name),
endLink: '</a>', endLink: '</a>',
}, },
......
...@@ -1284,9 +1284,7 @@ export default class Notes { ...@@ -1284,9 +1284,7 @@ export default class Notes {
putConflictEditWarningInPlace(noteEntity, $note) { putConflictEditWarningInPlace(noteEntity, $note) {
if ($note.find('.js-conflict-edit-warning').length === 0) { if ($note.find('.js-conflict-edit-warning').length === 0) {
const open_link = `<a href="#note_${ const open_link = `<a href="#note_${noteEntity.id}" target="_blank" rel="noopener noreferrer">`;
noteEntity.id
}" target="_blank" rel="noopener noreferrer">`;
const $alert = $(`<div class="js-conflict-edit-warning alert alert-danger"> const $alert = $(`<div class="js-conflict-edit-warning alert alert-danger">
${sprintf( ${sprintf(
s__( s__(
......
...@@ -6,9 +6,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -6,9 +6,7 @@ document.addEventListener('DOMContentLoaded', () => {
const twoFactorNode = document.querySelector('.js-two-factor-auth'); const twoFactorNode = document.querySelector('.js-two-factor-auth');
const skippable = parseBoolean(twoFactorNode.dataset.twoFactorSkippable); const skippable = parseBoolean(twoFactorNode.dataset.twoFactorSkippable);
if (skippable) { if (skippable) {
const button = `<a class="btn btn-sm btn-warning float-right" data-method="patch" href="${ const button = `<a class="btn btn-sm btn-warning float-right" data-method="patch" href="${twoFactorNode.dataset.two_factor_skip_url}">Configure it later</a>`;
twoFactorNode.dataset.two_factor_skip_url
}">Configure it later</a>`;
const flashAlert = document.querySelector('.flash-alert .container-fluid'); const flashAlert = document.querySelector('.flash-alert .container-fluid');
if (flashAlert) flashAlert.insertAdjacentHTML('beforeend', button); if (flashAlert) flashAlert.insertAdjacentHTML('beforeend', button);
} }
......
...@@ -101,9 +101,7 @@ describe('Stages Dropdown', () => { ...@@ -101,9 +101,7 @@ describe('Stages Dropdown', () => {
}); });
it(`renders the pipeline info text like "Pipeline #123 for !456 with source_branch into target_branch"`, () => { it(`renders the pipeline info text like "Pipeline #123 for !456 with source_branch into target_branch"`, () => {
const expected = `Pipeline #${pipeline.id} for !${pipeline.merge_request.iid} with ${ const expected = `Pipeline #${pipeline.id} for !${pipeline.merge_request.iid} with ${pipeline.merge_request.source_branch} into ${pipeline.merge_request.target_branch}`;
pipeline.merge_request.source_branch
} into ${pipeline.merge_request.target_branch}`;
const actual = trimText(vm.$el.querySelector('.js-pipeline-info').innerText); const actual = trimText(vm.$el.querySelector('.js-pipeline-info').innerText);
expect(actual).toBe(expected); expect(actual).toBe(expected);
...@@ -144,9 +142,7 @@ describe('Stages Dropdown', () => { ...@@ -144,9 +142,7 @@ describe('Stages Dropdown', () => {
}); });
it(`renders the pipeline info like "Pipeline #123 for !456 with source_branch"`, () => { it(`renders the pipeline info like "Pipeline #123 for !456 with source_branch"`, () => {
const expected = `Pipeline #${pipeline.id} for !${pipeline.merge_request.iid} with ${ const expected = `Pipeline #${pipeline.id} for !${pipeline.merge_request.iid} with ${pipeline.merge_request.source_branch}`;
pipeline.merge_request.source_branch
}`;
const actual = trimText(vm.$el.querySelector('.js-pipeline-info').innerText); const actual = trimText(vm.$el.querySelector('.js-pipeline-info').innerText);
expect(actual).toBe(expected); expect(actual).toBe(expected);
......
...@@ -26,9 +26,7 @@ describe('Promote label modal', () => { ...@@ -26,9 +26,7 @@ describe('Promote label modal', () => {
it('contains the proper description', () => { it('contains the proper description', () => {
expect(vm.text).toContain( expect(vm.text).toContain(
`Promoting ${labelMockData.labelTitle} will make it available for all projects inside ${ `Promoting ${labelMockData.labelTitle} will make it available for all projects inside ${labelMockData.groupName}`,
labelMockData.groupName
}`,
); );
}); });
......
...@@ -24,9 +24,7 @@ describe('Promote milestone modal', () => { ...@@ -24,9 +24,7 @@ describe('Promote milestone modal', () => {
it('contains the proper description', () => { it('contains the proper description', () => {
expect(vm.text).toContain( expect(vm.text).toContain(
`Promoting ${ `Promoting ${milestoneMockData.milestoneTitle} will make it available for all projects inside ${milestoneMockData.groupName}.`,
milestoneMockData.milestoneTitle
} will make it available for all projects inside ${milestoneMockData.groupName}.`,
); );
}); });
......
...@@ -222,9 +222,7 @@ describe('MRWidgetPipeline', () => { ...@@ -222,9 +222,7 @@ describe('MRWidgetPipeline', () => {
sourceBranchLink: mockCopy.source_branch_link, sourceBranchLink: mockCopy.source_branch_link,
}); });
const expected = `Pipeline #${pipeline.id} ${pipeline.details.status.label} for ${ const expected = `Pipeline #${pipeline.id} ${pipeline.details.status.label} for ${pipeline.commit.short_id} on ${mockCopy.source_branch_link}`;
pipeline.commit.short_id
} on ${mockCopy.source_branch_link}`;
const actual = trimText(vm.$el.querySelector('.js-pipeline-info-container').innerText); const actual = trimText(vm.$el.querySelector('.js-pipeline-info-container').innerText);
...@@ -247,11 +245,7 @@ describe('MRWidgetPipeline', () => { ...@@ -247,11 +245,7 @@ describe('MRWidgetPipeline', () => {
sourceBranchLink: mockCopy.source_branch_link, sourceBranchLink: mockCopy.source_branch_link,
}); });
const expected = `Pipeline #${pipeline.id} ${pipeline.details.status.label} for ${ const expected = `Pipeline #${pipeline.id} ${pipeline.details.status.label} for ${pipeline.commit.short_id} on !${pipeline.merge_request.iid} with ${pipeline.merge_request.source_branch} into ${pipeline.merge_request.target_branch}`;
pipeline.commit.short_id
} on !${pipeline.merge_request.iid} with ${pipeline.merge_request.source_branch} into ${
pipeline.merge_request.target_branch
}`;
const actual = trimText(vm.$el.querySelector('.js-pipeline-info-container').innerText); const actual = trimText(vm.$el.querySelector('.js-pipeline-info-container').innerText);
...@@ -274,9 +268,7 @@ describe('MRWidgetPipeline', () => { ...@@ -274,9 +268,7 @@ describe('MRWidgetPipeline', () => {
sourceBranchLink: mockCopy.source_branch_link, sourceBranchLink: mockCopy.source_branch_link,
}); });
const expected = `Pipeline #${pipeline.id} ${pipeline.details.status.label} for ${ const expected = `Pipeline #${pipeline.id} ${pipeline.details.status.label} for ${pipeline.commit.short_id} on !${pipeline.merge_request.iid} with ${pipeline.merge_request.source_branch}`;
pipeline.commit.short_id
} on !${pipeline.merge_request.iid} with ${pipeline.merge_request.source_branch}`;
const actual = trimText(vm.$el.querySelector('.js-pipeline-info-container').innerText); const actual = trimText(vm.$el.querySelector('.js-pipeline-info-container').innerText);
......
...@@ -8699,10 +8699,10 @@ prettier@1.16.3: ...@@ -8699,10 +8699,10 @@ prettier@1.16.3:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.3.tgz#8c62168453badef702f34b45b6ee899574a6a65d" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.3.tgz#8c62168453badef702f34b45b6ee899574a6a65d"
integrity sha512-kn/GU6SMRYPxUakNXhpP0EedT/KmaPzr0H5lIsDogrykbaxOpOfAFfk5XA7DZrJyMAv1wlMV3CPcZruGXVVUZw== integrity sha512-kn/GU6SMRYPxUakNXhpP0EedT/KmaPzr0H5lIsDogrykbaxOpOfAFfk5XA7DZrJyMAv1wlMV3CPcZruGXVVUZw==
prettier@1.16.4: prettier@1.18.2:
version "1.16.4" version "1.18.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g== integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
pretty-format@^24.8.0: pretty-format@^24.8.0:
version "24.8.0" version "24.8.0"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册