Skip to content

Commit

Permalink
build: setup eslint (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt authored Mar 25, 2022
1 parent b18f85e commit 7f5b036
Show file tree
Hide file tree
Showing 27 changed files with 10,532 additions and 14,795 deletions.
4 changes: 3 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ jobs:
- checkout
- restore_cache:
key: ngx-gantt-{{ .Branch }}-{{ checksum "package-lock.json" }}
- run: npm install
- run: npm ci
- save_cache:
key: ngx-gantt-{{ .Branch }}-{{ checksum "package-lock.json" }}
paths:
- 'node_modules'
- run: npm run lint -- --quiet
- run: npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
- run: npm run report-coverage
- run: npm run build
40 changes: 40 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"parser": "@typescript-eslint/parser",
"plugins": ["rxjs"],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json"
],
"createDefaultProgram": true,
"warnOnUnsupportedTypeScriptVersion": false
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"rxjs/no-unsafe-takeuntil": "error",
"rxjs/no-subject-unsubscribe": "error",
"rxjs/no-unsafe-subject-next": "error"
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {}
}
]
}
17 changes: 8 additions & 9 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"packages/gantt/tsconfig.lib.json",
"packages/gantt/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
"lintFilePatterns": [
"packages/gantt/**/*.ts",
"packages/gantt/**/*.html"
]
}
}
Expand Down Expand Up @@ -76,7 +73,8 @@
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
"namedChunks": true,
"allowedCommonJsDependencies": ["docsearch.js"]
},
"configurations": {
"production": {
Expand Down Expand Up @@ -131,6 +129,7 @@
},
"defaultProject": "example",
"cli": {
"analytics": "7595d21d-c10d-4b06-8050-b8e56319939c"
"analytics": "7595d21d-c10d-4b06-8050-b8e56319939c",
"defaultCollection": "@angular-eslint/schematics"
}
}
31 changes: 6 additions & 25 deletions example/src/app/gantt-advanced/component/flat.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import {
Component,
OnInit,
HostBinding,
OnChanges,
OnDestroy,
SimpleChanges,
NgZone,
ChangeDetectorRef,
ElementRef,
Inject
} from '@angular/core';
import { Component, OnInit, HostBinding, NgZone, ChangeDetectorRef, ElementRef, Inject } from '@angular/core';
import { GANTT_UPPER_TOKEN, GanttUpper, GanttItemInternal, GanttGroupInternal, GANTT_GLOBAL_CONFIG, GanttGlobalConfig } from 'ngx-gantt';
import { startWith, takeUntil } from 'rxjs/operators';

Expand All @@ -24,10 +13,10 @@ import { startWith, takeUntil } from 'rxjs/operators';
}
]
})
export class AppGanttFlatComponent extends GanttUpper implements OnInit, OnChanges, OnDestroy {
export class AppGanttFlatComponent extends GanttUpper implements OnInit {
mergeIntervalDays = 3;

groups: GanttGroupInternal[] = [];
override groups: GanttGroupInternal[] = [];

@HostBinding('class.gantt-flat') ganttFlatClass = true;

Expand Down Expand Up @@ -62,9 +51,9 @@ export class AppGanttFlatComponent extends GanttUpper implements OnInit, OnChang
return mergedItems;
}

ngOnInit() {
super.onInit();
this.dragEnded.pipe(startWith(null), takeUntil(this.unsubscribe$)).subscribe(() => {
override ngOnInit() {
super.ngOnInit();
this.dragEnded.pipe(startWith<null, null>(null), takeUntil(this.unsubscribe$)).subscribe(() => {
this.buildGroupItems();
});
}
Expand All @@ -77,12 +66,4 @@ export class AppGanttFlatComponent extends GanttUpper implements OnInit, OnChang
group.mergedItems = group.mergedItems.length === 0 ? [[]] : group.mergedItems;
});
}

ngOnChanges(changes: SimpleChanges) {
super.onChanges(changes);
}

ngOnDestroy() {
super.onDestroy();
}
}
2 changes: 1 addition & 1 deletion example/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/app",
"noImplicitOverride": false,
"types": []
},
"files": [
Expand Down
Loading

0 comments on commit 7f5b036

Please sign in to comment.