1+ /*
2+ * Copyright The OpenTelemetry Authors
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
117import eslint from '@eslint/js' ;
218import tseslint from 'typescript-eslint' ;
319import globals from 'globals' ;
4- import licenseHeaderPlugin from 'eslint-plugin-license-header' ;
520import nodePlugin from 'eslint-plugin-n' ;
21+ import yalhPlugin from 'eslint-plugin-yet-another-license-header' ;
22+
23+ const defaultLicense = `
24+ /*
25+ * Copyright The OpenTelemetry Authors
26+ *
27+ * Licensed under the Apache License, Version 2.0 (the "License");
28+ * you may not use this file except in compliance with the License.
29+ * You may obtain a copy of the License at
30+ *
31+ * https://www.apache.org/licenses/LICENSE-2.0
32+ *
33+ * Unless required by applicable law or agreed to in writing, software
34+ * distributed under the License is distributed on an "AS IS" BASIS,
35+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36+ * See the License for the specific language governing permissions and
37+ * limitations under the License.
38+ */
39+ ` ;
640
7- const license = [
8- '/*' ,
9- ' * Copyright The OpenTelemetry Authors' ,
10- ' *' ,
11- ' * Licensed under the Apache License, Version 2.0 (the "License");' ,
12- ' * you may not use this file except in compliance with the License.' ,
13- ' * You may obtain a copy of the License at' ,
14- ' *' ,
15- ' * https://www.apache.org/licenses/LICENSE-2.0' ,
16- ' *' ,
17- ' * Unless required by applicable law or agreed to in writing, software' ,
18- ' * distributed under the License is distributed on an "AS IS" BASIS,' ,
19- ' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.' ,
20- ' * See the License for the specific language governing permissions and' ,
21- ' * limitations under the License.' ,
22- ' */' ,
23- ] ;
41+ // This matches `defaultLicense`, but allows additional Copyright holders
42+ // either on the same line:
43+ // Copyright The OpenTelemetry Authors, <someone>, <another someone>
44+ // and/or on subsequent lines:
45+ // Copyright The OpenTelemetry Authors
46+ // Copyright <someone>
47+ // Copyright <another someone>
48+ const licensePattern = / ^ \/ \* \n \* C o p y r i g h t T h e O p e n T e l e m e t r y A u t h o r s ( , .+ ) * \n ( \* C o p y r i g h t .+ \n ) * \* \n \* L i c e n s e d u n d e r t h e A p a c h e L i c e n s e , V e r s i o n 2 .0 \( t h e " L i c e n s e " \) ; \n \* y o u m a y n o t u s e t h i s f i l e e x c e p t i n c o m p l i a n c e w i t h t h e L i c e n s e .\n \* Y o u m a y o b t a i n a c o p y o f t h e L i c e n s e a t \n \* \n \* { 6 } h t t p s : \/ \/ w w w .a p a c h e .o r g \/ l i c e n s e s \/ L I C E N S E - 2 .0 \n \* \n \* U n l e s s r e q u i r e d b y a p p l i c a b l e l a w o r a g r e e d t o i n w r i t i n g , s o f t w a r e \n \* d i s t r i b u t e d u n d e r t h e L i c e n s e i s d i s t r i b u t e d o n a n " A S I S " B A S I S , \n \* W I T H O U T W A R R A N T I E S O R C O N D I T I O N S O F A N Y K I N D , e i t h e r e x p r e s s o r i m p l i e d .\n \* S e e t h e L i c e n s e f o r t h e s p e c i f i c l a n g u a g e g o v e r n i n g p e r m i s s i o n s a n d \n \* l i m i t a t i o n s u n d e r t h e L i c e n s e .\n \* \/ $ /
2449
2550const baseConfig = tseslint . config (
2651 {
@@ -34,8 +59,7 @@ const baseConfig = tseslint.config(
3459 {
3560 files : [ '**/*.{js,ts,mjs}' , '*.{js,ts,mjs}' ] ,
3661 plugins : {
37- // XXX
38- // 'license-header': licenseHeaderPlugin,
62+ 'yet-another-license-header' : yalhPlugin ,
3963 node : nodePlugin ,
4064 } ,
4165 extends : [
@@ -58,8 +82,10 @@ const baseConfig = tseslint.config(
5882 quotes : [ 'error' , 'single' , { avoidEscape : true } ] ,
5983 eqeqeq : [ 'error' , 'smart' ] ,
6084 'prefer-rest-params' : 'off' ,
61- // XXX
62- // 'license-header/header': ['error', license],
85+ 'yet-another-license-header/header' : [ 'error' , {
86+ header : defaultLicense ,
87+ allowedHeaderPatterns : [ licensePattern ] ,
88+ } ] ,
6389
6490 // new rules
6591 'no-unused-vars' : 'warn' ,
0 commit comments