Skip to content

chore(eslint): lint examples/bunyan and prepare for linting .js and .mjs files #2567

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

Merged
merged 4 commits into from
Jun 25, 2025

Conversation

trentm
Copy link
Contributor

@trentm trentm commented Nov 28, 2024

This adds support for 'npm run lint' in examples/bunyan, using the same
base eslint.config.js used by most of the repo.

There are ulterior motives:

Hattip to the following for some of the eslint config changes:
https://github.com/open-telemetry/opentelemetry-js/pull/4446/files#diff-1a88e8e72db982c999acf146817a416a02d93547458e6525610cf69b24751af9


If it helps review:

  • the first commit is just the config changes
  • the second commit is the changes to examples/bunyan to get 'npm run lint' passing

…mjs files

This adds support for 'npm run lint' in examples/bunyan, using the same
base eslint.config.js used by most of the repo.

There are ulterior motives:
- This is a first step to linting all the examples using the same
  base config (rather than the spotty linting of examples using the
  separate "examples/.eslintrc".
- The eslint.config.js changes support being used to lint .ts,
  .js, and .mjs files reasonably. I'll follow-up with a separate PR
  adding linting of .mjs files used for some ESM testing
  (e.g. "instrumentation-ioredis/test/fixtures/use-ioredis.mjs")

Hattip to the following for some of the eslint config changes:
  https://github.com/open-telemetry/opentelemetry-js/pull/4446/files#diff-1a88e8e72db982c999acf146817a416a02d93547458e6525610cf69b24751af9
@trentm trentm self-assigned this Nov 28, 2024
@trentm trentm requested a review from a team as a code owner November 28, 2024 23:39
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.76%. Comparing base (5909ad4) to head (607a383).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2567      +/-   ##
==========================================
+ Coverage   89.53%   89.76%   +0.23%     
==========================================
  Files         182      187       +5     
  Lines        8837     9147     +310     
  Branches     1844     1884      +40     
==========================================
+ Hits         7912     8211     +299     
- Misses        925      936      +11     

see 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should examples/bunyan be added to the package.json#workspaces list in order to run linter on CI regularly?

"workspaces": [
"packages/*",
"plugins/node/*",
"plugins/web/*",
"propagators/*",
"detectors/node/*",
"metapackages/*"
]

@trentm
Copy link
Contributor Author

trentm commented Dec 4, 2024

Should examples/bunyan be added to the package.json#workspaces list in order to run linter on CI regularly?

I was initially thinking no. Instead I was going to consider adding a lint:examples script to the set of npm run lint things. The last I recall we took the examples out of the workspace to help with shared package-lock deps, because the examples were so behind.

@JamieDanielson
Copy link
Member

I was going to consider adding a lint:examples script to the set of npm run lint things.

I like this idea. It's super useful to have linters run against examples but shouldn't block any other builds. I would love to have proper linting on all the examples.

@JamieDanielson
Copy link
Member

we took the examples out of the workspace to help with shared package-lock deps, because the examples were so behind.

That's right. Similarly to my comment before, while it's useful to have CI run on examples regularly, if they are not being kept up to date, we don't want to have problems with the packages themselves. We need to revisit our examples strategy in general though to ensure they are useful while also not hindering forward progress.

@dyladan
Copy link
Member

dyladan commented May 14, 2025

This has a conflict but I think it can be merged after that

@trentm trentm merged commit dddbb78 into open-telemetry:main Jun 25, 2025
20 checks passed
trentm added a commit to trentm/opentelemetry-js-contrib that referenced this pull request Jul 16, 2025
…linting)

In open-telemetry#2567 support
was added to eslint.config.js for linting .js and .mjs files -- before it
only supported .ts files.
Originally this was added to support linting examples/... which includes many
.js files.

This change enables linting of .js and .mjs files in the rest of the repo.

Refs: open-telemetry#2891
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants