-
Notifications
You must be signed in to change notification settings - Fork 11
chore(lint): add eslint header and baseline rules #88
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
Changes from all commits
8255606
55463a8
af31885
2d20a39
d22e3b3
0f395e2
f8d87f8
1e6161f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,4 +25,4 @@ jobs: | |
|
|
||
| - run: npm ci | ||
|
|
||
| - run: npx biome ci | ||
| - run: npm run lint:ci | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| 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]+)*\n(?: \* Copyright [^\n]+\n)*(?: \*\n)? \* SPDX-License-Identifier: Apache-2\.0\n \*\/$/; | ||
|
|
||
| export default [ | ||
| { | ||
| files: ['packages/*/src/**/*.{js,ts,mjs}'], | ||
| languageOptions: { | ||
| parser: tseslint.parser, | ||
| }, | ||
| plugins: { | ||
| 'baseline-js': baselinePlugin, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this effectively duplicating biome linting? I understand they aren't identical.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| '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], | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| ]; | ||
Uh oh!
There was an error while loading. Please reload this page.