Skip to content

Commit

Permalink
Merge pull request #22892 from mshima/skip_ci-eslint
Browse files Browse the repository at this point in the history
add eslint-plugin-unused-imports and fix others unsused variables
  • Loading branch information
DanielFran authored Jul 17, 2023
2 parents 19aefc6 + ff7da45 commit f4f0d27
Show file tree
Hide file tree
Showing 53 changed files with 85 additions and 121 deletions.
12 changes: 5 additions & 7 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"extends": ["airbnb-base", "plugin:prettier/recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["mocha", "prettier", "chai-friendly", "@typescript-eslint"],
"plugins": ["mocha", "prettier", "chai-friendly", "@typescript-eslint", "unused-imports"],
"settings": {
"import/core-modules": ["generator-jhipster", "generator-jhipster/support"]
},
Expand Down Expand Up @@ -69,13 +69,11 @@
"no-promise-executor-return": "off",
"no-irregular-whitespace": 2,
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unused-vars": [
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
],
"@typescript-eslint/no-explicit-any": "off",
"comma-dangle": "off",
Expand Down
1 change: 0 additions & 1 deletion cli/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
/* eslint-disable no-console */
import chalk from 'chalk';
import _ from 'lodash';

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

Expand Down
1 change: 0 additions & 1 deletion generators/angular/files-angular.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createTranslationReplacer } from './support/index.mjs';

import { clientApplicationBlock, clientSrcBlock } from '../client/utils.mjs';

