Skip to content

Commit

Permalink
ci: add eslint (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Dec 6, 2023
1 parent 9d8a289 commit bc7bdda
Show file tree
Hide file tree
Showing 378 changed files with 5,240 additions and 3,603 deletions.
15 changes: 0 additions & 15 deletions .browserslistrc

This file was deleted.

32 changes: 0 additions & 32 deletions .eslintrc.js

This file was deleted.

27 changes: 13 additions & 14 deletions apps/demo/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import 'zone.js/node';
import {APP_BASE_HREF} from '@angular/common';
import {provideLocation, provideUserAgent} from '@ng-web-apis/universal';
import {ngExpressEngine} from '@nguniversal/express-engine';
import express from 'express';
import {Express} from 'express';
import express, {Express} from 'express';
import {existsSync} from 'fs';
import {join} from 'path';

Expand All @@ -14,34 +13,34 @@ import {AppServerModule} from './src/main.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): Express {
const server = express();
const distFolder = join(process.cwd(), 'dist/demo');
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
? 'index.original.html'
: 'index';
const distFolder = join(process.cwd(), `dist/demo`);
const indexHtml = existsSync(join(distFolder, `index.original.html`))
? `index.original.html`
: `index`;

// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
server.engine(
'html',
`html`,
ngExpressEngine({
bootstrap: AppServerModule,
}) as any,
);

server.set('view engine', 'html');
server.set('views', distFolder);
server.set(`view engine`, `html`);
server.set(`views`, distFolder);

// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get(
'*.*',
`*.*`,
express.static(distFolder, {
maxAge: '1y',
maxAge: `1y`,
}),
);

