-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEV-117 linter #18
DEV-117 linter #18
Changes from 19 commits
af3d1b9
6f8a71b
3b54425
fd76c09
e475d35
77f0788
a19a206
2169665
8550a9a
435a4bd
2f87b74
62bb0ab
2973719
f71dba2
9dea28b
21bdfdd
df57419
8a4d7bb
6a40d2a
ced5dd3
66680e4
1ad7140
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"root": true, | ||
"ignorePatterns": [ | ||
"projects/**/*" | ||
], | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"*.ts" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@angular-eslint/recommended", | ||
"plugin:@angular-eslint/template/process-inline-templates" | ||
], | ||
"rules": { | ||
"@typescript-eslint/no-explicit-any": ["off"], | ||
"@angular-eslint/directive-selector": [ | ||
"error", | ||
{ | ||
"type": "attribute", | ||
"prefix": "app", | ||
"style": "camelCase" | ||
} | ||
], | ||
"@angular-eslint/component-selector": [ | ||
"error", | ||
{ | ||
"type": "element", | ||
"prefix": "app", | ||
"style": "kebab-case" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": [ | ||
"*.html" | ||
], | ||
"extends": [ | ||
"plugin:@angular-eslint/template/recommended", | ||
"plugin:@angular-eslint/template/accessibility" | ||
], | ||
"rules": { | ||
"@angular-eslint/template/click-events-have-key-events": "off" | ||
} | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Tests | ||
on: [push] | ||
|
||
jobs: | ||
eslint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install modules | ||
run: npm install | ||
- name: Run ESLint | ||
run: ng.js lint |
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,4 +1,4 @@ | ||||||||||||||||||||||
import { Component, ElementRef, Inject, PLATFORM_ID, Renderer2, ViewChild } from '@angular/core'; | ||||||||||||||||||||||
import { Component, ElementRef, Inject, PLATFORM_ID, Renderer2, OnInit, ViewChild } from '@angular/core'; | ||||||||||||||||||||||
import { BreadcrumbSegment, BreadcrumbsComponent } from '../../components/breadcrumbs/breadcrumbs.component'; | ||||||||||||||||||||||
import { ActivatedRoute, RouterLink } from '@angular/router'; | ||||||||||||||||||||||
import { CommonModule, isPlatformBrowser } from '@angular/common'; | ||||||||||||||||||||||
|
@@ -17,7 +17,7 @@ import { Lightbox, LightboxModule } from 'ngx-lightbox'; | |||||||||||||||||||||
templateUrl: './article.component.html', | ||||||||||||||||||||||
styleUrl: './article.component.scss' | ||||||||||||||||||||||
}) | ||||||||||||||||||||||
export class ArticleComponent { | ||||||||||||||||||||||
export class ArticleComponent implements OnInit { | ||||||||||||||||||||||
|
||||||||||||||||||||||
@ViewChild('articleDiv') articleDiv!: ElementRef; | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
@@ -62,7 +62,7 @@ export class ArticleComponent { | |||||||||||||||||||||
|
||||||||||||||||||||||
if(isPlatformBrowser(this.platformId)) { | ||||||||||||||||||||||
// Wait for the articleDiv to be rendered | ||||||||||||||||||||||
let checkExist = setInterval(() => { | ||||||||||||||||||||||
const checkExist = setInterval(() => { | ||||||||||||||||||||||
if (this.articleDiv) { | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of - const checkExist = setInterval(() => {
- if (this.articleDiv) {
- this.renderer.listen(this.articleDiv.nativeElement, 'click', (event) => {
- if (event.target.tagName === 'IMG' && event.target.classList[0] == 'zoomin') {
- this.openLightbox(event.target.src);
- }
- });
- clearInterval(checkExist);
- }
- }, 100);
+ @ViewChild('articleDiv', { static: false }) set content(content: ElementRef) {
+ if(content) {
+ this.renderer.listen(content.nativeElement, 'click', (event) => {
+ if (event.target.tagName === 'IMG' && event.target.classList.contains('zoomin')) {
+ this.openLightbox(event.target.src);
+ }
+ });
+ }
+ } Committable suggestion
Suggested change
|
||||||||||||||||||||||
this.renderer.listen(this.articleDiv.nativeElement, 'click', (event) => { | ||||||||||||||||||||||
if (event.target.tagName === 'IMG' && event.target.classList[0] == 'zoomin') { | ||||||||||||||||||||||
|
@@ -82,7 +82,7 @@ export class ArticleComponent { | |||||||||||||||||||||
const lines = str.split('\n'); | ||||||||||||||||||||||
const result: any = {}; | ||||||||||||||||||||||
|
||||||||||||||||||||||
for (let line of lines) { | ||||||||||||||||||||||
for (const line of lines) { | ||||||||||||||||||||||
const [key, ...valueParts] = line.split(':'); | ||||||||||||||||||||||
const value = valueParts.join(':').trim(); | ||||||||||||||||||||||
if(key?.length > 0 && value?.length > 0) { | ||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,4 +1,4 @@ | ||||||
import { Component } from '@angular/core'; | ||||||
import { Component, OnInit } from '@angular/core'; | ||||||
import { ArticleMeta, ArticlesService } from '../../services/articles.service'; | ||||||
import { BreadcrumbSegment, BreadcrumbsComponent } from '../../components/breadcrumbs/breadcrumbs.component'; | ||||||
import { CommonModule } from '@angular/common'; | ||||||
|
@@ -13,7 +13,7 @@ import { ArticleCardComponent } from '../../components/article-card/article-card | |||||
templateUrl: './articles.component.html', | ||||||
styleUrl: './articles.component.scss' | ||||||
}) | ||||||
export class ArticlesComponent { | ||||||
export class ArticlesComponent implements OnInit { | ||||||
|
||||||
breadcrumbs: BreadcrumbSegment[] = [ | ||||||
{ name: 'Home', url: '/' }, | ||||||
|
@@ -29,7 +29,7 @@ export class ArticlesComponent { | |||||
|
||||||
ngOnInit() { | ||||||
this.route.queryParams.subscribe(params => { | ||||||
let category = params['tag']; | ||||||
const category = params['tag']; | ||||||
this.articles.getArticlesByType(category).then(articles => { | ||||||
this.featuredArticles = articles; | ||||||
}); | ||||||
|
@@ -40,7 +40,7 @@ export class ArticlesComponent { | |||||
|
||||||
]; | ||||||
|
||||||
let title = category ? category.charAt(0).toUpperCase() + category.slice(1) : ''; | ||||||
const title = category ? category.charAt(0).toUpperCase() + category.slice(1) : ''; | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use template literals consistently for better readability and to avoid errors. - const title = category ? category.charAt(0).toUpperCase() + category.slice(1) : '';
+ const title = category ? `${category.charAt(0).toUpperCase()}${category.slice(1)}` : ''; Committable suggestion
Suggested change
|
||||||
if(category) { | ||||||
this.breadcrumbs.push( | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using
const
instead oflet
forelement
since it is not reassigned.Committable suggestion