Skip to content

Commit

Permalink
1st fix pass
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrebodin committed Aug 11, 2022
1 parent 75d83a0 commit 0ae14c0
Show file tree
Hide file tree
Showing 191 changed files with 371 additions and 385 deletions.
1 change: 1 addition & 0 deletions packages/cli/create-strapi-app/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node

'use strict';

require('./create-strapi-app');
1 change: 1 addition & 0 deletions packages/cli/create-strapi-starter/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node

'use strict';

require('./create-strapi-starter');
9 changes: 4 additions & 5 deletions packages/cli/create-strapi-starter/utils/child-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ function runApp(rootPath, { useYarn } = {}) {
stdio: 'inherit',
cwd: rootPath,
});
} else {
return execa('npm', ['run', 'develop'], {
stdio: 'inherit',
cwd: rootPath,
});
}
return execa('npm', ['run', 'develop'], {
stdio: 'inherit',
cwd: rootPath,
});
}

async function initGit(rootPath) {
Expand Down
1 change: 1 addition & 0 deletions packages/cli/create-strapi-starter/utils/stop-process.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict';

const logger = require('./logger');

module.exports = function stopProcess(message) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/admin/ee/server/controllers/role.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {
validateRoleDeleteInput,
validateRolesDeleteInput,
} = require('../validation/role');
const { getService } = require('../../../server//utils');
const { getService } = require('../../../server/utils');
const { validatedUpdatePermissionsInput } = require('../validation/permission');
const { SUPER_ADMIN_CODE } = require('../../../server/services/constants');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const domain = require('../');
const domain = require('..');

describe('Action Domain', () => {
describe('appliesToProperty', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const { omit } = require('lodash/fp');
const createActionProvider = require('../provider');
const domain = require('../');
const domain = require('..');

const providerMethods = [
'register',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const domain = require('../');
const domain = require('..');

describe('Condition Domain', () => {
describe('assignConditionId', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const { omit } = require('lodash/fp');
const createConditionProvider = require('../provider');
const domain = require('../');
const domain = require('..');

const providerMethods = [
'register',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/admin/server/domain/condition/provider.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const { providerFactory } = require('@strapi/utils');
const domain = require('./');
const domain = require('.');

/**
* @typedef ConditionProviderOverride
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const domain = require('../');
const domain = require('..');

describe('Permission Domain', () => {
describe('addCondition', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/admin/server/routes/serve-admin-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const registerAdminPanelRoute = ({ strapi }) => {
}

ctx.type = 'html';
ctx.body = fse.createReadStream(join(buildDir + '/index.html'));
ctx.body = fse.createReadStream(join(`${buildDir}/index.html`));
};

strapi.server.routes([
Expand Down
4 changes: 2 additions & 2 deletions packages/core/admin/server/services/role.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const find = (params = {}, populate) => {
*/
const findAllWithUsersCount = async populate => {
const roles = await strapi.query('admin::role').findMany({ populate });
for (let role of roles) {
for (const role of roles) {
role.usersCount = await getUsersCount(role.id);
}

Expand Down Expand Up @@ -171,7 +171,7 @@ const checkRolesIdForDeletion = async (ids = []) => {
throw new ApplicationError('You cannot delete the super admin role');
}

for (let roleId of ids) {
for (const roleId of ids) {
const usersCount = await getUsersCount(roleId);
if (usersCount !== 0) {
throw new ApplicationError('Some roles are still assigned to some users');
Expand Down
2 changes: 1 addition & 1 deletion packages/core/admin/server/tests/admin-auth.test.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { createUtils } = require('../../../../../test/helpers/utils');

const edition = process.env.STRAPI_DISABLE_EE === 'true' ? 'CE' : 'EE';

let internals = {
const internals = {
role: null,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Role CRUD End to End', () => {
});

test('Can get the existing permissions', async () => {
let res = await rq({
const res = await rq({
url: '/admin/permissions',
method: 'GET',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (edition === 'EE') {
let strapi;
let utils;
const builder = createTestBuilder();
let requests = {
const requests = {
public: null,
admin: null,
};
Expand Down
6 changes: 3 additions & 3 deletions packages/core/admin/server/tests/admin-role.test.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ describe('Role CRUD End to End', () => {
];

test.each(rolesToCreate)('can create %p', async role => {
let res = await rq({
const res = await rq({
url: '/admin/roles',
method: 'POST',
body: role,
Expand Down Expand Up @@ -465,7 +465,7 @@ describe('Role CRUD End to End', () => {
},
});

for (let role of roles) {
for (const role of roles) {
res = await rq({
url: `/admin/roles/${role.id}`,
method: 'GET',
Expand Down Expand Up @@ -506,7 +506,7 @@ describe('Role CRUD End to End', () => {
expect(res.statusCode).toBe(200);
expect(res.body.data).toMatchObject(roles);

for (let roleId of rolesIds) {
for (const roleId of rolesIds) {
res = await rq({
url: `/admin/roles/${roleId}`,
method: 'GET',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/admin/server/tests/admin-user.test.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Admin User CRUD (e2e)', () => {
let strapi;

// Local test data used across the test suite
let testData = {
const testData = {
firstSuperAdminUser: undefined,
otherSuperAdminUsers: [],
user: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const checkFieldsAreCorrectlyNested = fields => {
if (_.isNil(fields)) {
// Only check if the fields exist
return true;
} else if (!Array.isArray(fields)) {
}
if (!Array.isArray(fields)) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const checkFieldsDontHaveDuplicates = fields => {
if (_.isNil(fields)) {
// Only check if the fields exist
return true;
} else if (!Array.isArray(fields)) {
}
if (!Array.isArray(fields)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/admin/webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const path = require('path');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { DuplicateReporterPlugin } = require('duplicate-dependencies-webpack-plugin');
const getPluginsPath = require('./utils/get-plugins-path');
const webpackConfig = require('./webpack.config');
Expand Down
2 changes: 1 addition & 1 deletion packages/core/admin/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = ({

return {
mode: isProduction ? 'production' : 'development',
bail: isProduction ? true : false,
bail: !!isProduction,
devtool: isProduction ? false : 'eval-source-map',
experiments: {
topLevelAwait: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ function syncLayouts(configuration, schema) {

let cleanEditRelations = editRelations.filter(attr => hasRelationAttribute(schema, attr));

let elementsToReAppend = [];
const elementsToReAppend = [];
let cleanEdit = [];
for (let row of edit) {
let newRow = [];
for (const row of edit) {
const newRow = [];

for (let el of row) {
for (const el of row) {
if (!hasEditableAttribute(schema, el.name)) continue;

/* if the type of a field was changed (ex: string -> json) or a new field was added in the schema
Expand Down Expand Up @@ -153,11 +153,11 @@ const appendToEditLayout = (layout = [], keysToAppend, schema) => {
layout[currentRowIndex] = [];
}

for (let key of keysToAppend) {
for (const key of keysToAppend) {
const attribute = schema.attributes[key];

const attributeSize = getDefaultFieldSize(attribute.type);
let currenRowSize = rowSize(layout[currentRowIndex]);
const currenRowSize = rowSize(layout[currentRowIndex]);

if (currenRowSize + attributeSize > MAX_ROW_SIZE) {
currentRowIndex += 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async function syncMetadatas(configuration, schema) {
const { edit, list } = metasWithDefaults[key];
const attr = schema.attributes[key];

let updatedMeta = { edit, list };
const updatedMeta = { edit, list };
// update sortable attr
if (list.sortable && !isSortable(schema, key)) {
_.set(updatedMeta, ['list', 'sortable'], false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { createAuthRequest } = require('../../../../../../test/helpers/request');
const builder = createTestBuilder();
let strapi;
let rq;
let data = {
const data = {
productsWithCompo: [],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { createAuthRequest } = require('../../../../../../test/helpers/request');
const builder = createTestBuilder();
let strapi;
let rq;
let data = {
const data = {
productsWithCompo: [],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { createAuthRequest } = require('../../../../../../test/helpers/request');
const builder = createTestBuilder();
let strapi;
let rq;
let data = {
const data = {
productsWithCompoAndDP: [],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { createAuthRequest } = require('../../../../../../test/helpers/request');
const builder = createTestBuilder();
let strapi;
let rq;
let data = {
const data = {
productsWithCompoAndDP: [],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { createAuthRequest } = require('../../../../../../test/helpers/request');
const builder = createTestBuilder();
let strapi;
let rq;
let data = {
const data = {
productsWithDzAndDP: [],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { createAuthRequest } = require('../../../../../../test/helpers/request');
const builder = createTestBuilder();
let strapi;
let rq;
let data = {
const data = {
productsWithDP: [],
};

Expand Down Expand Up @@ -161,7 +161,7 @@ describe('CM API - Basic + draftAndPublish', () => {
test('Publish a product, expect publishedAt to be defined', async () => {
const entry = data.productsWithDP[0];

let { body } = await rq({
const { body } = await rq({
url: `/content-manager/collection-types/api::product-with-dp.product-with-dp/${entry.id}/actions/publish`,
method: 'POST',
});
Expand All @@ -174,7 +174,7 @@ describe('CM API - Basic + draftAndPublish', () => {
test('Publish article1, expect article1 to be already published', async () => {
const entry = data.productsWithDP[0];

let { body } = await rq({
const { body } = await rq({
url: `/content-manager/collection-types/api::product-with-dp.product-with-dp/${entry.id}/actions/publish`,
method: 'POST',
});
Expand All @@ -193,7 +193,7 @@ describe('CM API - Basic + draftAndPublish', () => {
test('Unpublish article1, expect article1 to be set to null', async () => {
const entry = data.productsWithDP[0];

let { body } = await rq({
const { body } = await rq({
url: `/content-manager/collection-types/api::product-with-dp.product-with-dp/${entry.id}/actions/unpublish`,
method: 'POST',
});
Expand All @@ -206,7 +206,7 @@ describe('CM API - Basic + draftAndPublish', () => {
test('Unpublish article1, expect article1 to already be a draft', async () => {
const entry = data.productsWithDP[0];

let { body } = await rq({
const { body } = await rq({
url: `/content-manager/collection-types/api::product-with-dp.product-with-dp/${entry.id}/actions/unpublish`,
method: 'POST',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { createAuthRequest } = require('../../../../../../test/helpers/request');
const builder = createTestBuilder();
let strapi;
let rq;
let data = {
const data = {
productsWithDz: [],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let strapi;
let rq;
const builder = createTestBuilder();

let data = {
const data = {
stamps: [],
collectors: [],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { createAuthRequest } = require('../../../../../../test/helpers/request');
const builder = createTestBuilder();
let strapi;
let rq;
let data = {
const data = {
products: [],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { createAuthRequest } = require('../../../../../../test/helpers/request');
const builder = createTestBuilder();
let strapi;
let rq;
let data = {
const data = {
productsWithDz: [],
categories: [],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ describe('x-to-many RF Preview', () => {
describe('Relation Nature', () => {
test(`Throws if the relation's nature is not a x-to-many`, async () => {
const url = getCMPrefixUrl(categoryModel.singularName);
const id = data.category[0].id;
const { id } = data.category[0];

const { body, statusCode } = await rq.get(`${url}/${id}/product`);

Expand Down
Loading

0 comments on commit 0ae14c0

Please sign in to comment.