1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 05:09:43 +02:00

Move from prettier-eslint to eslint-plugin-prettier, update dependencies

This commit is contained in:
Maksim Eltyshev 2020-02-03 18:42:31 +05:00
parent 1f43d4f214
commit 45bde7e7c0
254 changed files with 5539 additions and 5170 deletions

View file

@ -35,7 +35,7 @@ module.exports = {
const userIds = await sails.helpers.getSubscriptionUserIdsForCard(action.cardId, action.userId);
userIds.forEach(async (userId) => {
userIds.forEach(async userId => {
const notification = await Notification.create({
userId,
actionId: action.id,

View file

@ -6,7 +6,7 @@ module.exports = {
},
values: {
type: 'json',
custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
custom: value => _.isPlainObject(value) && _.isFinite(value.position),
required: true,
},
request: {
@ -32,7 +32,7 @@ module.exports = {
position: nextPosition,
});
userIds.forEach((userId) => {
userIds.forEach(userId => {
sails.sockets.broadcast(`user:${userId}`, 'boardUpdate', {
item: {
id,
@ -48,7 +48,7 @@ module.exports = {
projectId: inputs.project.id,
}).fetch();
userIds.forEach((userId) => {
userIds.forEach(userId => {
sails.sockets.broadcast(
`user:${userId}`,
'boardCreate',

View file

@ -6,7 +6,7 @@ module.exports = {
},
userOrUserId: {
type: 'ref',
custom: (value) => _.isPlainObject(value) || _.isString(value),
custom: value => _.isPlainObject(value) || _.isString(value),
required: true,
},
request: {

View file

@ -6,7 +6,7 @@ module.exports = {
},
values: {
type: 'json',
custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
custom: value => _.isPlainObject(value) && _.isFinite(value.position),
required: true,
},
user: {

View file

@ -6,7 +6,7 @@ module.exports = {
},
values: {
type: 'json',
custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
custom: value => _.isPlainObject(value) && _.isFinite(value.position),
required: true,
},
request: {

View file

@ -30,7 +30,7 @@ module.exports = {
true,
);
userIds.forEach((userId) => {
userIds.forEach(userId => {
if (userId !== projectMembership.userId) {
sails.sockets.broadcast(
`user:${userId}`,

View file

@ -42,9 +42,9 @@ module.exports = {
return exits.success(
inputs.withProjectMembership
? {
project,
projectMembership,
}
project,
projectMembership,
}
: project,
);
},

View file

@ -4,8 +4,8 @@ module.exports = {
inputs: {
values: {
type: 'json',
// eslint-disable-next-line max-len
custom: (value) => _.isPlainObject(value) && _.isString(value.email) && _.isString(value.password),
custom: value =>
_.isPlainObject(value) && _.isString(value.email) && _.isString(value.password),
required: true,
},
request: {
@ -34,7 +34,7 @@ module.exports = {
const userIds = await sails.helpers.getAdminUserIds();
userIds.forEach((userId) => {
userIds.forEach(userId => {
sails.sockets.broadcast(
`user:${userId}`,
'userCreate',

View file

@ -17,7 +17,7 @@ module.exports = {
const userIds = await sails.helpers.getMembershipUserIdsForProject(board.projectId);
userIds.forEach((userId) => {
userIds.forEach(userId => {
sails.sockets.broadcast(
`user:${userId}`,
'boardDelete',

View file

@ -34,7 +34,7 @@ module.exports = {
projectMembership.projectId,
);
userIds.forEach((userId) => {
userIds.forEach(userId => {
sails.sockets.broadcast(
`user:${userId}`,
'projectMembershipDelete',
@ -47,7 +47,7 @@ module.exports = {
sails.sockets.removeRoomMembersFromRooms(
`user:${projectMembership.userId}`,
boardIds.map((boardId) => `board:${boardId}`),
boardIds.map(boardId => `board:${boardId}`),
);
const project = await Project.findOne(projectMembership.projectId);

View file

@ -20,9 +20,9 @@ module.exports = {
const userIds = sails.helpers.mapRecords(projectMemberships, 'userId');
const boards = await sails.helpers.getBoardsForProject(project.id);
const boardRooms = boards.map((board) => `board:${board.id}`);
const boardRooms = boards.map(board => `board:${board.id}`);
userIds.forEach((userId) => {
userIds.forEach(userId => {
sails.sockets.removeRoomMembersFromRooms(`user:${userId}`, boardRooms);
sails.sockets.broadcast(

View file

@ -38,7 +38,7 @@ module.exports = {
const userIds = _.union([user.id], adminUserIds, userIdsForProject);
userIds.forEach((userId) => {
userIds.forEach(userId => {
sails.sockets.broadcast(
`user:${userId}`,
'userDelete',

View file

@ -19,7 +19,7 @@ module.exports = {
const path = await sails.helpers
.getCardToProjectPath(action.cardId)
.intercept('notFound', (nodes) => ({
.intercept('notFound', nodes => ({
notFound: {
action,
...nodes,

View file

@ -4,7 +4,7 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
beforeId: {

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
custom: value => _.isArray(value) || _.isPlainObject(value),
},
limit: {
type: 'number',

View file

@ -2,12 +2,12 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
exceptBoardId: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
custom: value => _.isArray(value) || _.isPlainObject(value),
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
custom: value => _.isArray(value) || _.isPlainObject(value),
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
custom: value => _.isArray(value) || _.isPlainObject(value),
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
custom: value => _.isArray(value) || _.isPlainObject(value),
},
},

View file

@ -19,7 +19,7 @@ module.exports = {
const path = await sails.helpers
.getListToProjectPath(card.listId)
.intercept('notFound', (nodes) => ({
.intercept('notFound', nodes => ({
notFound: {
card,
...nodes,

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
},

View file

@ -2,12 +2,12 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
exceptCardId: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
custom: value => _.isArray(value) || _.isPlainObject(value),
},
},

View file

@ -19,7 +19,7 @@ module.exports = {
const path = await sails.helpers
.getBoardToProjectPath(label.boardId)
.intercept('notFound', (nodes) => ({
.intercept('notFound', nodes => ({
notFound: {
label,
...nodes,

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
},

View file

@ -19,7 +19,7 @@ module.exports = {
const path = await sails.helpers
.getBoardToProjectPath(list.boardId)
.intercept('notFound', (nodes) => ({
.intercept('notFound', nodes => ({
notFound: {
list,
...nodes,

View file

@ -2,12 +2,12 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
exceptListId: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
withProjectMemberships: {
@ -19,9 +19,9 @@ module.exports = {
return exits.success(
inputs.withProjectMemberships
? {
userIds,
projectMemberships,
}
userIds,
projectMemberships,
}
: userIds,
);
},

View file

@ -2,12 +2,12 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
exceptUserId: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
custom: value => _.isArray(value) || _.isPlainObject(value),
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
custom: value => _.isArray(value) || _.isPlainObject(value),
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
custom: value => _.isArray(value) || _.isPlainObject(value),
},
},

View file

@ -2,12 +2,12 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
exceptUserId: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
},
withCardSubscriptions: {
type: 'boolean',
@ -26,9 +26,9 @@ module.exports = {
return exits.success(
inputs.withCardSubscriptions
? {
userIds,
cardSubscriptions,
}
userIds,
cardSubscriptions,
}
: userIds,
);
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
userId: {

View file

@ -2,12 +2,12 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
exceptUserId: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
},
},

View file

@ -19,7 +19,7 @@ module.exports = {
const path = await sails.helpers
.getCardToProjectPath(task.cardId)
.intercept('notFound', (nodes) => ({
.intercept('notFound', nodes => ({
notFound: {
task,
...nodes,

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
id: {
type: 'json',
custom: (value) => _.isString(value) || _.isArray(value),
custom: value => _.isString(value) || _.isArray(value),
required: true,
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
custom: value => _.isArray(value) || _.isPlainObject(value),
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isString(value) || _.isPlainObject(value),
custom: value => _.isString(value) || _.isPlainObject(value),
required: true,
},
},

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
criteria: {
type: 'json',
custom: (value) => _.isArray(value) || _.isPlainObject(value),
custom: value => _.isArray(value) || _.isPlainObject(value),
},
},

View file

@ -2,14 +2,14 @@ const GAP = 2 ** 14;
const MIN_GAP = 0.125;
const MAX_POSITION = 2 ** 50;
const findBeginnings = (positions) => {
const findBeginnings = positions => {
positions.unshift(0);
let prevPosition = positions.pop();
const beginnings = [prevPosition];
// eslint-disable-next-line consistent-return
_.forEachRight(positions, (position) => {
_.forEachRight(positions, position => {
if (prevPosition - MIN_GAP >= position) {
return false;
}
@ -21,7 +21,7 @@ const findBeginnings = (positions) => {
return beginnings;
};
const getRepositionsMap = (positions) => {
const getRepositionsMap = positions => {
const repositionsMap = {};
if (positions.length <= 1) {
@ -62,7 +62,7 @@ const getRepositionsMap = (positions) => {
return repositionsMap;
};
const getFullRepositionsMap = (positions) => {
const getFullRepositionsMap = positions => {
const repositionsMap = {};
_.forEach(positions, (position, index) => {
@ -96,8 +96,9 @@ module.exports = {
const beginnings = findBeginnings([...lowers, inputs.position]);
const repositionsMap = getRepositionsMap([...beginnings, ...uppers])
|| getFullRepositionsMap([...lowers, inputs.position, ...uppers]);
const repositionsMap =
getRepositionsMap([...beginnings, ...uppers]) ||
getFullRepositionsMap([...lowers, inputs.position, ...uppers]);
const position = repositionsMap[inputs.position]
? repositionsMap[inputs.position].pop()

View file

@ -4,7 +4,7 @@ module.exports = {
inputs: {
records: {
type: 'ref',
custom: (value) => _.isArray(value),
custom: value => _.isArray(value),
required: true,
},
attribute: {

View file

@ -6,8 +6,8 @@ module.exports = {
},
values: {
type: 'json',
// eslint-disable-next-line max-len
custom: (value) => _.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
custom: value =>
_.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
required: true,
},
request: {
@ -29,7 +29,7 @@ module.exports = {
boards,
);
inputs.values.position = position;
inputs.values.position = position; // eslint-disable-line no-param-reassign
repositions.forEach(async ({ id, position: nextPosition }) => {
await Board.update({
@ -39,7 +39,7 @@ module.exports = {
position: nextPosition,
});
userIds.forEach((userId) => {
userIds.forEach(userId => {
sails.sockets.broadcast(`user:${userId}`, 'boardUpdate', {
item: {
id,
@ -53,7 +53,7 @@ module.exports = {
const board = await Board.updateOne(inputs.record.id).set(inputs.values);
if (board) {
userIds.forEach((userId) => {
userIds.forEach(userId => {
sails.sockets.broadcast(
`user:${userId}`,
'boardUpdate',

View file

@ -6,8 +6,8 @@ module.exports = {
},
values: {
type: 'json',
// eslint-disable-next-line max-len
custom: (value) => _.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
custom: value =>
_.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
required: true,
},
toList: {
@ -36,7 +36,7 @@ module.exports = {
if (listId !== inputs.list.id) {
values.listId = listId;
} else {
delete inputs.toList;
delete inputs.toList; // eslint-disable-line no-param-reassign
}
} else {
listId = inputs.list.id;

View file

@ -6,8 +6,8 @@ module.exports = {
},
values: {
type: 'json',
// eslint-disable-next-line max-len
custom: (value) => _.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
custom: value =>
_.isPlainObject(value) && (_.isUndefined(value.position) || _.isFinite(value.position)),
required: true,
},
request: {
@ -24,7 +24,7 @@ module.exports = {
lists,
);
inputs.values.position = position;
inputs.values.position = position; // eslint-disable-line no-param-reassign
repositions.forEach(async ({ id, position: nextPosition }) => {
await List.update({

View file

@ -2,7 +2,7 @@ module.exports = {
inputs: {
ids: {
type: 'json',
custom: (value) => _.isArray(value),
custom: value => _.isArray(value),
required: true,
},
user: {
@ -26,7 +26,7 @@ module.exports = {
.set(inputs.values)
.fetch();
notifications.forEach((notification) => {
notifications.forEach(notification => {
sails.sockets.broadcast(
`user:${notification.userId}`,
'notificationUpdate',

View file

@ -19,7 +19,7 @@ module.exports = {
if (project) {
const userIds = await sails.helpers.getMembershipUserIdsForProject(project.id);
userIds.forEach((userId) => {
userIds.forEach(userId => {
sails.sockets.broadcast(
`user:${userId}`,
'projectUpdate',

View file

@ -10,9 +10,10 @@ module.exports = {
},
values: {
type: 'json',
custom: (value) => _.isPlainObject(value)
&& (_.isUndefined(value.email) || _.isString(value.email))
&& (_.isUndefined(value.password) || _.isString(value.password)),
custom: value =>
_.isPlainObject(value) &&
(_.isUndefined(value.email) || _.isString(value.email)) &&
(_.isUndefined(value.password) || _.isString(value.password)),
required: true,
},
request: {
@ -26,12 +27,14 @@ module.exports = {
async fn(inputs, exits) {
if (!_.isUndefined(inputs.values.email)) {
// eslint-disable-next-line no-param-reassign
inputs.values.email = inputs.values.email.toLowerCase();
}
let isOnlyPasswordChange = false;
if (!_.isUndefined(inputs.values.password)) {
// eslint-disable-next-line no-param-reassign
inputs.values.password = bcrypt.hashSync(inputs.values.password, 10);
if (Object.keys(inputs.values).length === 1) {
@ -70,7 +73,7 @@ module.exports = {
const userIds = _.union([user.id], adminUserIds, userIdsForProject);
userIds.forEach((userId) => {
userIds.forEach(userId => {
sails.sockets.broadcast(
`user:${userId}`,
'userUpdate',