Skip to content
Open
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: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ jobs:

- run: npm run build

- run: npm run check-types
- run: npm run check:tsc

- run: npm run validate
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:

- run: npm ci

- run: npx biome ci
- run: npm run lint:ci
44 changes: 44 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import baselinePlugin from 'eslint-plugin-baseline-js';
import yalhPlugin from 'eslint-plugin-yet-another-license-header';
import tseslint from 'typescript-eslint';

const defaultLicense = `
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
`;

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

export default [
{
files: ['packages/*/src/**/*.{js,ts,mjs}'],
ignores: ['**/*.test.ts', '**/*.spec.ts'],
languageOptions: {
parser: tseslint.parser,
// enables type-aware linting to detect instance method usage
parserOptions: {
projectService: true,
},
},
plugins: {
'baseline-js': baselinePlugin,
'yet-another-license-header': yalhPlugin,
},
rules: {
...baselinePlugin.configs['recommended-ts']({
available: 'widely',
level: 'error',
}).rules,
'yet-another-license-header/header': [
'error',
{
header: defaultLicense,
allowedHeaderPatterns: [licensePattern],
},
],
},
},
];
23 changes: 23 additions & 0 deletions eslint.dist.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import baselinePlugin from 'eslint-plugin-baseline-js';
import baseConfig from './eslint.config.js';

// Extends base config and adds compiled output checking
export default [
...baseConfig,
// Compiled output - catches non-baseline APIs from dependencies
{
files: ['packages/*/dist/**/*.js'],
ignores: ['**/*.d.ts'],
plugins: {
'baseline-js': baselinePlugin,
},
rules: {
'baseline-js/use-baseline': [
'error',
{
available: 'widely',
},
],
},
},
];
Loading