// All regular routes use the Universal engine
server.get('*', (req, res) => {
server.get(`*`, (req, res) => {
res.render(indexHtml, {
req,
providers: [
Expand Down Expand Up @@ -71,9 +70,9 @@ function run(): void {
// The below code is to ensure that the server is run only when not requiring the bundle.
declare const __non_webpack_require__: NodeRequire;
const mainModule = __non_webpack_require__.main;
const moduleFilename = mainModule?.filename || '';
const moduleFilename = mainModule?.filename || ``;

if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
if (moduleFilename === __filename || moduleFilename.includes(`iisnode`)) {
run();
}

Expand Down
11 changes: 6 additions & 5 deletions apps/demo/src/app/app.browser.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import {POSITION_OPTIONS} from '@ng-web-apis/geolocation';
import {TuiLinkModule, TuiRootModule, TuiSvgModule} from '@taiga-ui/core';
import {HIGHLIGHT_OPTIONS, HighlightModule} from 'ngx-highlightjs';
import {MarkdownModule} from 'ngx-markdown';

import {environment} from '../environments/environment';
import {AppComponent} from './app.component';
import {AppRoutingModule} from './app.routes';

@NgModule({
imports: [
BrowserModule.withServerTransition({
appId: 'demo',
appId: `demo`,
}),
BrowserAnimationsModule,
TuiRootModule,
Expand All @@ -25,19 +26,18 @@ import {AppRoutingModule} from './app.routes';
MarkdownModule.forRoot({
sanitize: SecurityContext.NONE,
}),
ServiceWorkerModule.register('ngsw-worker.js', {
ServiceWorkerModule.register(`ngsw-worker.js`, {
enabled: environment.production,
// Register the ServiceWorker as soon as the app is stable
// or after 30 seconds (whichever comes first).
registrationStrategy: 'registerWhenStable:30000',
registrationStrategy: `registerWhenStable:30000`,
}),
],
declarations: [AppComponent],
bootstrap: [AppComponent],
providers: [
{
provide: HIGHLIGHT_OPTIONS,
useValue: {fullLibraryLoader: () => import('highlight.js')},
useValue: {fullLibraryLoader: async () => import(`highlight.js`)},
},
{
provide: LocationStrategy,
Expand All @@ -48,5 +48,6 @@ import {AppRoutingModule} from './app.routes';
useValue: {enableHighAccuracy: true, timeout: 3000, maximumAge: 1000},
},
],
bootstrap: [AppComponent],
})
export class AppBrowserModule {}
10 changes: 5 additions & 5 deletions apps/demo/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,21 @@ export const appRoutes: Routes = [
.NotificationPageModule,
},
{
path: '',
path: ``,
redirectTo: DemoPath.HomePage,
pathMatch: 'full',
pathMatch: `full`,
},
{
path: '**',
pathMatch: 'full',
path: `**`,
pathMatch: `full`,
redirectTo: DemoPath.HomePage,
},
];

@NgModule({
imports: [
RouterModule.forRoot(appRoutes, {
initialNavigation: 'enabledBlocking',
initialNavigation: `enabledBlocking`,
scrollPositionRestoration: `enabled`,
}),
],
Expand Down
1 change: 1 addition & 0 deletions apps/demo/src/app/constants/demo-path.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-restricted-syntax
export enum DemoPath {
HomePage = `home`,
CommonPage = `common`,
Expand Down
6 changes: 3 additions & 3 deletions apps/demo/src/app/pages/audio/audio-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</button>
<ng-template #graph>
<section>
<h1>Description</h1>
<h2>Description</h2>
<p>
This is a demo for
<strong>&#64;ng-web-apis/audio</strong>
Expand All @@ -20,7 +20,7 @@ <h1>Description</h1>
</p>
</section>
<section>
<h1>Source</h1>
<h2>Source</h2>

<tui-radio-labeled
item="buffer"
Expand Down Expand Up @@ -124,7 +124,7 @@ <h1>Source</h1>
</section>

<section>
<h1>Chain</h1>
<h2>Chain</h2>

<tui-radio-labeled
item="dry"
Expand Down
22 changes: 11 additions & 11 deletions apps/demo/src/app/pages/audio/audio-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import {ChangeDetectionStrategy, Component, Inject, ViewChild} from '@angular/co
import {AUDIO_CONTEXT} from '@ng-web-apis/audio';

@Component({
selector: `audio-page`,
templateUrl: `./audio-page.component.html`,
styleUrls: [`./audio-page.component.css`],
selector: 'audio-page',
templateUrl: './audio-page.component.html',
styleUrls: ['./audio-page.component.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AudioPageComponent {
@ViewChild('chain')
readonly chain?: AudioNode;

buffers = [Date.now()];

selectedChain = 'dry';
Expand Down Expand Up @@ -55,30 +58,27 @@ export class AudioPageComponent {

readonly real = [0, 0, 1, 0, 1];

@ViewChild('chain')
readonly chain?: AudioNode;

constructor(@Inject(AUDIO_CONTEXT) private readonly context: AudioContext) {}

get distortionCompensation(): number {
return 1.2 - this.distortion / 20;
}

start() {
start(): void {
this.started = true;
this.context.resume();
void this.context.resume();
}

getTransform({width, height}: HTMLCanvasElement): string {
return `scale(${width / this.fftSize}, ${height / 2})`;
}

onCurveChange(distortion: number) {
onCurveChange(distortion: number): void {
this.distortion = distortion;
this.curve = makeDistortionCurve(distortion);
}

onClick(source: AudioScheduledSourceNode, button: HTMLButtonElement) {
onClick(source: AudioScheduledSourceNode, button: HTMLButtonElement): void {
if (button.textContent!.trim() === 'Play') {
button.textContent = 'Stop';
source.start();
Expand All @@ -87,7 +87,7 @@ export class AudioPageComponent {
}
}

onTimeDomain(array: Uint8Array) {
onTimeDomain(array: Uint8Array): void {
this.path = array.reduce(
(path, value, index) => `${path} L ${index} ${value / 128}`,
'M 0 0',
Expand Down
21 changes: 11 additions & 10 deletions apps/demo/src/app/pages/audio/audio-page.module.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {AudioPageComponent} from './audio-page.component';
import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {WebAudioModule} from '@ng-web-apis/audio';
import {FormsModule} from '@angular/forms';
import {
TuiDataListWrapperModule,
TuiRadioLabeledModule,
TuiSelectModule,
TuiSliderModule,
} from '@taiga-ui/kit';
import {CanvasModule} from '@ng-web-apis/canvas';
import {
TuiButtonModule,
TuiLabelModule,
TuiTextfieldControllerModule,
} from '@taiga-ui/core';
import {
TuiDataListWrapperModule,
TuiRadioLabeledModule,
TuiSelectModule,
TuiSliderModule,
} from '@taiga-ui/kit';

import {AudioPageComponent} from './audio-page.component';

@NgModule({
imports: [
CommonModule,
FormsModule,
WebAudioModule,
RouterModule.forChild([{path: '', component: AudioPageComponent}]),
RouterModule.forChild([{path: ``, component: AudioPageComponent}]),
TuiRadioLabeledModule,
CanvasModule,
TuiButtonModule,
Expand Down
8 changes: 4 additions & 4 deletions apps/demo/src/app/pages/canvas/canvas-page.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {ChangeDetectionStrategy, Component} from '@angular/core';

@Component({
selector: `audio-page`,
templateUrl: `./canvas-page.component.html`,
styleUrls: [`./canvas-page.component.css`],
selector: 'audio-page',
templateUrl: './canvas-page.component.html',
styleUrls: ['./canvas-page.component.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CanvasPageComponent {
Expand Down Expand Up @@ -44,7 +44,7 @@ export class CanvasPageComponent {
};
}

onFile(file: File) {
onFile(file: File): void {
this.file = file;

if (file) {
Expand Down
11 changes: 6 additions & 5 deletions apps/demo/src/app/pages/canvas/canvas-page.module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {NgModule} from '@angular/core';
import {CanvasPageComponent} from './canvas-page.component';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
import {CanvasModule} from '@ng-web-apis/canvas';
import {TuiInputColorModule} from '@taiga-ui/addon-editor';
import {
TuiExpandModule,
TuiLabelModule,
Expand All @@ -16,7 +16,8 @@ import {
TuiSelectModule,
TuiSliderModule,
} from '@taiga-ui/kit';
import {TuiInputColorModule} from '@taiga-ui/addon-editor';

import {CanvasPageComponent} from './canvas-page.component';

@NgModule({
imports: [
Expand All @@ -32,7 +33,7 @@ import {TuiInputColorModule} from '@taiga-ui/addon-editor';
TuiTextfieldControllerModule,
TuiInputColorModule,
TuiInputModule,
RouterModule.forChild([{path: '', component: CanvasPageComponent}]),
RouterModule.forChild([{path: ``, component: CanvasPageComponent}]),
],
declarations: [CanvasPageComponent],
})
Expand Down
4 changes: 2 additions & 2 deletions apps/demo/src/app/pages/common/common-page.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {ChangeDetectionStrategy, Component} from '@angular/core';

@Component({
selector: `common-page`,
templateUrl: `./common-page.component.html`,
selector: 'common-page',
templateUrl: './common-page.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CommonPageComponent {
Expand Down
Loading

0 comments on commit bc7bdda

Please sign in to comment.