Skip to content

Commit 6ed8b5f

Browse files
chore(eslint): lint for copyrights on files (#2858)
1 parent de7969f commit 6ed8b5f

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

.eslintrc.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
parser: '@typescript-eslint/parser',
3-
plugins: ['@typescript-eslint'],
3+
plugins: ['@typescript-eslint', 'notice'],
44
parserOptions: {
55
project: './tsconfig.json',
66
ecmaVersion: 9,
@@ -108,6 +108,12 @@ module.exports = {
108108
"beforeColon": false
109109
}],
110110

111+
// copyright
112+
"notice/notice": [2, {
113+
"mustMatch": "Copyright",
114+
"templateFile": "./utils/copyright.js",
115+
}],
116+
111117
// type-aware rules
112118
"@typescript-eslint/no-unnecessary-type-assertion": 2,
113119
}

package-lock.json

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"cross-env": "^5.0.5",
7373
"electron": "^9.0.0-beta.24",
7474
"eslint": "^6.6.0",
75+
"eslint-plugin-notice": "^0.9.10",
7576
"esprima": "^4.0.0",
7677
"formidable": "^1.2.1",
7778
"ncp": "^2.0.0",

utils/copyright.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Copyright (c) Microsoft Corporation.
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+
* http://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+
*/

0 commit comments

Comments
 (0)