[eslint][tslint] require Apache 2.0 license headers

This commit is contained in:
spalger 2018-05-23 18:05:02 -07:00
parent a0cf5c0d39
commit 337fea30b9
3 changed files with 60 additions and 4 deletions

View file

@ -165,6 +165,43 @@ module.exports = {
},
},
/**
* Files that require Apache 2.0 headers, settings
* are overriden below for files that require Elastic
* Licence headers
*/
{
files: ['**/*.js'],
plugins: ['@kbn/eslint-plugin-license-header'],
rules: {
'@kbn/license-header/require-license-header': [
'error',
{
license: dedent`
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
`,
},
],
},
},
/**
* X-Pack global overrides
*/
@ -176,7 +213,7 @@ module.exports = {
},
/**
* Files that require the license headers
* Files that require Elastic license headers instead of Apache 2.0 header
*/
{
files: ['x-pack/**/*.js'],

View file

@ -4,7 +4,29 @@ extends:
rulesDirectory:
- tslint-plugin-prettier
- src/dev/tslint/rules
rules:
prettier: true
no-unused-variable: true
require-license-header:
- true
- |-
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

View file

@ -1,8 +1,5 @@
extends: ../tslint.yaml
rulesDirectory:
- ../src/dev/tslint/rules
rules:
require-license-header:
- true