diff --git a/frontend/.eslintrc-staged.js b/frontend/.eslintrc-staged.js new file mode 100644 index 00000000..4d49481d --- /dev/null +++ b/frontend/.eslintrc-staged.js @@ -0,0 +1,21 @@ +module.exports = { + extends: './.eslintrc.js', + rules: { + 'header/header': [ + 2, + 'block', + [ + '', + ' * Copyright © ' + + new Date().getFullYear() + + ' Hexastack. All rights reserved.', + ' *', + ' * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:', + ' * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.', + ' * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software\'s "About" section, documentation, and README file).', + ' ', + ], + 2, + ], + }, +}; diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index 5340489e..779cc483 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -8,7 +8,7 @@ module.exports = { root: true, - plugins: ["@typescript-eslint/eslint-plugin", "import", "license-header"], + plugins: ["@typescript-eslint/eslint-plugin", "import", "header"], extends: ["next/core-web-vitals"], rules: { "@typescript-eslint/no-unused-vars": [ @@ -52,19 +52,23 @@ module.exports = { ], "react/jsx-curly-brace-presence": "warn", "react/self-closing-comp": "error", - "license-header/header": [ - "error", + "header/header": [ + 2, + "block", [ - "/*", - " * Copyright © " + - new Date().getFullYear() + - " Hexastack. All rights reserved.", + "", + { + pattern: + "^ \\* Copyright © 20\\d{2} Hexastack. All rights reserved.$", + template: " * Copyright © 2025 Hexastack. All rights reserved.", + }, " *", " * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:", ' * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.', ' * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software\'s "About" section, documentation, and README file).', - " */", + " ", ], + 2, ], }, settings: { diff --git a/frontend/package.json b/frontend/package.json index cdf92661..689a162e 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,6 +13,9 @@ "lint:fix": "next lint --fix", "typecheck": "tsc --noEmit --downlevelIteration" }, + "lint-staged": { + "*.{ts,tsx}": "eslint --fix -c \".eslintrc-staged.js\"" + }, "dependencies": { "@chatscope/chat-ui-kit-react": "^2.0.3", "@chatscope/chat-ui-kit-styles": "^1.4.0", @@ -52,7 +55,8 @@ "eslint": "^8.42.0", "eslint-config-next": "14.2.3", "eslint-import-resolver-typescript": "~3.6.1", - "eslint-plugin-license-header": "^0.6.1", + "eslint-plugin-header": "^3.1.1", + "lint-staged": "^15.3.0", "random-seed": "^0.3.0", "typescript": "^5.5.3" },