Skip to content

Commit

Permalink
add linters
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitalpopov committed Aug 25, 2022
1 parent 8f2bee6 commit 2f202e1
Show file tree
Hide file tree
Showing 21 changed files with 1,954 additions and 376 deletions.
19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"standard",
"eslint-config-prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 13,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {}
};
9 changes: 9 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": [
"stylelint-config-standard-scss",
"stylelint-config-prettier"
],
"rules": {
"scss/at-import-partial-extension": "always"
}
}
4 changes: 2 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css",
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"scripts": []
Expand Down Expand Up @@ -103,7 +103,7 @@
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css",
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"scripts": []
Expand Down
2,007 changes: 1,768 additions & 239 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
"test": "ng test",
"lint": "npm run lint:styles && npm run lint:code",
"lint:styles": "npx stylelint \"src/**/*.scss\" --fix",
"lint:code": "npx prettier --write \"src/**/*.ts\""
},
"private": false,
"dependencies": {
Expand All @@ -25,6 +28,8 @@
"@fortawesome/free-brands-svg-icons": "^6.1.2",
"@fortawesome/free-regular-svg-icons": "^6.1.2",
"@fortawesome/free-solid-svg-icons": "^6.1.2",
"@typescript-eslint/eslint-plugin": "^5.35.1",
"@typescript-eslint/parser": "^5.35.1",
"d3": "^7.6.1",
"rxjs": "^7.5.6",
"topojson-client": "^3.1.0",
Expand All @@ -39,12 +44,23 @@
"@types/jasmine": "~3.8.0",
"@types/node": "^12.11.1",
"@types/topojson-client": "^3.1.0",
"eslint": "^8.22.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.1",
"jasmine-core": "~3.8.0",
"karma": "^6.3.20",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"prettier": "^2.7.1",
"stylelint": "^14.11.0",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-standard": "^28.0.0",
"stylelint-config-standard-scss": "^5.0.0",
"typescript": "~4.7.4"
}
}
9 changes: 9 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
printWidth: 120,
tabWidth: 2,
useTabs: false,
semi: false,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: true,
}
20 changes: 10 additions & 10 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { NgModule } from '@angular/core';
import { ExtraOptions, RouterModule, Routes } from '@angular/router';
import { AboutComponent } from './components/about/about.component';
import { MapComponent } from './components/map/map.component';
import { NgModule } from '@angular/core'
import { ExtraOptions, RouterModule, Routes } from '@angular/router'
import { AboutComponent } from './components/about/about.component'
import { MapComponent } from './components/map/map.component'

const routes: Routes = [
{ path: 'about', component: AboutComponent },
{ path: '', component: MapComponent },
{ path: '*', redirectTo: '', pathMatch: 'prefix' }
];
{ path: '*', redirectTo: '', pathMatch: 'prefix' },
]

const routerOptions: ExtraOptions = {
useHash: false,
anchorScrolling: 'enabled'
};
anchorScrolling: 'enabled',
}

@NgModule({
imports: [RouterModule.forRoot(routes, routerOptions)],
exports: [RouterModule]
exports: [RouterModule],
})
export class AppRoutingModule { }
export class AppRoutingModule {}
46 changes: 21 additions & 25 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
import { TestBed } from '@angular/core/testing'
import { RouterTestingModule } from '@angular/router/testing'
import { AppComponent } from './app.component'

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
});
imports: [RouterTestingModule],
declarations: [AppComponent],
}).compileComponents()
})

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
const fixture = TestBed.createComponent(AppComponent)
const app = fixture.componentInstance
expect(app).toBeTruthy()
})

it(`should have as title 'been-there'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('been-there');
});
const fixture = TestBed.createComponent(AppComponent)
const app = fixture.componentInstance
expect(app.title).toEqual('been-there')
})

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('been-there app is running!');
});
});
const fixture = TestBed.createComponent(AppComponent)
fixture.detectChanges()
const compiled = fixture.nativeElement as HTMLElement
expect(compiled.querySelector('.content span')?.textContent).toContain('been-there app is running!')
})
})
6 changes: 3 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Component } from '@angular/core';
import { Component } from '@angular/core'

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
title = 'been-there';
title = 'been-there'
}
29 changes: 14 additions & 15 deletions src/app/components/about/about.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing'

import { AboutComponent } from './about.component';
import { AboutComponent } from './about.component'

describe('AboutComponent', () => {
let component: AboutComponent;
let fixture: ComponentFixture<AboutComponent>;
let component: AboutComponent
let fixture: ComponentFixture<AboutComponent>

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AboutComponent ]
})
.compileComponents();
});
declarations: [AboutComponent],
}).compileComponents()
})

beforeEach(() => {
fixture = TestBed.createComponent(AboutComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
fixture = TestBed.createComponent(AboutComponent)
component = fixture.componentInstance
fixture.detectChanges()
})

it('should create', () => {
expect(component).toBeTruthy();
});
});
expect(component).toBeTruthy()
})
})
11 changes: 4 additions & 7 deletions src/app/components/about/about.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit } from '@angular/core'

@Component({
selector: 'app-about',
templateUrl: './about.component.html',
styleUrls: ['./about.component.scss']
styleUrls: ['./about.component.scss'],
})
export class AboutComponent implements OnInit {
constructor() {}

constructor() { }

ngOnInit(): void {
}

ngOnInit(): void {}
}
29 changes: 14 additions & 15 deletions src/app/components/header/header.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing'

import { HeaderComponent } from './header.component';
import { HeaderComponent } from './header.component'

describe('HeaderComponent', () => {
let component: HeaderComponent;
let fixture: ComponentFixture<HeaderComponent>;
let component: HeaderComponent
let fixture: ComponentFixture<HeaderComponent>

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ HeaderComponent ]
})
.compileComponents();
});
declarations: [HeaderComponent],
}).compileComponents()
})

beforeEach(() => {
fixture = TestBed.createComponent(HeaderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
fixture = TestBed.createComponent(HeaderComponent)
component = fixture.componentInstance
fixture.detectChanges()
})

it('should create', () => {
expect(component).toBeTruthy();
});
});
expect(component).toBeTruthy()
})
})
8 changes: 4 additions & 4 deletions src/app/components/header/header.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Component } from '@angular/core';
import { faGithub } from '@fortawesome/free-brands-svg-icons';
import { Component } from '@angular/core'
import { faGithub } from '@fortawesome/free-brands-svg-icons'

@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss']
styleUrls: ['./header.component.scss'],
})
export class HeaderComponent {
faGithub = faGithub;
faGithub = faGithub
}
10 changes: 5 additions & 5 deletions src/app/directives/anchor.directive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AnchorDirective } from './anchor.directive';
import { AnchorDirective } from './anchor.directive'

describe('AnchorDirective', () => {
it('should create an instance', () => {
const directive = new AnchorDirective();
expect(directive).toBeTruthy();
});
});
const directive = new AnchorDirective()
expect(directive).toBeTruthy()
})
})
Loading

0 comments on commit 2f202e1

Please sign in to comment.