Skip to content

Commit

Permalink
Update eslint and code to satisfy linter
Browse files Browse the repository at this point in the history
  • Loading branch information
chtushar committed Apr 23, 2024
1 parent 573375f commit 6470589
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 350 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = {
plugins: ['@typescript-eslint'],
root: true,
rules: {
prettier: {
'space-before-function-paren': ['error', 'never']
}
'func-call-spacing': 'off',
'space-before-function-paren': 'off',
'@typescript-eslint/no-var-requires': 'off'
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "tsup",
"build:watch": "tsup --watch",
"test": "cd tests/nextjs && next build && cd ../.. && vitest",
"test:ui": "vitest --ui"
"test:ui": "cd tests/nextjs && next build && cd ../.. && vitest --ui"
},
"license": "Apache-2.0",
"author": "Last9 team <hi@last9.io>",
Expand Down
4 changes: 2 additions & 2 deletions src/OpenAPM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { instrumentExpress } from './clients/express';
import { instrumentMySQL } from './clients/mysql2';
import { instrumentNestFactory } from './clients/nestjs';
import { LevitateConfig, LevitateEvents } from './levitate/events';
import { instrumentNextjs } from './clients/nextjs/nextjs';
import { instrumentNextjs } from './clients/nextjs';

export type ExtractFromParams = {
from: 'params';
Expand Down Expand Up @@ -294,7 +294,7 @@ export class OpenAPM extends LevitateEvents {
: pathname;

const labels: Record<string, string> = {
path: path,
path,
status: res.statusCode.toString(),
method: req.method as string,
...parsedLabelsFromPathname
Expand Down
14 changes: 10 additions & 4 deletions src/clients/nextjs/nextjs.ts → src/clients/nextjs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type NextNodeServer from 'next/dist/server/next-server';
import chokidar from 'chokidar';
import type { Counter, Histogram } from 'prom-client';
import { wrap } from '../../shimmer';
import { wrap } from '../shimmer';
import { loadManifest } from 'next/dist/server/load-manifest';
import { join } from 'path';
import { getRouteRegex } from 'next/dist/shared/lib/router/utils/route-regex';
Expand Down Expand Up @@ -33,7 +33,9 @@ const PATHS_CACHE = {
false
)) as Record<string, string>;

for (const [key, _] of Object.entries(appPathsManifest)) {
const appPathsKeys = Object.keys(appPathsManifest);
for (let i = 0; i < appPathsKeys.length; i++) {
const key = appPathsKeys[i];
const path = key.replace(
/\/(page|not-found|layout|loading|head|route)$/,
''
Expand All @@ -48,7 +50,9 @@ const PATHS_CACHE = {
});
}

for (const key of Object.keys(pagesManifest)) {
const keys = Object.keys(pagesManifest);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const reg = getRouteRegex(key);
const matcher = getRouteMatcher(reg);

Expand Down Expand Up @@ -132,7 +136,9 @@ export const instrumentNextjs = (
PATHS_CACHE.setValue();
PATHS_CACHE.keepUpdated();
const getParameterizedRoute = (route: string) => {
for (const page of PATHS_CACHE.value) {
const values = Array.from(PATHS_CACHE.value);
for (let i = 0; i < values.length; i++) {
const page = values[i];
if (page.matcher(route) !== false) {
return page.route;
}
Expand Down
96 changes: 0 additions & 96 deletions src/clients/nextjs/getWebpackConfig.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/clients/nextjs/index.ts

This file was deleted.

60 changes: 0 additions & 60 deletions src/clients/nextjs/loader.ts

This file was deleted.

91 changes: 0 additions & 91 deletions src/clients/nextjs/stitchTemplate.ts

This file was deleted.

22 changes: 0 additions & 22 deletions src/clients/nextjs/templates/server-component.ts

This file was deleted.

Empty file removed src/clients/nextjs/types.ts
Empty file.
Loading

0 comments on commit 6470589

Please sign in to comment.