Skip to content

Commit

Permalink
Merge pull request jhipster#23132 from mshima/skip_ci-unused-variables
Browse files Browse the repository at this point in the history
fix unused variables warnings
  • Loading branch information
DanielFran authored Aug 10, 2023
2 parents 5864b62 + 61d46e0 commit 94c06fe
Show file tree
Hide file tree
Showing 36 changed files with 40 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
"error",
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
],
"@typescript-eslint/no-explicit-any": "off",
Expand Down
4 changes: 2 additions & 2 deletions generators/azure-spring-cloud/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,13 @@ ${chalk.red('az extension add --name spring-cloud')}`,
exec(
`az spring-cloud app show --resource-group ${this.azureSpringCloudResourceGroupName} \
--service ${this.azureSpringCloudServiceName} --name ${this.azureSpringCloudAppName}`,
(err, stdout) => {
err => {
if (err) {
this.log.log(chalk.bold('Application does not exist yet, creating it...'));
exec(
`az spring-cloud app create --resource-group ${this.azureSpringCloudResourceGroupName} \
--service ${this.azureSpringCloudServiceName} --name ${this.azureSpringCloudAppName}`,
(err, stdout) => {
err => {
if (err) {
this.abort = true;
this.log.error(`Application creation failed! Here is the error: ${err}`);
Expand Down
5 changes: 1 addition & 4 deletions generators/base-application/application-options.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ export type DeterministicOptionWithDerivedProperties<N extends string, T extends
>;

// OptionWithDerivedProperties<'aProperty', ['foo', 'bar']> = { aProperty: 'foo' | 'bar'; aPropertyFoo: boolean; aPropertyBar: boolean; }
export type OptionWithDerivedProperties<N extends string, T extends string[], A extends any[] = []> = Record<
N,
Exclude<ArrayToUnion<T>, 'any'> | undefined
> &
export type OptionWithDerivedProperties<N extends string, T extends string[]> = Record<N, Exclude<ArrayToUnion<T>, 'any'> | undefined> &
Record<`${N}${Capitalize<ArrayToUnion<T>>}`, boolean> &
('no' extends ArrayToUnion<T> ? Record<`${N}Any`, boolean> : Record<string, never>);

Expand Down
1 change: 1 addition & 0 deletions generators/base/priorities.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const WRITING = 'writing';

const TRANSFORM = 'transform';

// eslint-disable-next-line unused-imports/no-unused-vars
const CONFLICTS = 'conflicts';

const INSTALL = 'install';
Expand Down
2 changes: 1 addition & 1 deletion generators/client/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default class JHipsterClientGenerator extends BaseApplicationGenerator {
get composing() {
return this.asComposingTaskGroup({
async composing() {
const { clientFramework, testFrameworks, enableTranslation } = this.jhipsterConfigWithDefaults;
const { clientFramework, testFrameworks } = this.jhipsterConfigWithDefaults;
if ([ANGULAR, VUE, REACT].includes(clientFramework)) {
await this.composeWithJHipster(clientFramework);
}
Expand Down
2 changes: 1 addition & 1 deletion generators/client/support/prepare-entity.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import getTypescriptKeyType from './types-utils.mjs';

export default function prepareEntity(entity) {}
export default function prepareEntity() {}

export function preparePostEntityClientDerivedProperties(entity) {
if (entity.primaryKey) {
Expand Down
2 changes: 1 addition & 1 deletion generators/client/support/prepare-field.mjs
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.
*/
export default function prepareField(entityWithConfig, field, generator) {
export default function prepareField(entityWithConfig, field) {
if (field.fieldValidateRulesPatternAngular === undefined) {
field.fieldValidateRulesPatternAngular = field.fieldValidateRulesPattern
? field.fieldValidateRulesPattern.replace(/"/g, '&#34;')
Expand Down
2 changes: 1 addition & 1 deletion generators/cloudfoundry/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export default class CloudfoundryGenerator extends BaseGenerator {
if (this.abort || !this.cloudfoundry_remote_exists) return;
this.log.log(chalk.bold('\nRestarting your cloudfoundry app.\n'));

exec(`cf restart ${this.cloudfoundryDeployedName}`, (err, stdout, stderr) => {
exec(`cf restart ${this.cloudfoundryDeployedName}`, () => {
this.log.log(chalk.green('\nYour app should now be live'));
});
},
Expand Down
2 changes: 1 addition & 1 deletion generators/cypress/generator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export default class CypressGenerator extends BaseApplicationGenerator {
return this.delegateTasksToBlueprint(() => this.postWriting);
}

generateTestEntity(references, index = 'random') {
generateTestEntity(references) {
return entityWithFakeValues(references);
}
}
3 changes: 1 addition & 2 deletions generators/docker/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ export default class DockerGenerator extends BaseApplicationGenerator {

packageJsonScripts({ application }) {
const scriptsStorage = this.packageJson.createStorage('scripts');
const { databaseType, databaseTypeSql, prodDatabaseType, prodDatabaseTypeNo, prodDatabaseTypeMysql, prodDatabaseTypeOracle } =
application;
const { databaseType, databaseTypeSql, prodDatabaseType, prodDatabaseTypeNo, prodDatabaseTypeOracle } = application;
let postServicesSleep;

if (databaseTypeSql) {
Expand Down
4 changes: 2 additions & 2 deletions generators/entity/prompts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ function askForField() {

return true;
},
message: answers => {
message: () => {
if (!context.existingEnum) {
return 'What are the values of your enumeration (separated by comma, no spaces)?';
}
Expand Down Expand Up @@ -995,7 +995,7 @@ function askForRelationship() {
type: 'input',
name: 'otherEntityRelationshipName',
message: 'What is the name of this relationship in the other entity?',
default: response => _.lowerFirst(name),
default: () => _.lowerFirst(name),
},
{
when: response =>
Expand Down
4 changes: 2 additions & 2 deletions generators/gae/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default class GaeGenerator extends BaseGenerator {
shelljs.exec(
'gcloud components list --quiet --filter="Status=Installed OR Status=\\"Update Available\\"" --format="value(id)"',
{ silent: true },
(err, stdout, srderr) => {
(err, stdout) => {
if (_.includes(stdout, component)) {
done();
} else {
Expand Down Expand Up @@ -694,7 +694,7 @@ export default class GaeGenerator extends BaseGenerator {
shelljs.exec(
`gcloud sql users list -i jhipster --format="value(name)" --project="${this.gcpProjectId}"`,
{ silent: true },
(code, stdout, err) => {
(_code, stdout) => {
if (_.includes(stdout, this.gcpCloudSqlUserName)) {
this.log.log(chalk.bold(`... User "${chalk.cyan(this.gcpCloudSqlUserName)}" already exists`));
const cmd = `gcloud sql users set-password "${this.gcpCloudSqlUserName}" -i "${name}" --host="%" --project="${this.gcpProjectId}" --password="..."`;
Expand Down
3 changes: 1 addition & 2 deletions generators/gatling/cleanup.mts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type Generator from './generator.mjs';

/**
* Removes server files that where generated in previous JHipster versions and therefore
* need to be removed.
*/
export default function cleanupTask(this: Generator, { application }: any) {}
export default function cleanupTask() {}
2 changes: 1 addition & 1 deletion generators/gatling/entity-files.mts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const gatlingFiles = {
],
};

export function cleanupEntitiesTask({ application, entities }) {}
export function cleanupEntitiesTask() {}

export default async function writeEntitiesTask(this: Generator, { application, entities }) {
for (const entity of entities.filter(entity => !entity.builtIn && !entity.skipServer)) {
Expand Down
2 changes: 1 addition & 1 deletion generators/generate-blueprint/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import chalk from 'chalk';
import * as GENERATOR_LIST from '../generator-list.mjs';
import { PRIORITY_NAMES_LIST } from '../base-application/priorities.mjs';

const prioritiesForSub = subGenerator => PRIORITY_NAMES_LIST;
const prioritiesForSub = () => PRIORITY_NAMES_LIST;

export const GENERATE_SNAPSHOTS = 'generateSnapshots';
export const LINK_JHIPSTER_DEPENDENCY = 'linkJhipsterDependency';
Expand Down
2 changes: 1 addition & 1 deletion generators/heroku/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export default class HerokuGenerator extends BaseGenerator {
this.log.verboseInfo('');
this.prompt(prompts).then(props => {
if (props.herokuForceName === 'Yes') {
ChildProcess.exec(`heroku git:remote --app ${this.herokuAppName}`, (err, stdout, stderr) => {
ChildProcess.exec(`heroku git:remote --app ${this.herokuAppName}`, (err, stdout) => {
if (err) {
this.abort = true;
this.log.error(err);
Expand Down
3 changes: 1 addition & 2 deletions generators/java/cleanup.mts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type Generator from './generator.mjs';

/**
* Removes server files that where generated in previous JHipster versions and therefore
* need to be removed.
*/
export default function cleanupTask(this: Generator, { application }: any) {}
export default function cleanupTask() {}
2 changes: 1 addition & 1 deletion generators/kubernetes/files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const { GATEWAY, MONOLITH } = applicationTypes;
const { JWT } = authenticationTypes;
const { PROMETHEUS } = monitoringTypes;
const { CONSUL, EUREKA } = serviceDiscoveryTypes;
const { GKE, NGINX } = ingressTypes;
const { GKE } = ingressTypes;

const NO_DATABASE = databaseTypes.NO;

Expand Down
6 changes: 3 additions & 3 deletions generators/liquibase-changelogs/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default class DatabaseChangelogLiquibase extends BaseApplication {
? // generate id fields first to improve reproducibility
[...entityChanges.fields.filter(f => f.id), ...entityChanges.fields.filter(f => !f.id)]
: [...entityChanges.allFields.filter(f => f.id), ...entityChanges.addedFields.filter(f => !f.id)];
fields.forEach((field, idx) => {
fields.forEach(field => {
if (field.derived) {
Object.defineProperty(rowData, field.fieldName, {
get: () => {
Expand Down Expand Up @@ -134,7 +134,7 @@ export default class DatabaseChangelogLiquibase extends BaseApplication {

get default() {
return {
prepareRelationshipsForTemplates({ application }) {
prepareRelationshipsForTemplates() {
const entityChanges = this.entityChanges;
const databaseChangelog = this.databaseChangelog;
const entity = this.entity;
Expand Down Expand Up @@ -220,7 +220,7 @@ export default class DatabaseChangelogLiquibase extends BaseApplication {
// Public API method used by the getter and also by Blueprints
get postWritingEntities() {
return this.asPostWritingTaskGroup({
writeLiquibaseFiles({ application, source }) {
writeLiquibaseFiles({ source }) {
const entity = this.entity;
if (entity.skipServer) {
return {};
Expand Down
2 changes: 1 addition & 1 deletion generators/openshift/prompts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function askForStorageType() {
if (this.regenerate) return;

let storageEnabled = false;
this.appConfigs.some((appConfig, index) => {
this.appConfigs.some(appConfig => {
if (appConfig.prodDatabaseType !== NO_DATABASE || appConfig.searchEngine === ELASTICSEARCH || appConfig.monitoring === PROMETHEUS) {
storageEnabled = true;
return storageEnabled;
Expand Down
2 changes: 1 addition & 1 deletion generators/react/entity-files-react.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const reactFiles = {
},
{
...clientApplicationBlock,
renameTo: (data, filepath) => `${data.clientSrcDir}app/shared/model/${data.entityModelFileName}.model.ts`,
renameTo: data => `${data.clientSrcDir}app/shared/model/${data.entityModelFileName}.model.ts`,
templates: ['entities/_entityFolder/_entityModel.model.ts'],
},
{
Expand Down
2 changes: 1 addition & 1 deletion generators/react/support/update-languages.mts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function updateLanguagesInWebpackReactTask(this: BaseGenerator, { application, c
const { ignoreNeedlesError: ignoreNonExisting } = control;
let newContent = 'groupBy: [\n';
// prettier-ignore
languages?.forEach((language, i) => {
languages?.forEach((language) => {
newContent += ` { pattern: "./${clientSrcDir}i18n/${language}/*.json", fileName: "./i18n/${language}.json" },\n`;
});
newContent +=
Expand Down
2 changes: 1 addition & 1 deletion generators/server/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export default class JHipsterServerGenerator extends BaseApplicationGenerator {
}
},

setupServerconsts({ control, application }) {
setupServerconsts({ application }) {
// Make constants available in templates
application.MAIN_DIR = MAIN_DIR;
application.TEST_DIR = TEST_DIR;
Expand Down
2 changes: 1 addition & 1 deletion generators/spring-data-cassandra/entity-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const entityFiles = {
],
};

export function cleanupCassandraEntityFilesTask({ application, entities }) {}
export function cleanupCassandraEntityFilesTask() {}

export default async function writeEntityCassandraFiles({ application, entities }) {
for (const entity of entities.filter(entity => !entity.builtIn && !entity.skipServer)) {
Expand Down
2 changes: 1 addition & 1 deletion generators/spring-data-mongodb/entity-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const entityFiles = {
],
};

export function cleanupMongodbEntityFilesTask({ application, entities }) {}
export function cleanupMongodbEntityFilesTask() {}

export default async function writeEntityMongodbFiles({ application, entities }) {
for (const entity of entities.filter(entity => !entity.builtIn && !entity.skipServer)) {
Expand Down
2 changes: 1 addition & 1 deletion generators/spring-data-neo4j/entity-files.mts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const entityFiles = {
],
};

export function cleanupEntitiesTask(this: Generator, { application, entities }) {}
export function cleanupEntitiesTask() {}

export default async function writeEntitiesTask(this: Generator, { application, entities }) {
for (const entity of entities.filter(entity => !entity.builtIn && !entity.skipServer)) {
Expand Down
3 changes: 0 additions & 3 deletions generators/spring-data-neo4j/generator.spec.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { basename, dirname } from 'path';
import { fileURLToPath } from 'url';
import { expect } from 'esmocha';
import lodash from 'lodash';

import { buildSamplesFromMatrix, buildServerMatrix, entitiesSimple as entities } from '../../test/support/index.mjs';
import { shouldSupportFeatures, testBlueprintSupport } from '../../test/support/tests.mjs';
Expand All @@ -12,8 +11,6 @@ import { databaseTypes } from '../../jdl/jhipster/index.mjs';
import { mockedGenerators, shouldComposeWithSpringCloudStream, shouldComposeWithLiquibase } from '../server/__test-support/index.mjs';
import { GENERATOR_SERVER } from '../generator-list.mjs';

const { snakeCase } = lodash;

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

Expand Down
2 changes: 1 addition & 1 deletion generators/spring-data-relational/entity-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const sqlFiles = {
],
};

export function cleanupEntitiesTask({ application, entities }) {}
export function cleanupEntitiesTask() {}

export default async function writeEntitiesTask({ application, entities }) {
for (const entity of entities.filter(entity => !entity.skipServer)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const getH2MavenDefinition = ({
export const getDatabaseTypeMavenDefinition: (
databaseType: string,
options: { inProfile?: string; javaDependencies: Record<string, string> },
) => DatabaseTypeDependencies = (databaseType, { inProfile, javaDependencies }) => {
) => DatabaseTypeDependencies = (databaseType, { inProfile }) => {
const dependenciesForType: Record<string, DatabaseTypeDependencies> = {
mariadb: {
jdbc: {
Expand Down
3 changes: 1 addition & 2 deletions generators/spring-websocket/cleanup.mts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type Generator from './generator.mjs';

/**
* Removes server files that where generated in previous JHipster versions and therefore
* need to be removed.
*/
export default function cleanupTask(this: Generator, { application }: any) {}
export default function cleanupTask() {}
2 changes: 1 addition & 1 deletion generators/statistics.mts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Statistics {
}
}

postWithProxy(url, data, config) {
postWithProxy(url, data) {
return this.axiosProxyClient.post(url, data);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ export default { convertApplications };
/**
* Converts parsed applications to JDL applications.
* @param {Array<Object>} parsedApplications - the parsed applications.
* @param {Object} configuration - a configuration object.
* @return {Array} the converted JDL applications.
*/
export function convertApplications(parsedApplications, configuration = {}) {
export function convertApplications(parsedApplications) {
if (!parsedApplications) {
throw new Error('Applications have to be passed so as to be converted.');
}
Expand Down
2 changes: 1 addition & 1 deletion jdl/parsing/generated/generated-serialized-grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

/* eslint-disable no-unused-vars */
/* eslint-disable unused-imports/no-unused-vars */
const serializedGrammar = [
{
type: 'Rule',
Expand Down
4 changes: 2 additions & 2 deletions jdl/validators/jdl-with-application-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function createValidator(jdlObject: JDLObject, logger: any = cons
checkForRelationshipErrors();
checkForEnumErrors();
checkDeploymentsErrors();
checkForOptionErrors(jdlApplication);
checkForOptionErrors();
});
checkForRelationshipsBetweenApplications();
},
Expand Down Expand Up @@ -131,7 +131,7 @@ export default function createValidator(jdlObject: JDLObject, logger: any = cons
});
}

function checkForOptionErrors(jdlApplication) {
function checkForOptionErrors() {
if (jdlObject.getOptionQuantity() === 0) {
return;
}
Expand Down
Loading

0 comments on commit 94c06fe

Please sign in to comment.