Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency prettier to v3 #668

Merged
merged 3 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/bs-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class BsForm extends BaseBsForm {

async validate(model) {
const isInvalid = Object.getOwnPropertyNames(
Object.getPrototypeOf(model)
Object.getPrototypeOf(model),
).any((potentialValidationKey) => {
// Validation getters must be named `propertyValidation` by our convention
if (!potentialValidationKey.endsWith('Validation')) {
Expand Down
12 changes: 6 additions & 6 deletions app/components/create-options-dates.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class CreateOptionsDates extends Component {
const dateAdded = newDatesAsLuxonDateTime.find((newDateAsLuxonDateTime) => {
return !this.selectedDays.some(
(selectedDay) =>
selectedDay.toISODate() === newDateAsLuxonDateTime.toISODate()
selectedDay.toISODate() === newDateAsLuxonDateTime.toISODate(),
);
});

Expand All @@ -48,7 +48,7 @@ export default class CreateOptionsDates extends Component {
[
...this.args.options.map(({ value }) => value),
dateAdded.toISODate(),
].sort()
].sort(),
);
return;
}
Expand All @@ -59,7 +59,7 @@ export default class CreateOptionsDates extends Component {
const dateRemoved = this.selectedDays.find((selectedDay) => {
return !newDatesAsLuxonDateTime.some(
(newDateAsLuxonDateTime) =>
newDateAsLuxonDateTime.toISODate() === selectedDay.toISODate()
newDateAsLuxonDateTime.toISODate() === selectedDay.toISODate(),
);
});

Expand All @@ -68,15 +68,15 @@ export default class CreateOptionsDates extends Component {
this.args.options
.filter(
({ value }) =>
DateTime.fromISO(value).toISODate() !== dateRemoved.toISODate()
DateTime.fromISO(value).toISODate() !== dateRemoved.toISODate(),
)
.map(({ value }) => value)
.map(({ value }) => value),
);
return;
}

throw new Error(
'No date has been added or removed. This cannot be the case. Something spooky is going on.'
'No date has been added or removed. This cannot be the case. Something spooky is going on.',
);
}

Expand Down
14 changes: 7 additions & 7 deletions app/components/create-options-datetime.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class FormDataOption {
const { isPartiallyFilled } = this;
if (isPartiallyFilled) {
return new IntlMessage(
'create.options-datetime.error.partiallyFilledTime'
'create.options-datetime.error.partiallyFilledTime',
);
}

Expand Down Expand Up @@ -105,7 +105,7 @@ class FormData {
this.options.splice(
position + 1,
0,
new FormDataOption(this, { day, time: null })
new FormDataOption(this, { day, time: null }),
);
}

Expand All @@ -132,7 +132,7 @@ class FormData {
const optionsForFirstDay = optionsGroupedByDay[firstDay];

const timesForFirstDayAreValid = optionsForFirstDay.every(
(option) => option.isValid
(option) => option.isValid,
);
if (!timesForFirstDayAreValid) {
return false;
Expand All @@ -144,16 +144,16 @@ class FormData {
days
.map((day) =>
timesForFirstDay.map(
(time) => new FormDataOption(this, { day, time })
)
(time) => new FormDataOption(this, { day, time }),
),
)
.flat()
.flat(),
);
}

constructor(options) {
this.options = new TrackedArray(
options.map(({ day, time }) => new FormDataOption(this, { day, time }))
options.map(({ day, time }) => new FormDataOption(this, { day, time })),
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/components/create-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class FormData {
@action
updateOptions(values) {
this.options = new TrackedArray(
values.map((value) => new FormDataOption(this, value))
values.map((value) => new FormDataOption(this, value)),
);
}

Expand All @@ -82,7 +82,7 @@ class FormData {
options.length === 0 && defaultOptionCount > 0 ? ['', ''] : options;

this.options = new TrackedArray(
normalizedOptions.map(({ title }) => new FormDataOption(this, title))
normalizedOptions.map(({ title }) => new FormDataOption(this, title)),
);
}
}
Expand All @@ -92,7 +92,7 @@ export default class CreateOptionsComponent extends Component {

formData = new FormData(
{ options: this.args.options },
{ defaultOptionCount: this.args.isMakeAPoll ? 2 : 0 }
{ defaultOptionCount: this.args.isMakeAPoll ? 2 : 0 },
);

@action
Expand Down
4 changes: 2 additions & 2 deletions app/components/poll-evaluation-participants-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ export default class PollEvaluationParticipantsTable extends Component {
for (const option of poll.options.toArray()) {
optionsPerDay.set(
option.day,
optionsPerDay.has(option.day) ? optionsPerDay.get(option.day) + 1 : 0
optionsPerDay.has(option.day) ? optionsPerDay.get(option.day) + 1 : 0,
);
}

return new Map(
Array.from(optionsPerDay.entries()).map(([dayString, count]) => [
DateTime.fromISO(dayString).toJSDate(),
count,
])
]),
);
}

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/create/options-datetime.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class CreateOptionsDatetimeController extends Controller {
updateOptions(options) {
this.model.options = options
.map(({ day, time }) =>
time ? DateTime.fromISO(`${day}T${time}`).toISO() : day
time ? DateTime.fromISO(`${day}T${time}`).toISO() : day,
)
.sort()
.map((isoString) => {
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/create/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class CreateOptionsController extends Controller {
@action
updateOptions(newOptions) {
this.model.options = newOptions.map(({ value }) =>
this.store.createFragment('option', { title: value })
this.store.createFragment('option', { title: value }),
);
}
}
2 changes: 1 addition & 1 deletion app/controllers/create/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@
return option.hasTime;
})
) {
this.set(

Check warning on line 101 in app/controllers/create/settings.js

View workflow job for this annotation

GitHub Actions / lint javascript

The this.set() method is a classic ember object method, and can't be used in octane classes. You can refactor this usage to use a utility version instead (e.g. get(this, 'foo')), or to use native/modern syntax instead. Alternatively, you can add the @classic decorator to this class to continue using classic APIs
'model.timezone',
Intl.DateTimeFormat().resolvedOptions().timeZone
Intl.DateTimeFormat().resolvedOptions().timeZone,
);
}

Expand All @@ -126,7 +126,7 @@

@action
updateAnswerType(answerType) {
this.set('model.answerType', answerType);

Check warning on line 129 in app/controllers/create/settings.js

View workflow job for this annotation

GitHub Actions / lint javascript

The this.set() method is a classic ember object method, and can't be used in octane classes. You can refactor this usage to use a utility version instead (e.g. get(this, 'foo')), or to use native/modern syntax instead. Alternatively, you can add the @classic decorator to this class to continue using classic APIs
this.set('model.answers', answersForAnswerType(answerType));

Check warning on line 130 in app/controllers/create/settings.js

View workflow job for this annotation

GitHub Actions / lint javascript

The this.set() method is a classic ember object method, and can't be used in octane classes. You can refactor this usage to use a utility version instead (e.g. get(this, 'foo')), or to use native/modern syntax instead. Alternatively, you can add the @classic decorator to this class to continue using classic APIs
}
}
2 changes: 1 addition & 1 deletion app/controllers/poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
}

// TODO: Remove this code. It's spooky.
@observes('encryptionKey')

Check warning on line 86 in app/controllers/poll.js

View workflow job for this annotation

GitHub Actions / lint javascript

Don't use observers
preventEncryptionKeyChanges() {
if (
!isEmpty(this.encryption.key) &&
Expand All @@ -92,10 +92,10 @@
// work-a-round for url not being updated
window.location.hash = window.location.hash.replace(
this.encryptionKey,
this.encryption.key
this.encryption.key,
);

this.set('encryptionKey', this.encryption.key);

Check warning on line 98 in app/controllers/poll.js

View workflow job for this annotation

GitHub Actions / lint javascript

The this.set() method is a classic ember object method, and can't be used in octane classes. You can refactor this usage to use a utility version instead (e.g. get(this, 'foo')), or to use native/modern syntax instead. Alternatively, you can add the @classic decorator to this class to continue using classic APIs
}
}
}
8 changes: 4 additions & 4 deletions app/helpers/scroll-first-invalid-element-into-view-port.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export function scrollFirstInvalidElementIntoViewPort() {
// delaying to next runloop therefore
next(function () {
let invalidInput = document.querySelector(
'.form-control.is-invalid, .custom-control-input.is-invalid'
'.form-control.is-invalid, .custom-control-input.is-invalid',
);
assert(
'Atleast one form control must be marked as invalid if form submission was rejected as invalid',
invalidInput
invalidInput,
);

// focus first invalid control
Expand All @@ -50,8 +50,8 @@ export function scrollFirstInvalidElementIntoViewPort() {
document.querySelector(
`label[for="${invalidInput.id.substr(
0,
invalidInput.id.indexOf('_')
)}"`
invalidInput.id.indexOf('_'),
)}"`,
) ||
document.querySelector(`label[for="${invalidInput.id}"]`) ||
// For polls with type `MakeAPoll` the option inputs do not have a label at all. In that case
Expand Down
2 changes: 1 addition & 1 deletion app/instance-initializers/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {

intl.set(
'locale',
locale.includes('-') ? [locale, locale.split('-')[0]] : [locale]
locale.includes('-') ? [locale, locale.split('-')[0]] : [locale],
);
powerCalendar.set('local', locale);
},
Expand Down
4 changes: 2 additions & 2 deletions app/models/option.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
set time(value) {
assert(
'can not set a time if current value is not a valid date',
this.isDate
this.isDate,
);

// set time to undefined if value is false
if (isEmpty(value)) {
this.set('title', this.day);

Check warning on line 61 in app/models/option.js

View workflow job for this annotation

GitHub Actions / lint javascript

The this.set() method is a classic ember object method, and can't be used in octane classes. You can refactor this usage to use a utility version instead (e.g. get(this, 'foo')), or to use native/modern syntax instead. Alternatively, you can add the @classic decorator to this class to continue using classic APIs
return;
}

Expand All @@ -66,11 +66,11 @@
if (!datetime.isValid) {
return;
}
this.set(

Check warning on line 69 in app/models/option.js

View workflow job for this annotation

GitHub Actions / lint javascript

The this.set() method is a classic ember object method, and can't be used in octane classes. You can refactor this usage to use a utility version instead (e.g. get(this, 'foo')), or to use native/modern syntax instead. Alternatively, you can add the @classic decorator to this class to continue using classic APIs
'title',
this.datetime
.set({ hours: datetime.hour, minutes: datetime.minute })
.toISO()
.toISO(),
);
}
}
2 changes: 1 addition & 1 deletion app/modifiers/autofocus.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { modifier } from 'ember-modifier';
export default modifier(function autofocus(
element,
params,
{ enabled = true }
{ enabled = true },
) {
if (!enabled) {
return;
Expand Down
2 changes: 1 addition & 1 deletion app/routes/create/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class FormData {

if (!title) {
return new IntlMessage(
'create.meta.input.title.validations.valueMissing'
'create.meta.input.title.validations.valueMissing',
);
}

Expand Down
2 changes: 1 addition & 1 deletion app/routes/poll/participation.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class FormData {
this.nameIsRequired = nameIsRequired;
this.namesTaken = namesTaken;
this.selections = new TrackedArray(
options.map(() => new FormDataSelections(selectionIsRequired))
options.map(() => new FormDataSelections(selectionIsRequired)),
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { isEmpty } from '@ember/utils';
import ApplicationSerializer from './application';

export default class PollSerializer extends ApplicationSerializer.extend(
EmbeddedRecordsMixin
EmbeddedRecordsMixin,
) {
attrs = {
users: {
Expand Down
4 changes: 2 additions & 2 deletions lib/include-api-in-build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = {
return Promise.all(
targets.map((target) => {
return copy(`${apiPath}/${target}`, `${outputPath}/${target}`);
})
}),
);
})
.then(() => {
Expand All @@ -52,7 +52,7 @@ module.exports = {
}

resolve();
}
},
);
});
})
Expand Down
2 changes: 1 addition & 1 deletion mirage/utils/encrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function (propertiesToEncrypt, model) {
assert('first argument must be an array', isArray(propertiesToEncrypt));
assert(
"model must have an encryptionKey property which isn't empty",
isPresent(model.encryptionKey)
isPresent(model.encryptionKey),
);

let passphrase = model.encryptionKey;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-ember": "^11.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-qunit": "^8.0.0",
"fs-extra": "^9.0.0",
"lerna-changelog": "^2.0.0",
"loader.js": "^4.7.0",
"miragejs": "^0.1.47",
"npm-run-all": "^4.1.5",
"open-iconic": "^1.1.1",
"prettier": "^2.6.2",
"prettier": "^3.0.0",
"qunit": "^2.19.1",
"qunit-dom": "^3.0.0",
"release-it": "^16.0.0",
Expand Down
10 changes: 5 additions & 5 deletions tests/acceptance/build-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ module('Acceptance | build', function (hooks) {
// head is not available through `find()`, `assert.dom()` or `this.element.querySelector()`
// cause they are scoped to `#ember-testing-container`.
let buildInfoEl = document.head.querySelector(
'head meta[name="build-info"]'
'head meta[name="build-info"]',
);
assert.ok(buildInfoEl, 'tag exists');

let content = buildInfoEl.content;
assert.ok(
/^version=\d[\d.]+\d(-(alpha|beta|rc).\d)?(\+[\da-z]{8})?$/.test(content),
`${content} is valid version string`
`${content} is valid version string`,
);
});

Expand All @@ -29,17 +29,17 @@ module('Acceptance | build', function (hooks) {
// and therefore don't have access to head
assert.ok(
document.head.querySelector('meta[http-equiv="Content-Security-Policy"]'),
'CSP meta tag exists'
'CSP meta tag exists',
);

// this only covers dynamically created elements not the ones defined in `app/index.html` cause
// that one is replaced by `tests/index.html` for testing.
['link', 'script', 'style'].forEach((type) => {
assert.notOk(
document.head.querySelector(
`${type} meta[http-equiv="Content-Security-Policy"]`
`${type} meta[http-equiv="Content-Security-Policy"]`,
),
'CSP meta tag does not have a silbing of type ${type}'
'CSP meta tag does not have a silbing of type ${type}',
);
});
});
Expand Down
Loading
Loading