Skip to content

Commit

Permalink
apply eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Aug 9, 2024
1 parent 7a48d05 commit 505b1c8
Show file tree
Hide file tree
Showing 354 changed files with 632 additions and 632 deletions.
2 changes: 1 addition & 1 deletion .blueprint/generate-sample/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import BaseGenerator from '../../generators/base/index.js';
import { packageJson } from '../../lib/index.js';
import { promptSamplesFolder } from '../support.mjs';
import { GENERATOR_APP, GENERATOR_INFO, GENERATOR_JDL } from '../../generators/generator-list.js';
import { generateSample, entitiesByType } from './support/index.js';
import { entitiesByType, generateSample } from './support/index.js';

export default class extends BaseGenerator {
sampleName;
Expand Down
2 changes: 1 addition & 1 deletion cli/environment-builder.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Environment from 'yeoman-environment';
import { QueuedAdapter } from '@yeoman/adapter';

import { createJHipsterLogger, packageNameToNamespace } from '../generators/base/support/index.js';
import { parseBlueprintInfo, loadBlueprintsFromConfiguration, mergeBlueprints } from '../generators/base/internal/index.js';
import { loadBlueprintsFromConfiguration, mergeBlueprints, parseBlueprintInfo } from '../generators/base/internal/index.js';
import { CLI_NAME, logger } from './utils.mjs';

const __filename = fileURLToPath(import.meta.url);
Expand Down
2 changes: 1 addition & 1 deletion cli/export-utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function writeConfigFile(config, yoRcPath = '.yo-rc.json') {
const stats = fs.statSync(yoRcPath, { throwIfNoEntry: false });
if (stats && stats.isFile) {
const yoRc = JSON.parse(fs.readFileSync(yoRcPath, { encoding: 'utf-8' }));
let creationTimestamp = config[GENERATOR_NAME].creationTimestamp;
let { creationTimestamp } = config[GENERATOR_NAME];
if (yoRc[GENERATOR_NAME] && yoRc[GENERATOR_NAME].creationTimestamp) {
creationTimestamp = yoRc[GENERATOR_NAME].creationTimestamp;
}
Expand Down
2 changes: 1 addition & 1 deletion cli/program.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import logo from './logo.mjs';
import EnvironmentBuilder from './environment-builder.mjs';
import SUB_GENERATORS from './commands.mjs';
import JHipsterCommand from './jhipster-command.mjs';
import { CLI_NAME, logger, getCommand, done } from './utils.mjs';
import { CLI_NAME, done, getCommand, logger } from './utils.mjs';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
Expand Down
2 changes: 1 addition & 1 deletion cli/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import chalk from 'chalk';

import { createJHipsterLogger, CLI_LOGGER } from '../generators/base/support/index.js';
import { CLI_LOGGER, createJHipsterLogger } from '../generators/base/support/index.js';

export const CLI_NAME = 'jhipster';
export const GENERATOR_NAME = 'generator-jhipster';
Expand Down
4 changes: 2 additions & 2 deletions generators/angular/generator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { basename, dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { before, it, describe, expect } from 'esmocha';
import { before, describe, expect, it } from 'esmocha';
import { snakeCase } from 'lodash-es';

import { buildClientSamples, entitiesClientSamples as entities, defaultHelpers as helpers, runResult } from '../../testing/index.js';
import { shouldSupportFeatures, testBlueprintSupport, checkEnforcements } from '../../test/support/index.js';
import { checkEnforcements, shouldSupportFeatures, testBlueprintSupport } from '../../test/support/index.js';
import { clientFrameworkTypes } from '../../jdl/jhipster/index.js';
import { CLIENT_MAIN_SRC_DIR } from '../generator-constants.js';
import { GENERATOR_ANGULAR } from '../generator-list.js';
Expand Down
16 changes: 8 additions & 8 deletions generators/angular/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@ import { GENERATOR_ANGULAR, GENERATOR_CLIENT, GENERATOR_LANGUAGES } from '../gen
import { defaultLanguage } from '../languages/support/index.js';
import { clientFrameworkTypes } from '../../jdl/jhipster/index.js';
import {
generateTypescriptTestEntity as generateTestEntity,
generateEntityClientEnumImports as getClientEnumImportsFormat,
getTypescriptKeyType as getTSKeyType,
generateTestEntityId as getTestEntityId,
generateTestEntityPrimaryKey as getTestEntityPrimaryKey,
generateTypescriptTestEntity as generateTestEntity,
} from '../client/support/index.js';
import type { CommonClientServerApplication } from '../base-application/types.js';
import { createNeedleCallback, mutateData } from '../base/support/index.js';
import { writeEslintClientRootConfigFile } from '../javascript/generators/eslint/support/tasks.js';
import { writeEntitiesFiles, postWriteEntitiesFiles, cleanupEntitiesFiles } from './entity-files-angular.js';
import { cleanupEntitiesFiles, postWriteEntitiesFiles, writeEntitiesFiles } from './entity-files-angular.js';
import { writeFiles } from './files-angular.js';
import cleanupOldFilesTask from './cleanup.js';
import {
buildAngularFormPath as angularFormPath,
addEntitiesRoute,
addIconImport,
addItemToAdminMenu,
addItemToMenu,
addRoute,
addToEntitiesMenu,
translateAngularFilesTransform,
buildAngularFormPath as angularFormPath,
isTranslatedAngularFile,
addRoute,
addItemToMenu,
addItemToAdminMenu,
addIconImport,
translateAngularFilesTransform,
} from './support/index.js';

const { ANGULAR } = clientFrameworkTypes;
Expand Down
2 changes: 1 addition & 1 deletion generators/angular/support/translate-angular.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/
import { inspect } from 'node:util';
import { it, describe, expect, esmocha, beforeEach } from 'esmocha';
import { beforeEach, describe, esmocha, expect, it } from 'esmocha';
import { createTranslationReplacer } from './translate-angular.js';

describe('generator - angular - transform', () => {
Expand Down
2 changes: 1 addition & 1 deletion generators/app/composing.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'assert';
import { before, it, describe } from 'esmocha';
import { before, describe, it } from 'esmocha';

import { defaultHelpers as helpers } from '../../testing/index.js';
import { GENERATOR_APP } from '../generator-list.js';
Expand Down
2 changes: 1 addition & 1 deletion generators/app/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import chalk from 'chalk';
import { camelCase } from 'lodash-es';

import BaseApplicationGenerator from '../base-application/index.js';
import { GENERATOR_COMMON, GENERATOR_CLIENT, GENERATOR_SERVER } from '../generator-list.js';
import { GENERATOR_CLIENT, GENERATOR_COMMON, GENERATOR_SERVER } from '../generator-list.js';
import { getDefaultAppName } from '../project-name/support/index.js';
import { packageJson } from '../../lib/index.js';

Expand Down
2 changes: 1 addition & 1 deletion generators/app/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { basename, dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { before, it, describe, expect } from 'esmocha';
import { before, describe, expect, it } from 'esmocha';
import { snakeCase } from 'lodash-es';

import { getCommandHelpOutput, shouldSupportFeatures, testBlueprintSupport } from '../../test/support/tests.js';
Expand Down
2 changes: 1 addition & 1 deletion generators/base-application/application-options.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UnionToIntersection, StringKeyOf } from 'type-fest';
import type { StringKeyOf, UnionToIntersection } from 'type-fest';

// Values<{ a: string, b: number }> = string | number
type Values<T> = T[keyof T];
Expand Down
2 changes: 1 addition & 1 deletion generators/base-application/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { basename, dirname } from 'path';
import { fileURLToPath } from 'url';
import { before, it, describe, expect, esmocha } from 'esmocha';
import { before, describe, esmocha, expect, it } from 'esmocha';
import { snakeCase } from 'lodash-es';

import EnvironmentBuilder from '../../cli/environment-builder.mjs';
Expand Down
4 changes: 2 additions & 2 deletions generators/base-application/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type { ComposeOptions, Storage } from 'yeoman-generator';

import BaseGenerator from '../base/index.js';
import { JHIPSTER_CONFIG_DIR } from '../generator-constants.js';
import { GenericTaskGroup, GenericSourceTypeDefinition } from '../base/tasks.js';
import { GenericSourceTypeDefinition, GenericTaskGroup } from '../base/tasks.js';
import { SpringBootSourceType } from '../server/types.js';
import { ClientSourceType } from '../client/types.js';
import { I18nApplication } from '../languages/types.js';
Expand Down Expand Up @@ -69,7 +69,7 @@ const {
POST_WRITING_ENTITIES_QUEUE,
} = QUEUES;

const asPriority = BaseGenerator.asPriority;
const { asPriority } = BaseGenerator;

export type BaseApplicationSource = Record<string, (...args: any[]) => any> & SpringBootSourceType & ClientSourceType & I18nApplication;

Expand Down
2 changes: 1 addition & 1 deletion generators/base-application/priorities.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

import { QUEUE_PREFIX, PRIORITY_NAMES as PRIORITY_NAMES_BASE, QUEUES as QUEUES_BASE } from '../base/priorities.js';
import { PRIORITY_NAMES as PRIORITY_NAMES_BASE, QUEUES as QUEUES_BASE, QUEUE_PREFIX } from '../base/priorities.js';

const { DEFAULT, TRANSFORM, MULTISTEP_TRANSFORM } = PRIORITY_NAMES_BASE;

Expand Down
2 changes: 1 addition & 1 deletion generators/base-application/support/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/
import { existsSync, opendirSync } from 'fs';
import { extname, basename } from 'path';
import { basename, extname } from 'path';

export function getEntitiesFromDir(configDir: string): string[] {
if (!existsSync(configDir)) {
Expand Down
2 changes: 1 addition & 1 deletion generators/base-application/support/enum.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const getEnums = (enums, customValuesState, comments) => {
};

const extractEnumInstance = field => {
const fieldType = field.fieldType;
const { fieldType } = field;
return lowerFirst(fieldType);
};

Expand Down
2 changes: 1 addition & 1 deletion generators/base-application/support/enum.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'assert';
import { before, it, describe } from 'esmocha';
import { before, describe, it } from 'esmocha';
import { getEnumInfo } from './enum.js';

describe('base-application - support - enum', () => {
Expand Down
4 changes: 2 additions & 2 deletions generators/base-application/support/prepare-entity.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
* limitations under the License.
*/

import { it, describe, beforeEach } from 'esmocha';
import { beforeEach, describe, it } from 'esmocha';
import { expect } from 'chai';
import { formatDateForChangelog } from '../../base/support/index.js';
import BaseGenerator from '../../base/index.js';
import { getConfigWithDefaults } from '../../../jdl/jhipster/index.js';
import { prepareEntityPrimaryKeyForTemplates, entityDefaultConfig } from './prepare-entity.js';
import { entityDefaultConfig, prepareEntityPrimaryKeyForTemplates } from './prepare-entity.js';

describe('generator - base-application - support - prepareEntity', () => {
const defaultGenerator = { jhipsterConfig: getConfigWithDefaults() };
Expand Down
14 changes: 7 additions & 7 deletions generators/base-application/support/prepare-entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { camelCase, kebabCase, startCase, upperFirst, sortedUniq, intersection, lowerFirst, uniq } from 'lodash-es';
import { camelCase, intersection, kebabCase, lowerFirst, sortedUniq, startCase, uniq, upperFirst } from 'lodash-es';
import pluralize from 'pluralize';

import type BaseGenerator from '../../base-core/index.js';
import { getDatabaseTypeData, hibernateSnakeCase } from '../../server/support/index.js';
import {
createFaker,
getMicroserviceAppName,
mutateData,
parseChangelog,
stringHashCode,
upperFirstCamelCase,
getMicroserviceAppName,
mutateData,
} from '../../base/support/index.js';
import { getTypescriptKeyType, getEntityParentPathAddition } from '../../client/support/index.js';
import { getEntityParentPathAddition, getTypescriptKeyType } from '../../client/support/index.js';
import {
applicationTypes,
binaryOptions,
Expand Down Expand Up @@ -111,9 +111,9 @@ const BASE_TEMPLATE_DATA = {
};

function _derivedProperties(entityWithConfig) {
const pagination = entityWithConfig.pagination;
const dto = entityWithConfig.dto;
const service = entityWithConfig.service;
const { pagination } = entityWithConfig;
const { dto } = entityWithConfig;
const { service } = entityWithConfig;
mutateData(entityWithConfig, {
paginationPagination: pagination === PAGINATION,
paginationInfiniteScroll: pagination === INFINITE_SCROLL,
Expand Down
12 changes: 6 additions & 6 deletions generators/base-application/support/prepare-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { snakeCase, startCase, upperFirst, defaults, kebabCase } from 'lodash-es';
import { defaults, kebabCase, snakeCase, startCase, upperFirst } from 'lodash-es';
import { fieldTypes, validations } from '../../../jdl/jhipster/index.js';
import { getTypescriptType, prepareField as prepareClientFieldForTemplates } from '../../client/support/index.js';
import { prepareField as prepareServerFieldForTemplates } from '../../server/support/index.js';
Expand Down Expand Up @@ -124,7 +124,7 @@ function generateFakeDataForField(field, faker, changelogDate, type = 'csv') {
}
} else if (field.fieldIsEnum) {
if (field.fieldValues.length !== 0) {
const enumValues = field.enumValues;
const { enumValues } = field;
data = enumValues[faker.number.int(enumValues.length - 1)].name;
} else {
this.log.warn(`Enum ${field.fieldType} is not valid`);
Expand Down Expand Up @@ -213,8 +213,8 @@ function generateFakeDataForField(field, faker, changelogDate, type = 'csv') {
}

function _derivedProperties(field) {
const fieldType = field.fieldType;
const fieldTypeBlobContent = field.fieldTypeBlobContent;
const { fieldType } = field;
const { fieldTypeBlobContent } = field;
const validationRules = field.fieldValidate ? field.fieldValidateRules : [];
defaults(field, {
blobContentTypeText: fieldTypeBlobContent === TEXT,
Expand Down Expand Up @@ -285,7 +285,7 @@ function prepareCommonFieldForTemplates(entityWithConfig, field, generator) {
defaults(field, {
entity: entityWithConfig,
});
const fieldType = field.fieldType;
const { fieldType } = field;

field.fieldIsEnum = !field.id && fieldIsEnum(fieldType);
if (field.fieldIsEnum) {
Expand All @@ -307,7 +307,7 @@ function prepareCommonFieldForTemplates(entityWithConfig, field, generator) {
field.maxlength = field.fieldValidateRulesMaxlength || 255;
}

const faker = entityWithConfig.faker;
const { faker } = entityWithConfig;
field.createRandexp = () => {
// check if regex is valid. If not, issue warning and we skip fake data generation.
try {
Expand Down
2 changes: 1 addition & 1 deletion generators/base-application/support/prepare-field.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

import { it, describe, beforeEach } from 'esmocha';
import { beforeEach, describe, it } from 'esmocha';
import { expect } from 'chai';
import { formatDateForChangelog } from '../../base/support/index.js';
import BaseGenerator from '../../base/index.js';
Expand Down
6 changes: 3 additions & 3 deletions generators/base-application/support/prepare-relationship.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { lowerFirst, startCase, upperFirst } from 'lodash-es';
import pluralize from 'pluralize';

import { databaseTypes, entityOptions, validations, checkAndReturnRelationshipOnValue } from '../../../jdl/jhipster/index.js';
import { checkAndReturnRelationshipOnValue, databaseTypes, entityOptions, validations } from '../../../jdl/jhipster/index.js';
import { getJoinTableName, hibernateSnakeCase } from '../../server/support/index.js';
import { mutateData } from '../../base/support/config.js';
import { stringifyApplicationData } from './debug.js';
Expand Down Expand Up @@ -114,7 +114,7 @@ export default function prepareRelationship(entityWithConfig, relationship, gene
relationship.otherEntityIsEmbedded = otherEntityData.embedded;

// Look for fields at the other other side of the relationship
const otherRelationship = relationship.otherRelationship;
const { otherRelationship } = relationship;
if (otherRelationship) {
relationship.otherSideReferenceExists = true;
} else if (
Expand Down Expand Up @@ -245,7 +245,7 @@ export default function prepareRelationship(entityWithConfig, relationship, gene
}

function relationshipToReference(entity, relationship, pathPrefix = []) {
const collection = relationship.collection;
const { collection } = relationship;
const name = collection ? relationship.relationshipNamePlural : relationship.relationshipName;
const reference = {
id: relationship.id,
Expand Down
4 changes: 2 additions & 2 deletions generators/base-application/support/relationship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
* limitations under the License.
*/

import { upperFirst, lowerFirst } from 'lodash-es';
import { lowerFirst, upperFirst } from 'lodash-es';

import { JSONRelationship, JSONEntity } from '../../../jdl/converters/types.js';
import { JSONEntity, JSONRelationship } from '../../../jdl/converters/types.js';
import { ValidationResult } from '../../base/api.js';
import { stringifyApplicationData } from './debug.js';
import { findEntityInEntities } from './entity.js';
Expand Down
2 changes: 1 addition & 1 deletion generators/base-application/support/task-type-inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/
import CoreGenerator from '../../base-core/generator.js';
import { WriteFileSection, WriteFileBlock } from '../../base/api.js';
import { WriteFileBlock, WriteFileSection } from '../../base/api.js';
import { GeneratorDefinition } from '../generator.js';

export function asWriteFilesSection<Data = GeneratorDefinition['writingTaskParam']['application']>(
Expand Down
2 changes: 1 addition & 1 deletion generators/base-application/tasks.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Storage } from 'yeoman-generator';
import { ControlTaskParam, BaseGeneratorDefinition, SourceTaskParam, GenericSourceTypeDefinition } from '../base/tasks.js';
import { BaseGeneratorDefinition, ControlTaskParam, GenericSourceTypeDefinition, SourceTaskParam } from '../base/tasks.js';
import { ClientSourceType } from '../client/types.js';
import { BaseChangelog } from '../base-entity-changes/types.js';
import { CommonClientServerApplication } from './types.js';
Expand Down
2 changes: 1 addition & 1 deletion generators/base-core/generator-core.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { it, describe, expect as jestExpect, beforeEach } from 'esmocha';
import { beforeEach, describe, it, expect as jestExpect } from 'esmocha';
import { basicHelpers as helpers } from '../../testing/index.js';

import { createJHipsterLogger } from '../base/support/logger.js';
Expand Down
Loading

0 comments on commit 505b1c8

Please sign in to comment.