Skip to content

Commit

Permalink
Merge branch 'jhipster:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Aug 8, 2024
2 parents 157891f + 9fb0e3f commit 60b320f
Show file tree
Hide file tree
Showing 366 changed files with 686 additions and 882 deletions.
2 changes: 1 addition & 1 deletion .blueprint/generate-generator/generator.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BaseGenerator from '../../generators/base/index.js';
import { camelCase, upperFirst } from 'lodash-es';
import BaseGenerator from '../../generators/base/index.js';

export default class extends BaseGenerator {
generatorNamespace;
Expand Down
2 changes: 1 addition & 1 deletion .blueprint/generate-sample/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { basename, extname, resolve } from 'path';
import { transform } from '@yeoman/transform';
import BaseGenerator from '../../generators/base/index.js';
import { packageJson } from '../../lib/index.js';
import { generateSample, entitiesByType } from './support/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';

export default class extends BaseGenerator {
sampleName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { jdlEntitiesSamplesFolder } from '../../constants.js';
const isDirectory = dir => {
try {
return statSync(dir).isDirectory();
} catch (error) {
} catch {
return false;
}
};
Expand Down
5 changes: 3 additions & 2 deletions .blueprint/generate-sample/support/generate-sample.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { cpSync, existsSync, mkdirSync } from 'fs';
import { join, resolve } from 'path';
import { join } from 'path';
import process from 'process';
import { globSync } from 'glob';
import { execa } from 'execa';

import { dailyBuildsFolder, jdlEntitiesSamplesFolder, jdlSamplesFolder, jhipsterBin, samplesFolder } from '../../constants.js';
import getSamples, { DAILY_PREFIX, isDaily } from './get-workflow-samples.js';
import copyEntitySamples from './copy-entity-samples.js';
import copyJdlEntitySamples from './copy-jdl-entity-samples.js';
import { dailyBuildsFolder, jdlEntitiesSamplesFolder, jdlSamplesFolder, jhipsterBin, samplesFolder } from '../../constants.js';

const commonCliOptions = ['--skip-jhipster-dependencies', '--skip-checks', '--skip-install', '--no-insight'];

Expand All @@ -34,6 +34,7 @@ export const generateSample = async (
process.chdir(destProjectFolder);

if (!sample) {
// eslint-disable-next-line no-console
console.log(`Sample ${sampleName} was not found`);
}

Expand Down
2 changes: 2 additions & 0 deletions .blueprint/update-vscode/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class extends BaseGenerator {
request: 'launch',
internalConsoleOptions: 'neverOpen',
name: 'update vscode launch.json',
// eslint-disable-next-line no-template-curly-in-string
program: '${workspaceFolder}/test-integration/scripts/99-update-vscode.js',
console: 'integratedTerminal',
},
Expand All @@ -41,6 +42,7 @@ export default class extends BaseGenerator {
request: 'launch',
internalConsoleOptions: 'neverOpen',
name: `generate sample from ${workflowName} workflow`,
// eslint-disable-next-line no-template-curly-in-string
program: '${workspaceFolder}/bin/jhipster.cjs',
args: ['generate-sample', `\${input:${workflowName}Sample}`, '--global'],
console: 'integratedTerminal',
Expand Down
11 changes: 0 additions & 11 deletions .eslintignore

This file was deleted.

105 changes: 0 additions & 105 deletions .eslintrc.json

This file was deleted.

5 changes: 3 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ updates:
- dependency-name: '@types/node'
versions: ['>=19']
groups:
typescript-eslint:
eslint:
patterns:
- '@typescript-eslint/*'
- '@eslint/*'
- 'eslint'

- package-ecosystem: 'npm'
directory: '/generators/generate-blueprint/resources/'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-image-publish-github-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
images: ghcr.io/${{ github.repository }}${{ (steps.login-hub.outcome == 'success' && ',jhipster/jhipster') || ''}}

- name: Build and push Docker image
uses: docker/build-push-action@v6.5.0
uses: docker/build-push-action@v6.6.0
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
1 change: 1 addition & 0 deletions .mocharc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const Module = require('module');
const process = require('process');

if (!Module.register) {
// eslint-disable-next-line no-console
console.log('JHipster test requires node >=18.19.0 || >= 20.6.0\n');
process.exit(1);
}
Expand Down
1 change: 0 additions & 1 deletion bin/jhipster.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const [_nodeExec, _exec, ...args] = process.argv;
console.error('jhipster', ...args);

(async () => {
// eslint-disable-next-line import/no-unresolved
const { default: esbuildx } = await import('@node-loaders/esbuildx');
await esbuildx(join(__dirname, 'cli.cjs'));
})();
6 changes: 1 addition & 5 deletions cli/environment-builder.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,6 @@ export default class EnvironmentBuilder {
}
let result;
for (const [blueprint, packagePath] of blueprintPackagePaths) {
/* eslint-disable import/no-dynamic-require */
/* eslint-disable global-require */
let blueprintCommand;
const blueprintCommandFile = `${packagePath}/cli/commands`;
const blueprintCommandExtension = ['.js', '.cjs', '.mjs'].find(extension => existsSync(`${blueprintCommandFile}${extension}`));
Expand All @@ -418,7 +416,7 @@ export default class EnvironmentBuilder {
commandSpec.blueprint = commandSpec.blueprint || blueprint;
});
result = { ...result, ...blueprintCommands };
} catch (e) {
} catch {
const msg = `Error parsing custom commands found within blueprint: ${blueprint} at ${blueprintCommandsUrl}`;
/* eslint-disable no-console */
console.info(`${chalk.green.bold('INFO!')} ${msg}`);
Expand Down Expand Up @@ -456,8 +454,6 @@ export default class EnvironmentBuilder {
}

async function loadSharedOptionsFromFile(sharedOptionsBase, msg, errorMsg) {
/* eslint-disable import/no-dynamic-require */
/* eslint-disable global-require */
try {
const baseExtension = ['.js', '.cjs', '.mjs'].find(extension => existsSync(resolve(`${sharedOptionsBase}${extension}`)));
if (baseExtension) {
Expand Down
5 changes: 1 addition & 4 deletions cli/program.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable global-require */
/* eslint-disable import/no-dynamic-require */
/**
* Copyright 2013-2024 the original author or authors from the JHipster project.
*
Expand Down Expand Up @@ -334,15 +332,14 @@ export const buildJHipster = async ({
printBlueprintLogo,
devBlueprintPath,
env,
/* eslint-disable-next-line global-require, import/no-dynamic-require */

loadCommand = async key => {
const { default: command } = await import(`./${key}.mjs`);
return command;
},
defaultCommand,
entrypointGenerator,
} = {}) => {
// eslint-disable-next-line chai-friendly/no-unused-expressions
createEnvBuilder =
createEnvBuilder ?? (async options => EnvironmentBuilder.create(options).prepare({ blueprints, lookups, devBlueprintPath }));
envBuilder = envBuilder ?? (await createEnvBuilder());
Expand Down
2 changes: 1 addition & 1 deletion cli/utils.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.
*/
/* eslint-disable no-console */

import chalk from 'chalk';

import { createJHipsterLogger, CLI_LOGGER } from '../generators/base/support/index.js';
Expand Down
115 changes: 115 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import globals from 'globals';
import js from '@eslint/js';
import ts from 'typescript-eslint';
import prettier from 'eslint-plugin-prettier/recommended';
import chai from 'eslint-plugin-chai-friendly';
import importRecommented from 'eslint-plugin-import/config/recommended.js';
import jhipster from './lib/eslint/index.js';

export default ts.config(
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.node,
},
},
},
{ ignores: ['dist'] },
js.configs.recommended,
jhipster.base,
{
files: ['**/*.ts'],
extends: [...ts.configs.recommended, ...ts.configs.stylistic],
languageOptions: {
parserOptions: {
project: ['./tsconfig.spec.json', './tsconfig.eslint.json'],
},
},
rules: {
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/prefer-for-of': 'off',
'@typescript-eslint/no-this-alias': 'off',
},
},
{
files: ['**/*.spec.{js,ts}'],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
},
},
{
languageOptions: {
// import plugin does not use ecmaVersion and sourceType from languageOptions object
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
},
settings: {
'import/parsers': {
espree: ['.js', '.cjs', '.mjs'],
'@typescript-eslint/parser': ['.ts'],
},
'import/resolver': {
node: true,
typescript: true,
},
},
rules: {
...importRecommented.rules,
'import/no-named-as-default-member': 'off',
'import/named': 'off',
'import/extensions': [0, { pattern: { '{c,m,}{js,ts}': 'always' } }],
'import/prefer-default-export': 'off',
'import/namespace': 'off',
},
},
{
files: ['bin/**/*', '**/*.spec.ts', 'testing/**/*', 'test/**/*'],
rules: {
'import/no-unresolved': 'off',
},
},
{
rules: {
'eol-last': 'error',
quotes: ['error', 'single', { avoidEscape: true }],
semi: ['error', 'always'],
eqeqeq: ['error', 'smart'],
'no-use-before-define': ['error', 'nofunc'],
'no-multi-str': 'error',
'no-irregular-whitespace': 'error',
'no-console': 'error',
'no-template-curly-in-string': 'error',
'no-nested-ternary': 'error',
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
'no-restricted-syntax': [
'error',
{
selector: 'ForInStatement',
message:
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
{
selector: 'LabeledStatement',
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
},
{
selector: 'WithStatement',
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
},
],
},
},
{
...chai.configs.recommendedFlat,
files: ['jdl/**/*.spec.{js,ts}'],
},
prettier,
);
Loading

0 comments on commit 60b320f

Please sign in to comment.