Skip to content

Commit

Permalink
Fix formatting & lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaHydrae committed Sep 28, 2024
1 parent dcd2249 commit 774beb3
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion backend/src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import {
OnApplicationBootstrap
} from '@nestjs/common';
import chalk from 'chalk';
import { DateTime } from 'luxon';
import { relative as relativePath } from 'node:path';
import { UAParser } from 'ua-parser-js';

import { memory } from '../config.js';
import { publicDir, root } from '../constants.js';
import { db, key } from '../db.js';
import { DateTime } from 'luxon';

@Injectable()
export class AppService implements OnApplicationBootstrap {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { relative as relativePath } from 'node:path';

import { AppModule } from './app/app.module.js';
import { frontendProxyUrl, isDevelopment, port } from './config.js';
import { db } from './db.js';
import { publicDir, root } from './constants.js';
import { db } from './db.js';

async function start() {
const logger = new Logger('main');
Expand Down
6 changes: 3 additions & 3 deletions e2e/example.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ test('has title', async ({ playwright }) => {
const firefoxContext = await firefox.newContext();
const firefoxPage = await firefoxContext.newPage();
await firefoxPage.goto('/');
await expect(firefoxPage).toHaveTitle(/Big Browser/);
await expect(firefoxPage).toHaveTitle(/Big Browser/u);

const chromium = await playwright.chromium.launch();
const chromiumContext = await chromium.newContext();
const chromiumPage = await chromiumContext.newPage();
await chromiumPage.goto('/');
await expect(chromiumPage).toHaveTitle(/Big Browser/);
await expect(chromiumPage).toHaveTitle(/Big Browser/u);

const webkit = await playwright.webkit.launch();
const webkitContext = await webkit.newContext();
const webkitPage = await webkitContext.newPage();
await webkitPage.goto('/');
await expect(webkitPage).toHaveTitle(/Big Browser/);
await expect(webkitPage).toHaveTitle(/Big Browser/u);
});
30 changes: 27 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ const compat = new FlatCompat({

const frontendFiles = ['ts', 'vue'].map(ext => `frontend/**/*.${ext}`);

const { plugins, ...restVue } = vueEslintConfigTypescript;

export default [
{
ignores: ['dist', 'node_modules', 'public', 'tmp', 'frontend/node_modules']
ignores: ['dist', 'frontend/dist', 'node_modules', 'public', 'tmp', 'frontend/node_modules']
},
js.configs.all,
...tsEslint.configs.recommended,
Expand Down Expand Up @@ -51,6 +53,12 @@ export default [
rules: {
'@typescript-eslint/class-methods-use-this': 'error',
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{
ignoreRestSiblings: true
}
],
'@typescript-eslint/no-use-before-define': [
'error',
{
Expand Down Expand Up @@ -93,13 +101,15 @@ export default [
'newlines-between': 'always'
}
],
'init-declarations': 'off',
'max-statements': ['error', 20],
'new-cap': 'off',
'no-empty-function': 'off',
'no-magic-numbers': 'off',
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-ternary': 'off',
'no-undefined': 'off',
'no-unused-vars': 'off',
'no-use-before-define': 'off',
'no-useless-constructor': 'off',
'one-var': ['error', 'never'],
Expand Down Expand Up @@ -134,7 +144,7 @@ export default [
...config,
files: config.files?.map(file => `frontend/${file}`) ?? frontendFiles
})),
...compat.config(vueEslintConfigTypescript),
...compat.config(restVue),
{
files: frontendFiles,
rules: {
Expand All @@ -147,7 +157,21 @@ export default [
pascalCase: true
}
}
]
],
'vue/html-closing-bracket-newline': 'off',
'vue/html-indent': 'off',
'vue/max-attributes-per-line': [
'error',
{
singleline: {
max: 3
},
multiline: {
max: 1
}
}
],
'vue/singleline-html-element-content-newline': 'off'
}
}
];
2 changes: 0 additions & 2 deletions frontend/src/components/PreviousUserAgents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@ store.loadPreviousUserAgents();
</div>
</div>
</template>

<style scoped></style>
3 changes: 2 additions & 1 deletion frontend/src/stores/ua.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { isLeft } from 'fp-ts/lib/Either';
import * as t from 'io-ts';
import { defineStore } from 'pinia';
import { ref } from 'vue';

import { iso8601DateTime } from '../utils/iso-8601-date-time';
import { isLeft } from 'fp-ts/lib/Either';

export const userAgent = t.readonly(
t.type({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/http-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function parseHttpUrl(value: unknown): URL | false {
return false;
}

let url = undefined;
let url;
try {
url = new URL(value);
} catch {
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default defineConfig({
// Run tests in files in parallel
fullyParallel: true,
// Fail the build on CI if you accidentally left test.only in the source code
forbidOnly: !!process.env['CI'],
forbidOnly: Boolean(process.env['CI']),
// Retry on CI only
retries: process.env['CI'] ? 2 : 0,
// Opt out of parallel tests on CI
Expand Down

0 comments on commit 774beb3

Please sign in to comment.