Skip to content

Conversation

@overbalance
Copy link
Contributor

@overbalance overbalance commented Dec 12, 2025

What problem is this solving?

Adds ESLint rules for browser compatibility checking (baseline) and license header enforcement to ensure code quality and compliance.

Short description of changes

  • Add eslint with eslint-plugin-baseline-js for browser compatibility linting
  • Add license header enforcement using eslint-plugin-yet-another-license-header, thanks @trentm!
  • Configure to lint only packages/*/src/**/*.{js,ts,mjs} files

Testing

  • npm run lint passes

@overbalance overbalance requested a review from a team as a code owner December 12, 2025 21:11
@overbalance overbalance changed the title chore(lint): add eslint rules chore(lint): add eslint header and baseline rules Dec 12, 2025
parser: tseslint.parser,
},
plugins: {
'baseline-js': baselinePlugin,
Copy link

Choose a reason for hiding this comment

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

Is this effectively duplicating biome linting? I understand they aren't identical.

Copy link
Contributor Author

@overbalance overbalance Dec 14, 2025

Choose a reason for hiding this comment

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

No, it's not. This is only running the baseline plugin and the header plugin which are not available in the biome plugin format. Both features are essential so while running biome and eslint is not ideal, it's still a major speed up from running eslint recommended rules on its own.

eslint.config.js Outdated
`;

const licensePattern =
/^\/\*\n \* Copyright The OpenTelemetry Authors\n \* SPDX-License-Identifier: Apache-2\.0\n \*\/$/;
Copy link

Choose a reason for hiding this comment

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

This won't allow for extra copyright assignments. See, for example, https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/packages/instrumentation-oracledb/src/instrumentation.ts
Currently nothing in this repo requires a separate copyright assignment, so this works for now.

Could perhaps do this:

Suggested change
/^\/\*\n \* Copyright The OpenTelemetry Authors\n \* SPDX-License-Identifier: Apache-2\.0\n \*\/$/;
/^\/\*\n \* Copyright The OpenTelemetry Authors(?:, [^\n]+)*\n \* SPDX-License-Identifier: Apache-2\.0\n \*\/$/;

Copy link
Contributor Author

@overbalance overbalance Dec 15, 2025

Choose a reason for hiding this comment

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

That was an oversight. I just fixed so it matches contrib to allow for comma-delimited vendors on the same line as OTel, as well as on the next line, with an optional line break after

@overbalance overbalance merged commit 4ca1335 into open-telemetry:main Dec 18, 2025
5 checks passed
@overbalance overbalance deleted the overbalance/add-eslint-rules branch December 18, 2025 18:45
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.

3 participants