Skip to content

Commit

Permalink
refactor: update prettier to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
sheikalthaf committed Jun 24, 2024
1 parent abdbfe5 commit cdbf431
Show file tree
Hide file tree
Showing 16 changed files with 143 additions and 356 deletions.
4 changes: 3 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
"useTabs": false,
"tabWidth": 2,
"semi": true,
"bracketSpacing": true
"bracketSpacing": true,
"arrowParens": "avoid",
"trailingComma": "none"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"lint-staged": "^8.1.0",
"markdown-it": "^12.2.0",
"nodemon": "^1.18.7",
"prettier": "^1.15.2",
"prettier": "^3.3.1",
"shorthash": "^0.0.2",
"ts-loader": "^5.3.1",
"ts-node": "~8.3.0",
Expand Down
4 changes: 1 addition & 3 deletions src/app/checklist/checklist.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ export class ChecklistComponent {
}
});

return dialogRef.afterClosed().pipe(
tap<boolean>(result => this.processDialogResult(result, favorites))
);
return dialogRef.afterClosed().pipe(tap<boolean>(result => this.processDialogResult(result, favorites)));
}

private processDialogResult(result: boolean, favorites: Array<ChecklistItem>) {
Expand Down
5 changes: 3 additions & 2 deletions src/app/checklist/project-exists.guard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import { ActivatedRouteSnapshot, Router } from '@angular/router';
import { select, Store } from '@ngrx/store';
import { of } from 'rxjs';
Expand All @@ -11,7 +11,8 @@ import { ApplicationState } from '../state/app.state';
providedIn: 'root'
})
export class ProjectExistsGuard {
constructor(private store: Store<ApplicationState>, private router: Router) {}
private store = inject<Store<ApplicationState>>(Store);
private router = inject(Router);

canActivate(snapshot: ActivatedRouteSnapshot) {
const projectId = snapshot.params.project;
Expand Down
6 changes: 4 additions & 2 deletions src/app/checklist/search/search.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Injectable } from '@angular/core';
import { inject, Injectable } from '@angular/core';
import { ActionsSubject, select, Store } from '@ngrx/store';
import * as fuzzysort from 'fuzzysort';
import { merge, of, zip } from 'rxjs';
Expand All @@ -13,6 +13,8 @@ import { IndexEntry } from './search.models';

@Injectable()
export class SearchService {
private store = inject<Store<ApplicationState>>(Store);
private actions = inject(ActionsSubject);
private index: Array<IndexEntry<ChecklistItem | CategoryEntity>>;

private options: Fuzzysort.KeyOptions = {
Expand All @@ -22,7 +24,7 @@ export class SearchService {
threshold: -10000
};

constructor(private store: Store<ApplicationState>, private actions: ActionsSubject) {
constructor() {
const actions$ = this.actions.pipe(filter(action => action.type === ProjectsActionTypes.TOGGLE_CATEGORY));

merge(actions$, of('INIT INDEX'))
Expand Down
33 changes: 14 additions & 19 deletions src/app/checklist/state/checklist.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,23 @@ export namespace ChecklistSelectors {
ProjectsSelectors.getDisabledCategories,
getScores,
(categories, items, disabledCategories, scores): Array<Category> => {
return Object.keys(categories).map(
(categoryId): Category => {
const category = categories[categoryId];
const categoryItems = category.items.map(itemId => items[itemId]);

return {
...category,
score: scores[categoryId],
enabled: !disabledCategories[category.slug],
items: categoryItems
};
}
);
return Object.keys(categories).map((categoryId): Category => {
const category = categories[categoryId];
const categoryItems = category.items.map(itemId => items[itemId]);

return {
...category,
score: scores[categoryId],
enabled: !disabledCategories[category.slug],
items: categoryItems
};
});
}
);

export const getActiveCategories = createSelector(
getAllCategories,
(categories): Array<Category> => {
return categories.filter(category => category.enabled);
}
);
export const getActiveCategories = createSelector(getAllCategories, (categories): Array<Category> => {
return categories.filter(category => category.enabled);
});

export const getSelectedCategory = createSelector(
AppSelectors.getRouterState,
Expand Down
8 changes: 2 additions & 6 deletions src/app/shared/dropdown/dropdown-static-options.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@ import { Component } from '@angular/core';
@Component({
standalone: true,
selector: 'ac-dropdown-static-options',
template: `
<ng-content></ng-content>
`,
template: ` <ng-content></ng-content> `,
styleUrls: ['./dropdown-static-options.component.scss']
})
export class DropdownStaticOptionsComponent {}

@Component({
standalone: true,
selector: 'ac-dropdown-static-option',
template: `
<ng-content></ng-content>
`,
template: ` <ng-content></ng-content> `,
styleUrls: ['./dropdown-static-option.component.scss']
})
export class DropdownStaticOptionComponent {}
4 changes: 3 additions & 1 deletion src/app/shared/dropdown/dropdown.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
border-radius: 8px;
margin: 5px 0 0 0;
max-height: 268px !important;
box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 2px 6px 2px rgba(60, 64, 67, 0.15) !important;
box-shadow:
0 1px 2px 0 rgba(60, 64, 67, 0.3),
0 2px 6px 2px rgba(60, 64, 67, 0.15) !important;

.mat-mdc-selected:not(.mat-mdc-option-multiple) {
background: mat.get-color-from-palette(theme.$app-primary, lighter, 0.3) !important;
Expand Down
9 changes: 5 additions & 4 deletions src/app/shared/score-chart/score-chart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
OnChanges,
SimpleChanges,
HostBinding,
Inject,
PLATFORM_ID
PLATFORM_ID,
inject
} from '@angular/core';

@Component({
Expand All @@ -19,14 +19,15 @@ import {
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ScoreChartComponent implements OnChanges {
private elementRef = inject(ElementRef);
@Input() score: number;

@HostBinding('class.done') done = false;

isBrowser = true;

constructor(private elementRef: ElementRef, @Inject(PLATFORM_ID) platformId: string) {
this.isBrowser = isPlatformBrowser(platformId);
constructor() {
this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
}

ngOnChanges(changes: SimpleChanges) {
Expand Down
5 changes: 1 addition & 4 deletions src/app/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@ export const hasEntities = (entityState: EntityState<any>) => {
};

export const convertToProjectId = (projectName: string) => {
return projectName
.toLowerCase()
.replace(/\s+/g, '-')
.trim();
return projectName.toLowerCase().replace(/\s+/g, '-').trim();
};
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
16 changes: 9 additions & 7 deletions src/scss/custom-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,23 @@ $custom-green: (
A100: black,
A200: black,
A400: black,
A700: black,
A700: black
)
);

$app-primary: mat.define-palette(mat.$deep-purple-palette);
$app-accent: mat.define-palette($custom-green, 600);
$app-warn: mat.define-palette(mat.$red-palette);

$app-theme: mat.define-light-theme((
color: (
primary: $app-primary,
accent: $app-accent,
warn: $app-warn,
$app-theme: mat.define-light-theme(
(
color: (
primary: $app-primary,
accent: $app-accent,
warn: $app-warn
)
)
));
);

$primary: mat.get-theme-color($app-theme, primary);
$accent: mat.get-theme-color($app-theme, accent);
Expand Down
2 changes: 1 addition & 1 deletion src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body {

:root {
--warn-color: hsl(48 95% 85% / 1);
--warn-color-darker: hsl(48 95% 48% / 1)
--warn-color-darker: hsl(48 95% 48% / 1);
}

a {
Expand Down
2 changes: 1 addition & 1 deletion tools/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const markdown = new MarkdownIt({
});

const convertHeadings = state => {
state.tokens.forEach(function(token, i) {
state.tokens.forEach(function (token, i) {
if (token.type === 'heading_open' || token.type === 'heading_close') {
const rawToken = token.tag.split('');
rawToken[1] = parseInt(rawToken[1], 10) + 2;
Expand Down
2 changes: 1 addition & 1 deletion tools/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const buildChecklist = async contentFolder => {
};

export const extractFrontMatter = (filePath: string): FrontMatter => {
return (matter(readFileSync(filePath)) as unknown) as FrontMatter;
return matter(readFileSync(filePath)) as unknown as FrontMatter;
};

export const compileFilesForCategory = (files: Array<string>, category: string, categoryPath: string) => {
Expand Down
Loading

0 comments on commit cdbf431

Please sign in to comment.