From 9b938c0ade470c256123c605e0503bfadf528ee1 Mon Sep 17 00:00:00 2001 From: utarwyn Date: Sat, 22 Jul 2023 23:01:40 +0200 Subject: [PATCH] Add license header in ESLint plugin --- eslint-plugin/.eslintrc.js | 20 +++++++++++++++++++ eslint-plugin/docs/license-header.txt | 17 ++++++++++++++++ eslint-plugin/lib/rule-list.js | 8 +++++--- .../rules/avoid-high-accuracy-geolocation.js | 8 +++++--- .../lib/rules/no-import-all-from-library.js | 8 +++++--- .../rules/no-multiple-access-dom-element.js | 8 +++++--- .../lib/rules/no-multiple-style-changes.js | 8 +++++--- .../prefer-collections-with-pagination.js | 8 +++++--- eslint-plugin/lib/sonar.js | 7 ++++--- eslint-plugin/lib/standalone.js | 7 ++++--- eslint-plugin/package.json | 1 + eslint-plugin/tests/lib/rule-list.test.js | 18 +++++++++++++++++ .../rules/avoid-high-accuracy-geolocation.js | 8 +++++--- .../lib/rules/no-import-all-from-library.js | 8 +++++--- .../rules/no-multiple-access-dom-element.js | 8 +++++--- .../lib/rules/no-multiple-style-changes.js | 8 +++++--- .../prefer-collections-with-pagination.js | 8 +++++--- eslint-plugin/tests/lib/sonar.test.js | 18 +++++++++++++++++ eslint-plugin/tests/lib/standalone.test.js | 18 +++++++++++++++++ eslint-plugin/yarn.lock | 17 ++++++++++++++++ 20 files changed, 172 insertions(+), 39 deletions(-) create mode 100644 eslint-plugin/docs/license-header.txt diff --git a/eslint-plugin/.eslintrc.js b/eslint-plugin/.eslintrc.js index a258335..178b0f7 100644 --- a/eslint-plugin/.eslintrc.js +++ b/eslint-plugin/.eslintrc.js @@ -1,3 +1,21 @@ +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + "use strict"; module.exports = { @@ -8,6 +26,7 @@ module.exports = { "plugin:node/recommended", "plugin:prettier/recommended", ], + plugins: ["license-header"], env: { node: true, }, @@ -19,5 +38,6 @@ module.exports = { ], rules: { "node/no-unpublished-require": "off", + "license-header/header": ["error", "./docs/license-header.txt"], }, }; diff --git a/eslint-plugin/docs/license-header.txt b/eslint-plugin/docs/license-header.txt new file mode 100644 index 0000000..213fdaa --- /dev/null +++ b/eslint-plugin/docs/license-header.txt @@ -0,0 +1,17 @@ +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ diff --git a/eslint-plugin/lib/rule-list.js b/eslint-plugin/lib/rule-list.js index fae2a34..9f8cce8 100644 --- a/eslint-plugin/lib/rule-list.js +++ b/eslint-plugin/lib/rule-list.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,8 +13,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ + "use strict"; const fs = require("fs"); diff --git a/eslint-plugin/lib/rules/avoid-high-accuracy-geolocation.js b/eslint-plugin/lib/rules/avoid-high-accuracy-geolocation.js index 35f0e19..8b3f49c 100644 --- a/eslint-plugin/lib/rules/avoid-high-accuracy-geolocation.js +++ b/eslint-plugin/lib/rules/avoid-high-accuracy-geolocation.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,8 +13,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ + "use strict"; /** @type {import("eslint").Rule.RuleModule} */ diff --git a/eslint-plugin/lib/rules/no-import-all-from-library.js b/eslint-plugin/lib/rules/no-import-all-from-library.js index e96bab7..cc0e1b0 100644 --- a/eslint-plugin/lib/rules/no-import-all-from-library.js +++ b/eslint-plugin/lib/rules/no-import-all-from-library.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,8 +13,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ + "use strict"; /** @type {import("eslint").Rule.RuleModule} */ diff --git a/eslint-plugin/lib/rules/no-multiple-access-dom-element.js b/eslint-plugin/lib/rules/no-multiple-access-dom-element.js index 38a8519..186f1a2 100644 --- a/eslint-plugin/lib/rules/no-multiple-access-dom-element.js +++ b/eslint-plugin/lib/rules/no-multiple-access-dom-element.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,8 +13,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ + "use strict"; /** @type {import("eslint").Rule.RuleModule} */ diff --git a/eslint-plugin/lib/rules/no-multiple-style-changes.js b/eslint-plugin/lib/rules/no-multiple-style-changes.js index b4bd4ef..7cfb011 100644 --- a/eslint-plugin/lib/rules/no-multiple-style-changes.js +++ b/eslint-plugin/lib/rules/no-multiple-style-changes.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,8 +13,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ + "use strict"; /** @type {import("eslint").Rule.RuleModule} */ diff --git a/eslint-plugin/lib/rules/prefer-collections-with-pagination.js b/eslint-plugin/lib/rules/prefer-collections-with-pagination.js index 0ffe9e9..5fe8c26 100644 --- a/eslint-plugin/lib/rules/prefer-collections-with-pagination.js +++ b/eslint-plugin/lib/rules/prefer-collections-with-pagination.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,8 +13,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ + "use strict"; const PAGINATION_KEY_WORDS = ["page", "pagination", "paginated"]; diff --git a/eslint-plugin/lib/sonar.js b/eslint-plugin/lib/sonar.js index d6eed7f..fc236c2 100644 --- a/eslint-plugin/lib/sonar.js +++ b/eslint-plugin/lib/sonar.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /** diff --git a/eslint-plugin/lib/standalone.js b/eslint-plugin/lib/standalone.js index 04ed6a3..8d23003 100644 --- a/eslint-plugin/lib/standalone.js +++ b/eslint-plugin/lib/standalone.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /** diff --git a/eslint-plugin/package.json b/eslint-plugin/package.json index 82cb2d0..d2935e2 100644 --- a/eslint-plugin/package.json +++ b/eslint-plugin/package.json @@ -34,6 +34,7 @@ "eslint-config-prettier": "^8.8.0", "eslint-doc-generator": "^1.4.3", "eslint-plugin-eslint-plugin": "^5.1.1", + "eslint-plugin-license-header": "^0.6.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^5.0.0", "mkdirp": "^3.0.1", diff --git a/eslint-plugin/tests/lib/rule-list.test.js b/eslint-plugin/tests/lib/rule-list.test.js index 6e9683d..78aa817 100644 --- a/eslint-plugin/tests/lib/rule-list.test.js +++ b/eslint-plugin/tests/lib/rule-list.test.js @@ -1,3 +1,21 @@ +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + const assert = require("assert"); describe("rule-list.js", () => { diff --git a/eslint-plugin/tests/lib/rules/avoid-high-accuracy-geolocation.js b/eslint-plugin/tests/lib/rules/avoid-high-accuracy-geolocation.js index f3496ac..09e0077 100644 --- a/eslint-plugin/tests/lib/rules/avoid-high-accuracy-geolocation.js +++ b/eslint-plugin/tests/lib/rules/avoid-high-accuracy-geolocation.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,8 +13,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ + "use strict"; //------------------------------------------------------------------------------ diff --git a/eslint-plugin/tests/lib/rules/no-import-all-from-library.js b/eslint-plugin/tests/lib/rules/no-import-all-from-library.js index 2128555..a1a8772 100644 --- a/eslint-plugin/tests/lib/rules/no-import-all-from-library.js +++ b/eslint-plugin/tests/lib/rules/no-import-all-from-library.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,8 +13,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ + "use strict"; //------------------------------------------------------------------------------ diff --git a/eslint-plugin/tests/lib/rules/no-multiple-access-dom-element.js b/eslint-plugin/tests/lib/rules/no-multiple-access-dom-element.js index 1f65ed6..25fde29 100644 --- a/eslint-plugin/tests/lib/rules/no-multiple-access-dom-element.js +++ b/eslint-plugin/tests/lib/rules/no-multiple-access-dom-element.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,8 +13,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ + "use strict"; //------------------------------------------------------------------------------ diff --git a/eslint-plugin/tests/lib/rules/no-multiple-style-changes.js b/eslint-plugin/tests/lib/rules/no-multiple-style-changes.js index 77d4a80..085828e 100644 --- a/eslint-plugin/tests/lib/rules/no-multiple-style-changes.js +++ b/eslint-plugin/tests/lib/rules/no-multiple-style-changes.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,8 +13,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ + "use strict"; //------------------------------------------------------------------------------ diff --git a/eslint-plugin/tests/lib/rules/prefer-collections-with-pagination.js b/eslint-plugin/tests/lib/rules/prefer-collections-with-pagination.js index 996beee..ca247e3 100644 --- a/eslint-plugin/tests/lib/rules/prefer-collections-with-pagination.js +++ b/eslint-plugin/tests/lib/rules/prefer-collections-with-pagination.js @@ -1,5 +1,6 @@ -/** - * Copyright (C) 2023 Green Code Initiative +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,8 +13,9 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ + "use strict"; //------------------------------------------------------------------------------ diff --git a/eslint-plugin/tests/lib/sonar.test.js b/eslint-plugin/tests/lib/sonar.test.js index fc4f967..d0843e5 100644 --- a/eslint-plugin/tests/lib/sonar.test.js +++ b/eslint-plugin/tests/lib/sonar.test.js @@ -1,3 +1,21 @@ +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + const assert = require("assert"); describe("sonar.js", () => { diff --git a/eslint-plugin/tests/lib/standalone.test.js b/eslint-plugin/tests/lib/standalone.test.js index 24b7afc..88658e2 100644 --- a/eslint-plugin/tests/lib/standalone.test.js +++ b/eslint-plugin/tests/lib/standalone.test.js @@ -1,3 +1,21 @@ +/* + * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs + * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + const assert = require("assert"); describe("standalone.js", () => { diff --git a/eslint-plugin/yarn.lock b/eslint-plugin/yarn.lock index 1bface3..ae0ce84 100644 --- a/eslint-plugin/yarn.lock +++ b/eslint-plugin/yarn.lock @@ -258,6 +258,7 @@ __metadata: eslint-config-prettier: ^8.8.0 eslint-doc-generator: ^1.4.3 eslint-plugin-eslint-plugin: ^5.1.1 + eslint-plugin-license-header: ^0.6.0 eslint-plugin-node: ^11.1.0 eslint-plugin-prettier: ^5.0.0 mkdirp: ^3.0.1 @@ -1578,6 +1579,15 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-license-header@npm:^0.6.0": + version: 0.6.0 + resolution: "eslint-plugin-license-header@npm:0.6.0" + dependencies: + requireindex: ^1.2.0 + checksum: 7508fcedc4059189922e4d8c1e9c416305a8901c6b5f5f1121f107c3b87e216a877d9e268d35268e0cff129d09837619380866984213b7891c824d13555e3406 + languageName: node + linkType: hard + "eslint-plugin-node@npm:^11.1.0": version: 11.1.0 resolution: "eslint-plugin-node@npm:11.1.0" @@ -3966,6 +3976,13 @@ __metadata: languageName: node linkType: hard +"requireindex@npm:^1.2.0": + version: 1.2.0 + resolution: "requireindex@npm:1.2.0" + checksum: 50d8b10a1ff1fdf6aea7a1870bc7bd238b0fb1917d8d7ca17fd03afc38a65dcd7a8a4eddd031f89128b5f0065833d5c92c4fef67f2c04e8624057fe626c9cf94 + languageName: node + linkType: hard + "resolve-from@npm:^4.0.0": version: 4.0.0 resolution: "resolve-from@npm:4.0.0"