Skip to content

Commit d13ce45

Browse files
committed
new config file, fix types, add webpack
1 parent 422877c commit d13ce45

File tree

93 files changed

+417
-1514
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+417
-1514
lines changed

eslint.config.js

Lines changed: 0 additions & 127 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
/* eslint-disable license-header/header */
2+
3+
import eslint from '@eslint/js';
4+
import tseslint from 'typescript-eslint';
5+
import globals from 'globals';
6+
import nodePlugin from 'eslint-plugin-n';
7+
import licenseHeaderPlugin from 'eslint-plugin-license-header';
8+
9+
const license = [
10+
'/*',
11+
' * Copyright The OpenTelemetry Authors',
12+
' *',
13+
' * Licensed under the Apache License, Version 2.0 (the "License");',
14+
' * you may not use this file except in compliance with the License.',
15+
' * You may obtain a copy of the License at',
16+
' *',
17+
' * https://www.apache.org/licenses/LICENSE-2.0',
18+
' *',
19+
' * Unless required by applicable law or agreed to in writing, software',
20+
' * distributed under the License is distributed on an "AS IS" BASIS,',
21+
' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
22+
' * See the License for the specific language governing permissions and',
23+
' * limitations under the License.',
24+
' */',
25+
];
26+
27+
const baseConfig = tseslint.config(
28+
{
29+
ignores: [
30+
'**/build/**',
31+
'**/coverage/**',
32+
'**/dist/**',
33+
'**/node_modules/**',
34+
],
35+
},
36+
{
37+
files: ['**/*.{js,ts,mjs}'],
38+
plugins: {
39+
'license-header': licenseHeaderPlugin,
40+
n: nodePlugin,
41+
'@typescript-eslint': tseslint.plugin,
42+
},
43+
extends: [
44+
eslint.configs.recommended,
45+
tseslint.configs.recommended,
46+
nodePlugin.configs['flat/recommended'],
47+
],
48+
languageOptions: {
49+
ecmaVersion: 2022,
50+
globals: {
51+
...globals.node,
52+
},
53+
},
54+
settings: {
55+
node: {
56+
tryExtensions: ['.js', '.json', '.node', '.ts', '.tsx'],
57+
},
58+
},
59+
rules: {
60+
quotes: ['error', 'single', { avoidEscape: true }],
61+
eqeqeq: ['error', 'smart'],
62+
'prefer-rest-params': 'off',
63+
'n/no-deprecated-api': ['warn'],
64+
'license-header/header': ['error', license],
65+
},
66+
},
67+
68+
// TypeScript strict rules
69+
{
70+
files: ['**/*.ts'],
71+
// extends: [...tseslint.configs.strictTypeChecked],
72+
extends: [...tseslint.configs.recommendedTypeChecked],
73+
languageOptions: {
74+
parser: tseslint.parser,
75+
parserOptions: {
76+
project: true,
77+
},
78+
},
79+
rules: {
80+
'@typescript-eslint/no-var-requires': 'off',
81+
'@typescript-eslint/naming-convention': [
82+
'error',
83+
{
84+
selector: 'memberLike',
85+
modifiers: ['private', 'protected'],
86+
format: ['camelCase'],
87+
leadingUnderscore: 'require',
88+
},
89+
],
90+
'n/no-missing-import': 'off',
91+
},
92+
},
93+
94+
// Test files relaxed rules
95+
{
96+
files: ['**/test/**/*.ts', '**/*.test.ts'],
97+
rules: {
98+
'@typescript-eslint/no-explicit-any': 'off',
99+
'@typescript-eslint/no-unsafe-assignment': 'off',
100+
'@typescript-eslint/no-unsafe-member-access': 'off',
101+
'@typescript-eslint/no-unsafe-call': 'off',
102+
'@typescript-eslint/no-unsafe-return': 'off',
103+
'@typescript-eslint/restrict-template-expressions': 'off',
104+
'@typescript-eslint/unbound-method': 'off',
105+
'@typescript-eslint/no-non-null-assertion': 'off',
106+
'@typescript-eslint/no-unnecessary-condition': 'off',
107+
'@typescript-eslint/no-unsafe-argument': 'off',
108+
'@typescript-eslint/ban-ts-comment': 'off',
109+
'@typescript-eslint/no-shadow': 'off',
110+
'@typescript-eslint/require-await': 'off',
111+
'@typescript-eslint/no-floating-promises': 'off',
112+
'@typescript-eslint/no-misused-promises': 'off',
113+
'@typescript-eslint/no-base-to-string': 'off',
114+
'@typescript-eslint/prefer-promise-reject-errors': 'off',
115+
'@typescript-eslint/no-unused-vars': [
116+
'warn',
117+
{ argsIgnorePattern: '^_' },
118+
],
119+
'no-empty': 'off',
120+
},
121+
},
122+
123+
// ESM files
124+
{
125+
files: ['**/*.mjs'],
126+
languageOptions: {
127+
sourceType: 'module',
128+
},
129+
},
130+
131+
// Browser environment
132+
{
133+
files: [
134+
'**/examples/web/**/*',
135+
'**/packages/**/browser/**/*',
136+
'**/packages/instrumentation-user-interaction/**/*',
137+
'**/packages/instrumentation-document-load/**/*',
138+
'**/packages/instrumentation-long-task/**/*',
139+
'**/packages/plugin-react-load/**/*',
140+
],
141+
languageOptions: {
142+
globals: {
143+
...globals.browser,
144+
Zone: 'readonly',
145+
Task: 'readonly',
146+
},
147+
},
148+
}
149+
);
150+
151+
// module.exports = baseConfig;
152+
export default baseConfig;

examples/bunyan/.eslintrc.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

examples/connect/.eslintrc.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

examples/dns/.eslintrc.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

examples/express/.eslintrc.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)