11/*
2- * Licensed to Elasticsearch B.V. under one or more contributor
3- * license agreements. See the NOTICE file distributed with
4- * this work for additional information regarding copyright
5- * ownership. Elasticsearch B.V. licenses this file to you under
6- * the Apache License, Version 2.0 (the "License"); you may
7- * not use this file except in compliance with the License.
8- * You may obtain a copy of the License at
9- *
10- * http://www.apache.org/licenses/LICENSE-2.0
11- *
12- * Unless required by applicable law or agreed to in writing,
13- * software distributed under the License is distributed on an
14- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15- * KIND, either express or implied. See the License for the
16- * specific language governing permissions and limitations
17- * under the License.
2+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+ * or more contributor license agreements. Licensed under the Elastic License
4+ * and the Server Side Public License, v 1; you may not use this file except in
5+ * compliance with, at your election, the Elastic License or the Server Side
6+ * Public License, v 1.
187 */
198
209const APACHE_2_0_LICENSE_HEADER = `
@@ -38,6 +27,16 @@ const APACHE_2_0_LICENSE_HEADER = `
3827 */
3928` ;
4029
30+ const DUAL_LICENSE_HEADER = `
31+ /*
32+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
33+ * or more contributor license agreements. Licensed under the Elastic License
34+ * and the Server Side Public License, v 1; you may not use this file except in
35+ * compliance with, at your election, the Elastic License or the Server Side
36+ * Public License, v 1.
37+ */
38+ ` ;
39+
4140const ELASTIC_LICENSE_HEADER = `
4241/*
4342 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -113,12 +112,47 @@ module.exports = {
113112 } ,
114113
115114 /**
116- * Files that require Apache 2.0 headers, settings
115+ * Files that require dual-license headers, settings
117116 * are overridden below for files that require Elastic
118117 * Licence headers
119118 */
120119 {
121- files : [ '**/*.{js,mjs,ts,tsx}' , '!plugins/**/*' ] ,
120+ files : [
121+ '**/*.{js,mjs,ts,tsx}' ,
122+ '!plugins/**/*' ,
123+ '!packages/elastic-datemath/**/*' ,
124+ '!packages/elastic-eslint-config-kibana/**/*' ,
125+ ] ,
126+ rules : {
127+ '@kbn/eslint/require-license-header' : [
128+ 'error' ,
129+ {
130+ license : DUAL_LICENSE_HEADER ,
131+ } ,
132+ ] ,
133+ '@kbn/eslint/disallow-license-headers' : [
134+ 'error' ,
135+ {
136+ licenses : [
137+ APACHE_2_0_LICENSE_HEADER ,
138+ ELASTIC_LICENSE_HEADER ,
139+ SAFER_LODASH_SET_HEADER ,
140+ SAFER_LODASH_SET_LODASH_HEADER ,
141+ SAFER_LODASH_SET_DEFINITELYTYPED_HEADER ,
142+ ] ,
143+ } ,
144+ ] ,
145+ } ,
146+ } ,
147+
148+ /**
149+ * Files that require Apache headers
150+ */
151+ {
152+ files : [
153+ 'packages/elastic-datemath/**/*.{js,mjs,ts,tsx}' ,
154+ 'packages/elastic-eslint-config-kibana/**/*.{js,mjs,ts,tsx}' ,
155+ ] ,
122156 rules : {
123157 '@kbn/eslint/require-license-header' : [
124158 'error' ,
@@ -130,6 +164,7 @@ module.exports = {
130164 'error' ,
131165 {
132166 licenses : [
167+ DUAL_LICENSE_HEADER ,
133168 ELASTIC_LICENSE_HEADER ,
134169 SAFER_LODASH_SET_HEADER ,
135170 SAFER_LODASH_SET_LODASH_HEADER ,
@@ -151,7 +186,7 @@ module.exports = {
151186 } ,
152187
153188 /**
154- * Files that require Elastic license headers instead of Apache 2.0 header
189+ * Files that require Elastic license headers instead of dual-license header
155190 */
156191 {
157192 files : [ 'x-pack/**/*.{js,mjs,ts,tsx}' ] ,
@@ -166,6 +201,7 @@ module.exports = {
166201 'error' ,
167202 {
168203 licenses : [
204+ DUAL_LICENSE_HEADER ,
169205 APACHE_2_0_LICENSE_HEADER ,
170206 SAFER_LODASH_SET_HEADER ,
171207 SAFER_LODASH_SET_LODASH_HEADER ,
@@ -192,6 +228,7 @@ module.exports = {
192228 'error' ,
193229 {
194230 licenses : [
231+ DUAL_LICENSE_HEADER ,
195232 ELASTIC_LICENSE_HEADER ,
196233 APACHE_2_0_LICENSE_HEADER ,
197234 SAFER_LODASH_SET_HEADER ,
@@ -214,6 +251,7 @@ module.exports = {
214251 'error' ,
215252 {
216253 licenses : [
254+ DUAL_LICENSE_HEADER ,
217255 ELASTIC_LICENSE_HEADER ,
218256 APACHE_2_0_LICENSE_HEADER ,
219257 SAFER_LODASH_SET_LODASH_HEADER ,
@@ -236,6 +274,7 @@ module.exports = {
236274 'error' ,
237275 {
238276 licenses : [
277+ DUAL_LICENSE_HEADER ,
239278 ELASTIC_LICENSE_HEADER ,
240279 APACHE_2_0_LICENSE_HEADER ,
241280 SAFER_LODASH_SET_HEADER ,
0 commit comments