Skip to content

Commit

Permalink
Merge pull request jhipster#26758 from mshima/eslint-docker
Browse files Browse the repository at this point in the history
ignore js files in docker folder.
  • Loading branch information
DanielFran authored Jul 18, 2024
2 parents 4a575b8 + ba41309 commit 67913b6
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 12 deletions.
6 changes: 6 additions & 0 deletions generators/docker/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ const renameTo = (ctx, filepath) => `${ctx.dockerServicesDir}${filepath}`.replac

// eslint-disable-next-line import/prefer-default-export
export const dockerFiles = {
commonFiles: [
{
condition: ctx => ctx.eslintConfigFile,
templates: [{ sourceFile: 'eslint.config.js.jhi.docker', destinationFile: ctx => `${ctx.eslintConfigFile}.jhi.docker` }],
},
],
sqlDatabasesFiles: [
{
condition: ctx => ctx.dockerServices.some(service => ['postgresql', 'mariadb', 'mysql', 'mssql'].includes(service)),
Expand Down
21 changes: 21 additions & 0 deletions generators/docker/templates/eslint.config.js.jhi.docker.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<%#
Copyright 2013-2024 the original author or authors from the JHipster project.
This file is part of the JHipster project, see https://www.jhipster.tech/
for more information.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-%>
<&_ if (fragment.configSection) { -&>
{ files: ['**/*.js'], ignores: ['<%- dockerServicesDir %>'] },
<&_ } -&>
1 change: 1 addition & 0 deletions generators/javascript/generators/eslint/support/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './tasks.js';
32 changes: 32 additions & 0 deletions generators/javascript/generators/eslint/support/tasks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright 2013-2024 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { asWritingTask } from '../../../../base-application/support/task-type-inference.js';
import { clientRootTemplatesBlock } from '../../../../client/support/files.js';

export const writeEslintClientRootConfigFile = asWritingTask(async function writingEslintFile({ application }) {
await this.writeFiles({
blocks: [
clientRootTemplatesBlock({
templates: [{ sourceFile: 'eslint.config.js.jhi', destinationFile: ctx => `${ctx.eslintConfigFile}.jhi` }],
}),
],
context: application,
rootTemplatesPath: this.fetchFromInstalledJHipster('javascript/generators/eslint/templates'),
});
});
14 changes: 2 additions & 12 deletions generators/react/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import {
generateEntityClientImports as formatEntityClientImports,
generateTestEntityId as getTestEntityId,
generateTestEntityPrimaryKey as getTestEntityPrimaryKey,
clientRootTemplatesBlock,
} from '../client/support/index.js';
import { createNeedleCallback, upperFirstCamelCase } from '../base/support/index.js';
import { writeEslintClientRootConfigFile } from '../javascript/generators/eslint/support/tasks.js';
import { writeEntitiesFiles, postWriteEntitiesFiles, cleanupEntitiesFiles } from './entity-files-react.js';
import cleanupOldFilesTask from './cleanup.js';
import { writeFiles } from './files-react.js';
Expand Down Expand Up @@ -159,17 +159,7 @@ export default class ReactGenerator extends BaseApplicationGenerator {
});
},
cleanupOldFilesTask,
async writingEslintFile({ application }) {
await this.writeFiles({
blocks: [
clientRootTemplatesBlock({
templates: [{ sourceFile: 'eslint.config.js.jhi', destinationFile: ctx => `${ctx.eslintConfigFile}.jhi` }],
}),
],
context: application,
rootTemplatesPath: this.fetchFromInstalledJHipster('javascript/generators/eslint/templates'),
});
},
writeEslintClientRootConfigFile,
writeFiles,
});
}
Expand Down

0 comments on commit 67913b6

Please sign in to comment.