From a9b7eca07a90619960cde801b8ba32fd5a9f2c75 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 7 Feb 2020 18:58:20 +0100 Subject: [PATCH] Use eslint-plugin-header for license headers (#245) * Configure eslint-plugin-header for license headers * Add missing license file headers --- .eslintrc | 22 ++++++++++++++++++- .../components/panels/background.js | 16 ++++++++++++++ .../components/panels/videoPoster.js | 16 ++++++++++++++ assets/src/edit-story/types.js | 16 ++++++++++++++ assets/src/edit-story/units/dimensions.js | 16 ++++++++++++++ assets/src/edit-story/units/index.js | 16 ++++++++++++++ assets/src/edit-story/units/unitsProvider.js | 16 ++++++++++++++ assets/src/edit-story/units/useUnits.js | 16 ++++++++++++++ .../edit-story/utils/getFirstFrameOfVideo.js | 16 ++++++++++++++ .../src/edit-story/utils/useResizeEffect.js | 16 ++++++++++++++ .../edit-story/utils/useUploadVideoFrame.js | 16 ++++++++++++++ package-lock.json | 6 +++++ package.json | 1 + 13 files changed, 188 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 9a666bf448d0..fd1b32a81c73 100644 --- a/.eslintrc +++ b/.eslintrc @@ -7,7 +7,7 @@ "plugin:prettier/recommended", "prettier/react" ], - "plugins": ["jsx-a11y"], + "plugins": ["jsx-a11y", "header"], "rules": { "block-scoped-var": "error", "complexity": ["error", {"max": 20}], @@ -25,6 +25,26 @@ "no-new": "error", "no-new-func": "error", "no-new-wrappers": "error", + "header/header": [ "error", "block", [ + "", + { + "pattern": " \\* Copyright \\d{4} Google LLC", + "template": " * Copyright 2020 Google LLC" + }, + " *", + " * Licensed 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", + " *", + " * https://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.", + " " + ] ], "import/no-restricted-paths": [ "error", { "zones": [ { "target": "./assets/src/edit-story/migration/migrations", diff --git a/assets/src/edit-story/components/panels/background.js b/assets/src/edit-story/components/panels/background.js index b1253ddc8383..14b8d47db180 100644 --- a/assets/src/edit-story/components/panels/background.js +++ b/assets/src/edit-story/components/panels/background.js @@ -1,3 +1,19 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed 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 + * + * https://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. + */ + /** * External dependencies */ diff --git a/assets/src/edit-story/components/panels/videoPoster.js b/assets/src/edit-story/components/panels/videoPoster.js index 52f010b32fbf..ef6db2f493d9 100644 --- a/assets/src/edit-story/components/panels/videoPoster.js +++ b/assets/src/edit-story/components/panels/videoPoster.js @@ -1,3 +1,19 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed 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 + * + * https://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. + */ + /** * External dependencies */ diff --git a/assets/src/edit-story/types.js b/assets/src/edit-story/types.js index f92fe706af48..f459985deef8 100644 --- a/assets/src/edit-story/types.js +++ b/assets/src/edit-story/types.js @@ -1,3 +1,19 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed 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 + * + * https://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. + */ + /** * External dependencies */ diff --git a/assets/src/edit-story/units/dimensions.js b/assets/src/edit-story/units/dimensions.js index 078cf7be6c57..d9a3ec31425e 100644 --- a/assets/src/edit-story/units/dimensions.js +++ b/assets/src/edit-story/units/dimensions.js @@ -1,3 +1,19 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed 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 + * + * https://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. + */ + /** * Internal dependencies */ diff --git a/assets/src/edit-story/units/index.js b/assets/src/edit-story/units/index.js index bec1abb8b6dd..915ebba55a05 100644 --- a/assets/src/edit-story/units/index.js +++ b/assets/src/edit-story/units/index.js @@ -1,3 +1,19 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed 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 + * + * https://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. + */ + export { default as UnitsProvider } from './unitsProvider'; export { default as useUnits } from './useUnits'; export { diff --git a/assets/src/edit-story/units/unitsProvider.js b/assets/src/edit-story/units/unitsProvider.js index a612948b6c4e..9977063d623d 100644 --- a/assets/src/edit-story/units/unitsProvider.js +++ b/assets/src/edit-story/units/unitsProvider.js @@ -1,3 +1,19 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed 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 + * + * https://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. + */ + /** * WordPress dependencies */ diff --git a/assets/src/edit-story/units/useUnits.js b/assets/src/edit-story/units/useUnits.js index 5cf243af80fb..d04142ba3978 100644 --- a/assets/src/edit-story/units/useUnits.js +++ b/assets/src/edit-story/units/useUnits.js @@ -1,3 +1,19 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed 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 + * + * https://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. + */ + /** * WordPress dependencies */ diff --git a/assets/src/edit-story/utils/getFirstFrameOfVideo.js b/assets/src/edit-story/utils/getFirstFrameOfVideo.js index 80450af379e6..70b879f588c7 100644 --- a/assets/src/edit-story/utils/getFirstFrameOfVideo.js +++ b/assets/src/edit-story/utils/getFirstFrameOfVideo.js @@ -1,3 +1,19 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed 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 + * + * https://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. + */ + /** * Returns an image of the first frame of a given video. * diff --git a/assets/src/edit-story/utils/useResizeEffect.js b/assets/src/edit-story/utils/useResizeEffect.js index 61eef90352e0..5707c7a0bbbf 100644 --- a/assets/src/edit-story/utils/useResizeEffect.js +++ b/assets/src/edit-story/utils/useResizeEffect.js @@ -1,3 +1,19 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed 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 + * + * https://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. + */ + /** * External dependencies */ diff --git a/assets/src/edit-story/utils/useUploadVideoFrame.js b/assets/src/edit-story/utils/useUploadVideoFrame.js index 557ac1051852..d6cc942d4599 100644 --- a/assets/src/edit-story/utils/useUploadVideoFrame.js +++ b/assets/src/edit-story/utils/useUploadVideoFrame.js @@ -1,3 +1,19 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed 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 + * + * https://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. + */ + /** * WordPress dependencies */ diff --git a/package-lock.json b/package-lock.json index 7f0e2df12545..7548f02351e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11094,6 +11094,12 @@ } } }, + "eslint-plugin-header": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.0.0.tgz", + "integrity": "sha512-OIu2ciVW8jK4Ove4JHm1I7X0C98PZuLCyCsoUhAm2HpyGS+zr34qLM6iV06unnDvssvvEh5BkOfaLRF+N7cGoQ==", + "dev": true + }, "eslint-plugin-import": { "version": "2.20.1", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz", diff --git a/package.json b/package.json index f5ffe19f5446..e0b3c15c19c1 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "eslint": "^6.8.0", "eslint-config-prettier": "^6.10.0", "eslint-plugin-eslint-comments": "^3.1.2", + "eslint-plugin-header": "^3.0.0", "eslint-plugin-import": "^2.20.1", "eslint-plugin-jest": "^23.6.0", "eslint-plugin-jsx-a11y": "^6.2.3",