Skip to content

Commit b061ce4

Browse files
committed
Fix lint errors and change default method for the prompter
1 parent 5d639bb commit b061ce4

File tree

12 files changed

+29
-12
lines changed

12 files changed

+29
-12
lines changed

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@types/inquirer-fuzzy-path": "2.3.9",
5050
"@types/jest": "29.5.14",
5151
"@types/node": "^22.15.3",
52+
"@types/prettier": "^2.7.3",
5253
"@typescript-eslint/eslint-plugin": "8.31.1",
5354
"@typescript-eslint/parser": "8.31.1",
5455
"eslint": "8.57.0",

src/ng-generate/components/card/schema.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313

1414
import {Values} from '../shared/schema';
1515

16+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
17+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
1618
export interface CardSchema extends Values {}
1719

20+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
21+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
1822
export interface ConfigurationDefaultsSchema {}
1923

2024
// class to define default values that are not asked in the prompter

src/ng-generate/components/shared/generators/styles/general/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ import {strings} from '@angular-devkit/core';
1717
export function generateGeneralStyle(options: any): Rule {
1818
return (tree: Tree, _context: SchematicContext) => {
1919
const globalStylePath = 'src/styles.scss';
20-
tree.exists(globalStylePath)
21-
? tree.overwrite(globalStylePath, contentForGlobalStyles())
22-
: tree.create(globalStylePath, contentForGlobalStyles());
20+
21+
if(tree.exists(globalStylePath)) {
22+
tree.overwrite(globalStylePath, contentForGlobalStyles())
23+
} else {
24+
tree.create(globalStylePath, contentForGlobalStyles());
25+
}
2326

2427
const scssPath = 'src/assets/scss/general.component.scss';
2528

src/ng-generate/components/table/generators/components/table/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ function getCustomColumnsInput(): string {
111111

112112
function getCustomColumn(): string {
113113
return `${sharedOptions.customColumns
114-
.map((value: string) => {
115-
`'${value.trim()}'`;
116-
})
114+
.map((value: string) => `'${value.trim()}'`)
117115
.join(', ')}`;
118116
}
119117

src/ng-generate/components/table/schema.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export interface TableSchema extends Values {
1919
customColumns: Array<string>;
2020
}
2121

22+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
23+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
2224
export interface ConfigurationDefaultsSchema {}
2325

2426
// class to define default values that are not asked in the prompter

src/ng-generate/prompter/card/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {Tree} from '@angular-devkit/schematics/src/tree/interface';
1717
import {Observable, Subscriber} from 'rxjs';
1818
import {generate} from '../index';
1919

20-
export default function (options: CardSchema): Rule {
20+
export default function (options: CardSchema) {
2121
return (tree: Tree, context: SchematicContext) => {
2222
return new Observable<Tree>((subscriber: Subscriber<Tree>) => {
2323
generate(subscriber, tree, options, 'card');

src/ng-generate/prompter/form/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {Tree} from '@angular-devkit/schematics/src/tree/interface';
1717
import {Observable, Subscriber} from 'rxjs';
1818
import {generate} from '../index';
1919

20-
export default function (options: FormSchema): Rule {
20+
export default function (options: FormSchema) {
2121
return (tree: Tree, context: SchematicContext) => {
2222
return new Observable<Tree>((subscriber: Subscriber<Tree>) => {
2323
generate(subscriber, tree, options, 'form');

src/ng-generate/prompter/table/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {Tree} from '@angular-devkit/schematics/src/tree/interface';
1717
import {Observable, Subscriber} from 'rxjs';
1818
import {generate} from '../index';
1919

20-
export default function (options: TableSchema): Rule {
20+
export default function (options: TableSchema) {
2121
return (tree: Tree, context: SchematicContext) => {
2222
return new Observable<Tree>((subscriber: Subscriber<Tree>) => {
2323
generate(subscriber, tree, options, 'table');

src/ng-generate/prompter/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {Observable, Subscriber} from 'rxjs';
1717
import {generate} from '../index';
1818
import {TypesSchema} from '../../types/schema';
1919

20-
export default function (options: TypesSchema): Rule {
20+
export default function (options: TypesSchema) {
2121
return (tree: Tree, context: SchematicContext) => {
2222
return new Observable<Tree>((subscriber: Subscriber<Tree>) => {
2323
generate(subscriber, tree, options, 'types');

0 commit comments

Comments
 (0)