Skip to content

Commit

Permalink
Merge pull request #1106 from myrotvorets/renovate/linters
Browse files Browse the repository at this point in the history
chore(deps): update dependency @myrotvorets/eslint-config-myrotvorets-ts to ^2.22.4
  • Loading branch information
myrotvorets-team authored Oct 13, 2023
2 parents ec9377d + 9195577 commit 2fe4a1b
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 152 deletions.
116 changes: 4 additions & 112 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
"@myrotvorets/oav-installer": "^4.1.0",
"@myrotvorets/opentelemetry-configurator": "^6.4.1",
"@myrotvorets/opentelemetry-plugin-knex": "^0.30.0",
"@opentelemetry/instrumentation-express": "^0.33.1",
"@opentelemetry/instrumentation-http": "^0.44.0",
"@opentelemetry/instrumentation-mysql2": "^0.34.1",
"envalid": "^8.0.0",
"express": "^4.18.2",
"express-openapi-validator": "^5.0.6",
Expand All @@ -41,7 +38,7 @@
"wpautop": "^1.0.0"
},
"devDependencies": {
"@myrotvorets/eslint-config-myrotvorets-ts": "^2.21.0",
"@myrotvorets/eslint-config-myrotvorets-ts": "^2.22.4",
"@types/chai": "^4.3.8",
"@types/chai-as-promised": "^7.1.6",
"@types/express": "^4.17.19",
Expand Down
16 changes: 2 additions & 14 deletions src/lib/tracing.mts
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
/* c8 ignore start */
import { OpenTelemetryConfigurator } from '@myrotvorets/opentelemetry-configurator';
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';
import { MySQL2Instrumentation } from '@opentelemetry/instrumentation-mysql2';
import { OpenTelemetryConfigurator, getExpressInstrumentations } from '@myrotvorets/opentelemetry-configurator';
import { KnexInstrumentation } from '@myrotvorets/opentelemetry-plugin-knex';

if (!+(process.env.ENABLE_TRACING || 0)) {
process.env.OTEL_SDK_DISABLED = 'true';
}

const configurator = new OpenTelemetryConfigurator({
serviceName: 'psb-api-identigraf',
instrumentations: [
new ExpressInstrumentation(),
new HttpInstrumentation(),
new KnexInstrumentation(),
new MySQL2Instrumentation(),
],
instrumentations: [...getExpressInstrumentations(), new KnexInstrumentation()],
});

configurator.start();
Expand Down
4 changes: 2 additions & 2 deletions src/models/criminal.mts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export class Criminal extends Model {
public address!: string;
public description!: string;

public static tableName = 'criminals';
public static override tableName = 'criminals';

public static modifiers: Modifiers<QueryBuilder<Model>> = {
public static override modifiers: Modifiers<QueryBuilder<Criminal>> = {
searchByName(builder, s: string, n: number): void {
void builder
.where('active', 1)
Expand Down
4 changes: 2 additions & 2 deletions src/models/criminalattachment.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export class CriminalAttachment extends Model {
public path!: string;
public mime_type!: string;

public static tableName = 'criminal_attachments';
public static override tableName = 'criminal_attachments';

public static modifiers: Modifiers<QueryBuilder<Model>> = {
public static override modifiers: Modifiers<QueryBuilder<CriminalAttachment>> = {
findByIds(builder, ids: number[]): void {
void builder.whereIn('id', ids).andWhere('mime_type', 'LIKE', 'image/%').orderBy(['id', 'sort_order']);
},
Expand Down
4 changes: 2 additions & 2 deletions src/server.mts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function configureApp(app: Express): Promise<void> {
);

/* c8 ignore start */
if (process.env.HAVE_SWAGGER === 'true') {
if (process.env['HAVE_SWAGGER'] === 'true') {
app.get('/', (_req, res) => res.redirect('/swagger/'));
}
/* c8 ignore stop */
Expand All @@ -47,7 +47,7 @@ export function setupApp(): Express {
app.set('strict routing', true);
app.set('x-powered-by', false);

if (process.env.SKIP_REQUEST_LOGGING !== '1') {
if (process.env['SKIP_REQUEST_LOGGING'] !== '1') {
app.use(
morgan(
'[PSBAPI-dzhura] :req[X-Request-ID]\t:method\t:url\t:status :res[content-length]\t:date[iso]\t:response-time\t:total-time',
Expand Down
5 changes: 2 additions & 3 deletions test/functional/controllers/monitoring.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { expect } from 'chai';
import request from 'supertest';
import * as knexpkg from 'knex';
import mockKnex from 'mock-knex';
import type { HealthChecker } from '@cloudnative/health-connect';
import { buildKnexConfig } from '../../../src/knexfile.mjs';
import { healthChecker, monitoringController } from '../../../src/controllers/monitoring.mjs';

Expand All @@ -25,7 +24,7 @@ describe('MonitoringController', function () {

beforeEach(function () {
expect(healthChecker).not.to.be.undefined;
(healthChecker as HealthChecker).shutdownRequested = false;
healthChecker!.shutdownRequested = false;
});

after(function () {
Expand All @@ -41,7 +40,7 @@ describe('MonitoringController', function () {
request(app).get(`/monitoring/${endpoint}`).expect('Content-Type', /json/u).expect(200);

const checker503 = (endpoint: string): Promise<unknown> => {
(healthChecker as HealthChecker).shutdownRequested = true;
healthChecker!.shutdownRequested = true;
return request(app).get(`/monitoring/${endpoint}`).expect('Content-Type', /json/u).expect(503);
};

Expand Down
2 changes: 1 addition & 1 deletion test/migrate.mts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ try {
process.stdout.write('Creating tables\n');
await db.migrate.latest();

if (process.env.SEED_TABLES === 'yes') {
if (process.env['SEED_TABLES'] === 'yes') {
process.stdout.write('Populating tables\n');
await db.seed.run();
}
Expand Down
4 changes: 2 additions & 2 deletions test/migrations/2020071914070000_criminals.mts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export async function up(knex: Knex): Promise<void> {
}

export async function down(knex: Knex): Promise<void> {
if (process.env.NODE_ENV !== 'test') {
throw new Error(`Refusing to run this in the ${process.env.NODE_ENV} environment`);
if (process.env['NODE_ENV'] !== 'test') {
throw new Error(`Refusing to run this in the ${process.env['NODE_ENV']} environment`);
}

await knex.schema.dropTableIfExists('criminals');
Expand Down
4 changes: 2 additions & 2 deletions test/migrations/2020071914090000_criminal_attachments.mts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export async function up(knex: Knex): Promise<void> {
}

export async function down(knex: Knex): Promise<void> {
if (process.env.NODE_ENV !== 'test') {
throw new Error(`Refusing to run this in the ${process.env.NODE_ENV} environment`);
if (process.env['NODE_ENV'] !== 'test') {
throw new Error(`Refusing to run this in the ${process.env['NODE_ENV']} environment`);
}

await knex.schema.dropTableIfExists('criminal_attachments');
Expand Down
4 changes: 2 additions & 2 deletions test/seeds/0000_criminals.mts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const seedData = [
];

export async function seed(knex: Knex): Promise<void> {
if (!['test', 'development'].includes(process.env.NODE_ENV || '')) {
throw new Error(`Refusing to run this in ${process.env.NODE_ENV} environment`);
if (!['test', 'development'].includes(process.env['NODE_ENV'] ?? '')) {
throw new Error(`Refusing to run this in ${process.env['NODE_ENV']} environment`);
}

await knex('criminals').del();
Expand Down
4 changes: 2 additions & 2 deletions test/seeds/0001_criminal_attachments.mts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ const seedData = [
];

export async function seed(knex: Knex): Promise<void> {
if (!['test', 'development'].includes(process.env.NODE_ENV || '')) {
throw new Error(`Refusing to run this in ${process.env.NODE_ENV} environment`);
if (!['test', 'development'].includes(process.env['NODE_ENV'] ?? '')) {
throw new Error(`Refusing to run this in ${process.env['NODE_ENV']} environment`);
}

await knex('criminal_attachments').del();
Expand Down
6 changes: 3 additions & 3 deletions test/unit/services/search.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('SearchService', function () {
// eslint-disable-next-line mocha/no-setup-in-describe
table1.forEach(([input, expected]) =>
it(`should discard names having less than two unique lexemes ('${input}')`, function () {
return tester(input, expected);
tester(input, expected);
}),
);

Expand All @@ -52,7 +52,7 @@ describe('SearchService', function () {
// eslint-disable-next-line mocha/no-setup-in-describe
table2.forEach(([input, expected]) =>
it(`should correctly handle names with two lexemes ('${input}' => '${expected}')`, function () {
return tester(input, expected);
tester(input, expected);
}),
);

Expand All @@ -70,7 +70,7 @@ describe('SearchService', function () {
// eslint-disable-next-line mocha/no-setup-in-describe
table3.forEach(([input, expected]) =>
it(`should correctly handle names with more than two lexemes ('${input}' => '${expected}')`, function () {
return tester(input, expected);
tester(input, expected);
}),
);
});
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
"declaration": false,
"removeComments": false,
"strict": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"noUnusedParameters": false,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"esModuleInterop": true,
"resolveJsonModule": true
},
Expand Down

0 comments on commit 2fe4a1b

Please sign in to comment.