mirror of
https://github.com/strapi/strapi.git
synced 2025-12-30 00:37:24 +00:00
Fix eslint core/admin
This commit is contained in:
parent
04f218346d
commit
4e989321e3
@ -80,12 +80,10 @@ const buildAdmin = async () => {
|
||||
new Error(
|
||||
messages.errors.reduce((acc, error) => {
|
||||
if (isObject(error)) {
|
||||
acc += error.message;
|
||||
} else {
|
||||
acc += error.join('\n\n');
|
||||
return acc + error.message;
|
||||
}
|
||||
|
||||
return acc;
|
||||
return acc + error.join('\n\n');
|
||||
}, '')
|
||||
)
|
||||
);
|
||||
|
||||
@ -426,7 +426,11 @@ describe('Role', () => {
|
||||
|
||||
const count = jest.fn(() => Promise.resolve(0));
|
||||
let id = 1;
|
||||
const create = jest.fn(({ data }) => ({ ...data, id: id++ }));
|
||||
const create = jest.fn(({ data }) => {
|
||||
const res = { ...data, id };
|
||||
id += 1;
|
||||
return res;
|
||||
});
|
||||
const values = jest.fn(() => actions);
|
||||
const createMany = jest.fn();
|
||||
const assignARoleToAll = jest.fn();
|
||||
|
||||
@ -49,9 +49,10 @@ const unwrapDeep = (obj) => {
|
||||
|
||||
if (_.isPlainObject(v)) {
|
||||
if ('$elemMatch' in v) {
|
||||
v = v.$elemMatch; // removing this key
|
||||
_.setWith(acc, key, unwrapDeep(v.$elemMatch));
|
||||
} else {
|
||||
_.setWith(acc, key, unwrapDeep(v));
|
||||
}
|
||||
_.setWith(acc, key, unwrapDeep(v));
|
||||
} else if (_.isArray(v)) {
|
||||
// prettier-ignore
|
||||
_.setWith(acc, key, v.map(v => unwrapDeep(v)));
|
||||
|
||||
@ -144,7 +144,7 @@ const cleanPermissionsInDatabase = async () => {
|
||||
const total = await strapi.query('admin::permission').count();
|
||||
const pageCount = Math.ceil(total / pageSize);
|
||||
|
||||
for (let page = 0; page < pageCount; page++) {
|
||||
for (let page = 0; page < pageCount; page += 1) {
|
||||
// 1. Find invalid permissions and collect their ID to delete them later
|
||||
const results = await strapi
|
||||
.query('admin::permission')
|
||||
|
||||
@ -84,7 +84,7 @@ if (edition === 'EE') {
|
||||
// Create users with the new role & create associated auth requests
|
||||
const users = [];
|
||||
|
||||
for (let i = 0; i < localTestData.users.length; ++i) {
|
||||
for (let i = 1; i < localTestData.users.length; i += 1) {
|
||||
const userFixture = localTestData.users[i];
|
||||
const userAttributes = {
|
||||
...userFixture,
|
||||
|
||||
@ -145,7 +145,7 @@ describe('Admin User CRUD (e2e)', () => {
|
||||
};
|
||||
};
|
||||
|
||||
for (let i = 0; i < 3; i++) {
|
||||
for (let i = 0; i < 3; i += 1) {
|
||||
const res = await rq({
|
||||
url: '/admin/users',
|
||||
method: 'POST',
|
||||
|
||||
@ -12,7 +12,7 @@ const checkFieldsAreCorrectlyNested = (fields) => {
|
||||
}
|
||||
|
||||
let failed = false;
|
||||
for (let indexA = 0; indexA < fields.length; indexA++) {
|
||||
for (let indexA = 0; indexA < fields.length; indexA += 1) {
|
||||
failed = fields
|
||||
.slice(indexA + 1)
|
||||
.some(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user