Expand Down
2 changes: 1 addition & 1 deletion generators/app/prompts.spec.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defaultHelpers as helpers, result as runResult } from '../../test/support/index.mjs';
import { defaultHelpers as helpers } from '../../test/support/index.mjs';
import {
applicationTypes,
databaseTypes,
Expand Down
8 changes: 4 additions & 4 deletions generators/azure-app-service/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default class AzureAppServiceGenerator extends BaseGenerator {
if (this.abort) return;
const done = this.async();

exec('az --version', err => {
exec('az --version', () => {
done(
new Error(`You don't have the Azure CLI installed.
Download it from:
Expand Down Expand Up @@ -285,7 +285,7 @@ export default class AzureAppServiceGenerator extends BaseGenerator {
const done = this.async();
this.log.log(chalk.bold(`\nChecking Azure App Service plan '${this.azureAppServicePlan}'...`));
let servicePlanAlreadyExists = false;
exec(`az appservice plan list --resource-group ${this.azureAppServiceResourceGroupName}`, (err, stdout, stderr) => {
exec(`az appservice plan list --resource-group ${this.azureAppServiceResourceGroupName}`, (err, stdout) => {
if (err) {
this.abort = true;
throw new Error('Could not list your Azure App Service plans');
Expand Down Expand Up @@ -327,7 +327,7 @@ which is free for the first 30 days`);
if (this.abort) return;
const done = this.async();
this.log.log(chalk.bold(`\nChecking Azure App Service '${this.azureAppServiceName}'...`));
exec(`az webapp list --query "[]" --resource-group ${this.azureAppServiceResourceGroupName}`, (err, stdout, stderr) => {
exec(`az webapp list --query "[]" --resource-group ${this.azureAppServiceResourceGroupName}`, (err, stdout) => {
if (err) {
this.abort = true;
throw new Error('Could not list your Azure App Service instances');
Expand Down Expand Up @@ -373,7 +373,7 @@ which is free for the first 30 days`);
this.log.verboseInfo("Enabling 'prod' and 'azure' Spring Boot profiles");
exec(
`az webapp config appsettings set --resource-group ${this.azureAppServiceResourceGroupName} --name ${this.azureAppServiceName} --settings SPRING_PROFILES_ACTIVE=prod,azure`,
(err, stdout) => {
err => {
if (err) {
this.abort = true;
throw new Error('Could not configure Azure App Service instance');
Expand Down
2 changes: 1 addition & 1 deletion generators/base-application/application-options.d.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UnionToIntersection, EmptyObject, StringKeyOf } from 'type-fest';
import type { UnionToIntersection, StringKeyOf } 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-docker/docker-prompts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ async function askForServiceDiscovery() {
if (this.regenerate) return;

const serviceDiscoveryEnabledApps = [];
this.appConfigs.forEach((appConfig, index) => {
this.appConfigs.forEach(appConfig => {
if (appConfig.serviceDiscoveryAny) {
serviceDiscoveryEnabledApps.push({
baseName: appConfig.baseName,
Expand Down
1 change: 0 additions & 1 deletion generators/base/support/faker.mts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { Faker, base } from '@faker-js/faker';
import Randexp from 'randexp';

import { languageToJavaLanguage } from '../../languages/support/index.mjs';
import { stringHashCode } from './string.mjs';

class RandexpWithFaker extends Randexp {
faker: Faker;
Expand Down
2 changes: 1 addition & 1 deletion generators/bootstrap-application-server/generator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class BoostrapApplicationServer extends BaseApplicationGenerator

get loading() {
return this.asLoadingTaskGroup({
async loadApplication({ application, control }) {
async loadApplication({ application }) {
this.loadServerConfig(undefined, application);

(application as any).gradleVersion = this.useVersionPlaceholders ? 'GRADLE_VERSION' : GRADLE_VERSION;
Expand Down
4 changes: 1 addition & 3 deletions generators/client/entity-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import { CLIENT_MAIN_SRC_DIR } from '../generator-constants.mjs';
import { getEnumInfo } from '../base-application/support/index.mjs';

const CLIENT_COMMON_TEMPLATES_DIR = 'entity/common';

async function addEnumerationFiles({ application, entity }) {
for (const field of entity.fields) {
if (field.fieldIsEnum === true) {
Expand All @@ -35,7 +33,7 @@ async function addEnumerationFiles({ application, entity }) {
templates: [
{
sourceFile: `${CLIENT_MAIN_SRC_DIR}app/entities/enumerations/enum.model.ts`,
destinationFile: ctx => `${application.webappEnumerationsDir}${enumFileName}.model.ts`,
destinationFile: `${application.webappEnumerationsDir}${enumFileName}.model.ts`,
},
],
context: enumInfo,
Expand Down
1 change: 0 additions & 1 deletion generators/client/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import _ from 'lodash';

import BaseApplicationGenerator from '../base-application/index.mjs';

Expand Down
2 changes: 1 addition & 1 deletion generators/client/support/entity-definition.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import getTypescriptKeyType from './types-utils.mjs';

import { fieldTypes, validations, clientFrameworkTypes, relationshipTypes } from '../../../jdl/jhipster/index.mjs';
import { fieldTypes, validations, clientFrameworkTypes } from '../../../jdl/jhipster/index.mjs';

const dbTypes = fieldTypes;
const {
Expand Down
4 changes: 2 additions & 2 deletions generators/cloudfoundry/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default class CloudfoundryGenerator extends BaseGenerator {
const done = this.async();

this.log.log(chalk.bold('\nChecking for an existing Cloud Foundry hosting environment...'));
exec(`cf app ${this.cloudfoundryDeployedName} `, {}, (err, stdout, stderr) => {
exec(`cf app ${this.cloudfoundryDeployedName} `, {}, (_err, stdout) => {
// Unauthenticated
if (stdout.search('cf login') >= 0) {
this.log.error("Error: Not authenticated. Run 'cf login' to login to your cloudfoundry account and try again.");
Expand All @@ -150,7 +150,7 @@ export default class CloudfoundryGenerator extends BaseGenerator {
const child = exec(
`cf create-service ${this.cloudfoundryDatabaseServiceName} ${this.cloudfoundryDatabaseServicePlan} ${this.cloudfoundryDeployedName}`,
{},
(err, stdout, stderr) => {
() => {
done();
},
);
Expand Down
6 changes: 3 additions & 3 deletions generators/cloudfoundry/prompts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
};

async function prompting() {
const databaseType = this.databaseType;
const databaseType = this.databaseType ?? this.jhipsterConfig.databaseType;
const prompts = [
{
name: 'cloudfoundryDeployedName',
Expand All @@ -52,13 +52,13 @@ async function prompting() {
default: 0,
},
{
when: response => databaseType !== NO_DATABASE,
when: () => databaseType !== NO_DATABASE,
name: 'cloudfoundryDatabaseServiceName',
message: 'What is the name of your database service?',
default: 'elephantsql',
},
{
when: response => databaseType !== NO_DATABASE,
when: () => databaseType !== NO_DATABASE,
name: 'cloudfoundryDatabaseServicePlan',
message: 'What is the name of your database plan?',
default: 'turtle',
Expand Down
2 changes: 0 additions & 2 deletions generators/common/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* limitations under the License.
*/
/* eslint-disable consistent-return */
import _ from 'lodash';

import BaseApplicationGenerator from '../base-application/index.mjs';

Expand All @@ -30,7 +29,6 @@ import {
JHIPSTER_DOCUMENTATION_ARCHIVE_PATH,
} from '../generator-constants.mjs';
import { clientFrameworkTypes } from '../../jdl/jhipster/index.mjs';
import { packageJson } from '../../lib/index.mjs';
import { GENERATOR_COMMON, GENERATOR_BOOTSTRAP_APPLICATION, GENERATOR_GIT } from '../generator-list.mjs';
import command from './command.mjs';

Expand Down
1 change: 0 additions & 1 deletion generators/cypress/generator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import _ from 'lodash';

import { stringHashCode, createFaker } from '../base/support/index.mjs';
import BaseApplicationGenerator from '../base-application/index.mjs';
Expand Down
1 change: 0 additions & 1 deletion generators/entities/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import BaseApplicationGenerator from '../base-application/index.mjs';
import { JHIPSTER_CONFIG_DIR } from '../generator-constants.mjs';
import { GENERATOR_ENTITIES, GENERATOR_APP } from '../generator-list.mjs';
import { getDefaultAppName } from '../project-name/support/index.mjs';

export default class EntitiesGenerator extends BaseApplicationGenerator {
constructor(args, options, features) {
Expand Down
6 changes: 3 additions & 3 deletions generators/gae/templates.mjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
export const mavenPluginConfiguration = data => `
export const mavenPluginConfiguration = () => `
<configuration>
<deploy.projectId><%= gcpProjectId %></deploy.projectId>
<deploy.version>1</deploy.version>
</configuration>
`;

export const mavenProdProfileContent = data => ` <properties>
export const mavenProdProfileContent = () => ` <properties>
<spring.profiles.active>prod\${profile.api-docs}${
// eslint-disable-next-line no-template-curly-in-string
this.databaseTypeSql ? '${profile.no-liquibase},prod-gae' : ''
}</spring.profiles.active>
</properties>
`;

export const mavenProfileContent = data => ` <dependencies>
export const mavenProfileContent = () => ` <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
Expand Down
14 changes: 7 additions & 7 deletions generators/heroku/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export default class HerokuGenerator extends BaseGenerator {
} catch (e) {
// An exception is thrown if the folder doesn't exist
this.log.log(chalk.bold('\nInitializing Git repository'));
const child = ChildProcess.exec('git init', (err, stdout, stderr) => {
const child = ChildProcess.exec('git init', () => {
done();
});
child.stdout.on('data', data => {
Expand All @@ -335,7 +335,7 @@ export default class HerokuGenerator extends BaseGenerator {
done();
} else {
this.log.log(chalk.bold('\nInstalling Heroku CLI deployment plugin'));
const child = ChildProcess.exec(`heroku plugins:install ${cliPlugin}`, (err, stdout) => {
const child = ChildProcess.exec(`heroku plugins:install ${cliPlugin}`, err => {
if (err) {
this.abort = true;
this.log.error(err);
Expand Down Expand Up @@ -397,7 +397,7 @@ export default class HerokuGenerator extends BaseGenerator {
done();
});
} else {
ChildProcess.exec(`heroku create ${regionParams}`, (err, stdout, stderr) => {
ChildProcess.exec(`heroku create ${regionParams}`, (err, stdout) => {
if (err) {
this.abort = true;
this.log.error(err);
Expand All @@ -407,7 +407,7 @@ export default class HerokuGenerator extends BaseGenerator {
this.log.verboseInfo(stdout.trim());

// ensure that the git remote is the same as the appName
ChildProcess.exec(`heroku git:remote --app ${this.herokuAppName}`, (err, stdout, stderr) => {
ChildProcess.exec(`heroku git:remote --app ${this.herokuAppName}`, err => {
if (err) {
this.abort = true;
this.log.error(err);
Expand Down Expand Up @@ -453,7 +453,7 @@ export default class HerokuGenerator extends BaseGenerator {
if (this.abort) return;
const done = this.async();

const addonCreateCallback = (addon, err, stdout, stderr) => {
const addonCreateCallback = (addon, err) => {
if (err) {
const verifyAccountUrl = 'https://heroku.com/verify';
if (_.includes(err, verifyAccountUrl)) {
Expand Down Expand Up @@ -552,7 +552,7 @@ export default class HerokuGenerator extends BaseGenerator {
props.herokuJHipsterRegistryPassword = encodeURIComponent(props.herokuJHipsterRegistryPassword);
const herokuJHipsterRegistry = `https://${props.herokuJHipsterRegistryUsername}:${props.herokuJHipsterRegistryPassword}@${props.herokuJHipsterRegistryApp}.herokuapp.com`;
const configSetCmd = `heroku config:set JHIPSTER_REGISTRY_URL=${herokuJHipsterRegistry} --app ${this.herokuAppName}`;
const child = ChildProcess.exec(configSetCmd, (err, stdout, stderr) => {
const child = ChildProcess.exec(configSetCmd, err => {
if (err) {
this.abort = true;
this.log.error(err);
Expand Down Expand Up @@ -589,7 +589,7 @@ export default class HerokuGenerator extends BaseGenerator {
}
if (this.useOkta) {
this.writeFile('provision-okta-addon.sh.ejs', 'provision-okta-addon.sh');
fs.appendFile('.gitignore', 'provision-okta-addon.sh', 'utf8', (err, data) => {
fs.appendFile('.gitignore', 'provision-okta-addon.sh', 'utf8', err => {
if (err) {
this.log.warn(`${chalk.yellow.bold('WARNING!')} Failed to add 'provision-okta-addon.sh' to .gitignore.'`);
}
Expand Down
1 change: 0 additions & 1 deletion generators/languages/languages.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { dirname, join } from 'path';
import { basicHelpers, defaultHelpers as helpers, result as runResult } from '../../test/support/helpers.mjs';

import { CLIENT_MAIN_SRC_DIR, SERVER_MAIN_RES_DIR, CLIENT_WEBPACK_DIR } from '../generator-constants.mjs';
import EnvironmentBuilder from '../../cli/environment-builder.mjs';
import { supportedLanguages } from './support/index.mjs';

const __filename = fileURLToPath(import.meta.url);
Expand Down
1 change: 0 additions & 1 deletion generators/liquibase/generator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
import fs from 'fs';

import _ from 'lodash';
import BaseApplicationGenerator from '../base-application/index.mjs';
import { GENERATOR_LIQUIBASE, GENERATOR_LIQUIBASE_CHANGELOGS, GENERATOR_BOOTSTRAP_APPLICATION_SERVER } from '../generator-list.mjs';
import { liquibaseFiles } from './files.mjs';
Expand Down
1 change: 0 additions & 1 deletion generators/openshift/openshift.spec.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import assert from 'assert';
import { expect } from 'esmocha';

import { dryRunHelpers as helpers, getGenerator } from '../../test/support/index.mjs';
Expand Down
1 change: 0 additions & 1 deletion generators/page/page.spec.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { basicHelpers as helpers } from '../../test/support/index.mjs';

import EnvironmentBuilder from '../../cli/environment-builder.mjs';
import { CLIENT_MAIN_SRC_DIR, CLIENT_TEST_SRC_DIR } from '../generator-constants.mjs';

const CLIENT_SPEC_SRC_DIR = `${CLIENT_TEST_SRC_DIR}spec/`;
Expand Down
1 change: 0 additions & 1 deletion generators/server/support/doc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import _ from 'lodash';
import { formatDocAsSingleLine } from '../../base-application/support/index.mjs';

const escapeDoubleQuotes = text => {
Expand Down
4 changes: 2 additions & 2 deletions generators/spring-cache/generator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ export default class SpringCacheGenerator extends BaseApplicationGenerator {
};
} else {
// Add noop
source.addEntryToCache = ({ entry }) => {};
source.addEntryToCache = () => {};
// Add noop
source.addEntityToCache = ({ entityAbsoluteClass }) => {};
source.addEntityToCache = () => {};
}
},
});
Expand Down
2 changes: 1 addition & 1 deletion generators/spring-cache/internal/dependencies.mts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*/

import { MavenDefinition, MavenDependency, MavenProperty } from '../../maven/types.mjs';
import { MavenDefinition } from '../../maven/types.mjs';

const javaxCacheApi = {
groupId: 'javax.cache',
Expand Down
1 change: 0 additions & 1 deletion generators/spring-cloud-stream/generator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import _ from 'lodash';

import BaseApplicationGenerator from '../base-application/index.mjs';
import { GENERATOR_SPRING_CLOUD_STREAM, GENERATOR_BOOTSTRAP_APPLICATION_SERVER } from '../generator-list.mjs';
Expand Down
2 changes: 1 addition & 1 deletion generators/spring-controller/spring-controller.spec.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defaultHelpers as helpers, result as runResult } from '../../test/support/index.mjs';
import { SERVER_MAIN_SRC_DIR, SERVER_TEST_SRC_DIR, GENERATOR_JHIPSTER } from '../generator-constants.mjs';
import { SERVER_MAIN_SRC_DIR, SERVER_TEST_SRC_DIR } from '../generator-constants.mjs';
import { getGenerator } from '../../test/support/index.mjs';

const generator = getGenerator('spring-controller');
Expand Down
1 change: 0 additions & 1 deletion generators/spring-data-cassandra/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import _ from 'lodash';

import BaseApplicationGenerator from '../base-application/index.mjs';
import { GENERATOR_SPRING_DATA_CASSANDRA, GENERATOR_BOOTSTRAP_APPLICATION } from '../generator-list.mjs';
Expand Down
Loading

0 comments on commit f4f0d27

Please sign in to comment.