🔧 Add ESLint rules

merge-requests/7/head
Nato Boram 2022-03-10 21:44:37 -05:00
parent 6f12da98eb
commit 9c3d5d82ed
No known key found for this signature in database
GPG Key ID: 478E3C64BF88AFFA
11 changed files with 52 additions and 19 deletions

View File

@ -16,7 +16,7 @@
"createDefaultProgram": true "createDefaultProgram": true
}, },
"extends": [ "extends": [
"plugin:@angular-eslint/recommended", "plugin:@angular-eslint/all",
"plugin:@angular-eslint/template/process-inline-templates" "plugin:@angular-eslint/template/process-inline-templates"
], ],
"rules": { "rules": {
@ -36,6 +36,7 @@
"style": "kebab-case" "style": "kebab-case"
} }
] ]
// Custom rules
} }
}, },
{ {
@ -43,9 +44,12 @@
"*.html" "*.html"
], ],
"extends": [ "extends": [
"plugin:@angular-eslint/template/recommended" "plugin:@angular-eslint/template/all"
], ],
"rules": {} "rules": {
// Custom rules
"@angular-eslint/template/i18n": "off"
}
} }
] ]
} }

15
.vscode/settings.json vendored
View File

@ -1,12 +1,27 @@
{ {
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll": true, "source.fixAll": true,
"source.fixAll.eslint": true,
"source.organizeImports": true "source.organizeImports": true
}, },
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.rulers": [ "editor.rulers": [
140 140
], ],
"eslint.options": {
"extensions": [
".ts",
".html"
]
},
"eslint.packageManager": "yarn",
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"html"
],
"files.associations": { "files.associations": {
".ipfs-npmrc": "json" ".ipfs-npmrc": "json"
}, },

View File

@ -1,10 +1,11 @@
import { Component } from '@angular/core'; import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ThemeService } from './services/theme.service'; import { ThemeService } from './services/theme.service';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'] styleUrls: ['./app.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class AppComponent { export class AppComponent {
constructor( constructor(

View File

@ -15,14 +15,12 @@ import { AppComponent } from './app.component';
AppComponent AppComponent
], ],
imports: [ imports: [
CommonModule,
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
AppRoutingModule, AppRoutingModule,
BrowserAnimationsModule,
// Material BrowserModule,
CommonModule,
FlexLayoutModule, FlexLayoutModule,
HttpClientModule,
MatButtonModule, MatButtonModule,
MatIconModule, MatIconModule,
MatToolbarModule, MatToolbarModule,

View File

@ -1,5 +1,5 @@
import { HttpErrorResponse } from '@angular/common/http'; import { HttpErrorResponse } from '@angular/common/http';
import { Component, EventEmitter, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { ChangeDetectionStrategy, Component, EventEmitter, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { ThemePalette } from '@angular/material/core'; import { ThemePalette } from '@angular/material/core';
import { MatTable, MatTableDataSource } from '@angular/material/table'; import { MatTable, MatTableDataSource } from '@angular/material/table';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
@ -13,7 +13,8 @@ import { ThemeService } from '../services/theme.service';
@Component({ @Component({
selector: 'app-pages', selector: 'app-pages',
templateUrl: './pages.component.html', templateUrl: './pages.component.html',
styleUrls: ['./pages.component.scss'] styleUrls: ['./pages.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class PagesComponent implements OnInit, OnDestroy { export class PagesComponent implements OnInit, OnDestroy {

View File

@ -1,5 +1,5 @@
// Custom Theming for Angular Material // Custom Theming for Angular Material
@use '@angular/material' as mat; @use '@angular/material'as mat;
// For more information: https://material.angular.io/guide/theming // For more information: https://material.angular.io/guide/theming
// Plus imports for other components in your app. // Plus imports for other components in your app.

View File

@ -1,4 +1,4 @@
@use '@angular/material' as mat; @use '@angular/material'as mat;
@import 'ipfs-colours.scss'; @import 'ipfs-colours.scss';
$ipfs-primary: mat.define-palette($ipfs-colour-navy, 'default', 'lighter', 'darker'); $ipfs-primary: mat.define-palette($ipfs-colour-navy, 'default', 'lighter', 'darker');

View File

@ -1,4 +1,4 @@
@use '@angular/material' as mat; @use '@angular/material'as mat;
@import 'ipfs-palettes.scss'; @import 'ipfs-palettes.scss';
$ipfs-light-theme: mat.define-light-theme($ipfs-primary, $ipfs-accent, $ipfs-warn); $ipfs-light-theme: mat.define-light-theme($ipfs-primary, $ipfs-accent, $ipfs-warn);

View File

@ -1,11 +1,11 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files // This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing'; import { getTestBed } from '@angular/core/testing';
import { import {
BrowserDynamicTestingModule, BrowserDynamicTestingModule,
platformBrowserDynamicTesting platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing'; } from '@angular/platform-browser-dynamic/testing';
import 'zone.js/testing';
declare const require: any; declare const require: any;

View File

@ -6,8 +6,22 @@
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"strict": true, "strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"useUnknownInCatchVariables": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"exactOptionalPropertyTypes": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"sourceMap": true, "sourceMap": true,
"declaration": false, "declaration": false,
"downlevelIteration": true, "downlevelIteration": true,