Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lint, lint:fix and format:fix targets #82

Merged
merged 5 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Keep GitHub Actions up to date with GitHub's Dependabot...
# Keep GitHub Actions up to date with GitHub's Dependabot...
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
version: 2
Expand All @@ -8,6 +8,6 @@ updates:
groups:
github-actions:
patterns:
- "*" # Group all Actions updates into a single larger pull request
- '*' # Group all Actions updates into a single larger pull request
schedule:
interval: weekly
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ on:
- master

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Install modules
run: yarn
- name: Lint code base
run: yarn lint
test:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Visit the [npm package][releases] to find the latest version of this package.

Visit [docs](https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/nodejs/) page for usage and configuration documentation.

[Grafana Pyroscope]:https://grafana.com/oss/pyroscope/
[@datadog/pprof]:https://github.com/DataDog/pprof-nodejs
[v8-prof]:https://v8.dev/docs/profile
[docs]:https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/nodejs
[releases]:https://www.npmjs.com/package/@pyroscope/nodejs
[Grafana Pyroscope]: https://grafana.com/oss/pyroscope/
[@datadog/pprof]: https://github.com/DataDog/pprof-nodejs
[v8-prof]: https://v8.dev/docs/profile
[docs]: https://grafana.com/docs/pyroscope/latest/configure-client/language-sdks/nodejs
[releases]: https://www.npmjs.com/package/@pyroscope/nodejs

## Maintainers

Expand Down
1 change: 0 additions & 1 deletion commitlint.config.js

This file was deleted.

8 changes: 4 additions & 4 deletions config/fileTransformer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// source: https://jestjs.io/docs/code-transformation#examples

const path = require('path');
import 'path'

module.exports = {
process(src, filename, config, options) {
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
process(src, filename) {
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';'
},
};
}
15 changes: 7 additions & 8 deletions config/tsconfig.jest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"extends": "../tsconfig",
"compilerOptions": {
"module": "esnext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"sourceMap": true, /* Generates corresponding source maps. */
"inlineSourceMap": true,
"moduleResolution": "node"
}
"extends": "../tsconfig",
"compilerOptions": {
"module": "esnext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"sourceMap": true /* Generates corresponding source maps. */,
"inlineSourceMap": true,
"moduleResolution": "node"
}
}
2 changes: 1 addition & 1 deletion config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const path = require('path')
import 'path'

module.exports = {
mode: 'production',
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"build:types": "node tools/cleanup types && tsc -p config/tsconfig.types.json",
"clean": "node tools/cleanup",
"package": "npm run build && npm pack",
"format:fix": "prettier --write .",
"lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx .",
"lint:fix": "yarn lint --fix",
"test": "jest --no-cache --runInBand --forceExit --detectOpenHandles",
"test:cov": "jest --coverage --no-cache --runInBand --forceExit --detectOpenHandles",
"addscope": "node tools/packagejson name @pyroscope"
Expand Down
18 changes: 6 additions & 12 deletions src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,27 @@ export interface Logger {
}

export class NullLogger implements Logger {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars
info(...args: Array<{}>): void {
return
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars
error(...args: Array<{}>): void {
return
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars
trace(...args: Array<{}>): void {
return
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars
warn(...args: Array<{}>): void {
return
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars
fatal(...args: Array<{}>): void {
return
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars
debug(...args: Array<{}>): void {
return
}
Expand Down
12 changes: 6 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
"module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"module": "esnext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
// "lib": [], /* Specify library files to be included in the compilation. */
"allowJs": true, /* Allow javascript files to be compiled. */
"allowJs": true /* Allow javascript files to be compiled. */,
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
"declaration": true /* Generates corresponding '.d.ts' file. */,
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
Expand Down Expand Up @@ -44,9 +44,9 @@
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
"paths": {
"@pyroscope/nodejs": ["./src/"],
"@pyroscope/nodejs/*": ["./src/*"],
}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
"@pyroscope/nodejs": ["./src/"],
"@pyroscope/nodejs/*": ["./src/*"]
} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
Expand Down