-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy patheslint.config.js
More file actions
77 lines (74 loc) · 1.9 KB
/
eslint.config.js
File metadata and controls
77 lines (74 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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 [
{
ignores: [
// ignore files
'**/*.spec.ts',
'**/*.test.ts',
// ignore folders to speed up crawling
'**/.turbo/**',
'**/dist/**',
'.claude/**',
'.github/**',
'docs/**',
'examples/**',
'turbo/**',
],
},
{
files: ['packages/**/src/**/*.{*js,*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],
},
],
'no-restricted-imports': [
'error',
{
paths: [
{
name: '#instrumentation-test-utils',
message:
'#instrumentation-test-utils is for test files only, not production source.',
},
],
patterns: [
{
group: ['**/test-utils*'],
message:
'test-utils is for test files only, not production source.',
},
],
},
],
},
},
];