mirror of
https://github.com/hexastack/hexabot
synced 2025-04-16 21:56:00 +00:00
Merge pull request #248 from Hexastack/247-issue-eslint-rule-to-automate-adding-copyright-header
247 issue eslint rule to automate adding copyright header
This commit is contained in:
commit
6e58361abf
@ -5,7 +5,7 @@ module.exports = {
|
||||
tsconfigRootDir: __dirname,
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['@typescript-eslint/eslint-plugin', 'import'],
|
||||
plugins: ['@typescript-eslint/eslint-plugin', 'import', 'license-header'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
@ -71,5 +71,19 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
],
|
||||
'license-header/header': [
|
||||
'error',
|
||||
[
|
||||
'/*',
|
||||
' * 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).',
|
||||
' */',
|
||||
],
|
||||
],
|
||||
},
|
||||
};
|
19
api/package-lock.json
generated
19
api/package-lock.json
generated
@ -87,6 +87,7 @@
|
||||
"eslint": "^8.42.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-import-resolver-typescript": "~3.6.1",
|
||||
"eslint-plugin-license-header": "^0.6.1",
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"husky": "^8.0.0",
|
||||
"jest": "^29.5.0",
|
||||
@ -10065,6 +10066,15 @@
|
||||
"strip-bom": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-license-header": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-license-header/-/eslint-plugin-license-header-0.6.1.tgz",
|
||||
"integrity": "sha512-9aIz8q3OaMr1/uQmCGCWySjTs5nEXUJexNegz/8lluNcZbEl82Ag1Vyr1Hu3oIveRW1NbXDPs6nu4zu9mbrmWA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"requireindex": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-prettier": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz",
|
||||
@ -16779,6 +16789,15 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/requireindex": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz",
|
||||
"integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.5"
|
||||
}
|
||||
},
|
||||
"node_modules/resolve": {
|
||||
"version": "1.22.8",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
|
||||
|
@ -108,6 +108,7 @@
|
||||
"eslint": "^8.42.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-import-resolver-typescript": "~3.6.1",
|
||||
"eslint-plugin-license-header": "^0.6.1",
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"husky": "^8.0.0",
|
||||
"jest": "^29.5.0",
|
||||
@ -159,4 +160,4 @@
|
||||
"@/(.*)": "<rootDir>/$1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Copyright © 2024 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).
|
||||
*/
|
||||
|
||||
export interface SubscriberContext {
|
||||
vars?: { [key: string]: any };
|
||||
}
|
||||
|
8
api/src/eventemitter.d.ts
vendored
8
api/src/eventemitter.d.ts
vendored
@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Copyright © 2024 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).
|
||||
*/
|
||||
|
||||
import { type OnEventOptions } from '@nestjs/event-emitter/dist/interfaces';
|
||||
import type { Listener, OnOptions } from 'eventemitter2';
|
||||
import type {
|
||||
|
@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Copyright © 2024 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).
|
||||
*/
|
||||
|
||||
import { BaseBlockPlugin } from './base-block-plugin';
|
||||
import { BaseEventPlugin } from './base-event-plugin';
|
||||
import { BasePlugin } from './base-plugin.service';
|
||||
|
@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Copyright © 2024 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).
|
||||
*/
|
||||
|
||||
export const buildURL = (baseUrl: string, relativePath: string): string => {
|
||||
try {
|
||||
return new URL(relativePath).toString();
|
||||
|
@ -5,6 +5,7 @@
|
||||
* 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).
|
||||
*/
|
||||
|
||||
import crypto from 'crypto';
|
||||
|
||||
/**
|
||||
|
75
frontend/.eslintrc.js
Normal file
75
frontend/.eslintrc.js
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright © 2024 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).
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
plugins: ["@typescript-eslint/eslint-plugin", "import", "license-header"],
|
||||
extends: ["next/core-web-vitals"],
|
||||
rules: {
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
varsIgnorePattern: "^_",
|
||||
caughtErrorsIgnorePattern: "^_",
|
||||
},
|
||||
],
|
||||
"import/newline-after-import": "error",
|
||||
"import/order": [
|
||||
"error",
|
||||
{
|
||||
groups: [
|
||||
"builtin", // Built-in imports (come from NodeJS native) go first
|
||||
"external", // <- External imports
|
||||
"unknown", // <- unknown
|
||||
"index", // <- index imports
|
||||
"internal", // <- Absolute imports
|
||||
"parent", // <- Relative imports, the sibling and parent types they can be mingled together
|
||||
"sibling",
|
||||
],
|
||||
"newlines-between": "always",
|
||||
alphabetize: {
|
||||
/* sort in ascending order. Options: ["ignore", "asc", "desc"] */
|
||||
order: "asc",
|
||||
/* ignore case. Options: [true, false] */
|
||||
caseInsensitive: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
"newline-after-var": "error",
|
||||
"newline-before-return": "error",
|
||||
"no-console": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"object-shorthand": "error",
|
||||
"padding-line-between-statements": [
|
||||
"error",
|
||||
{ blankLine: "never", prev: ["const"], next: "const" },
|
||||
],
|
||||
"react/jsx-curly-brace-presence": "warn",
|
||||
"react/self-closing-comp": "error",
|
||||
"license-header/header": [
|
||||
"error",
|
||||
[
|
||||
"/*",
|
||||
" * 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).',
|
||||
" */",
|
||||
],
|
||||
],
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: "detect",
|
||||
},
|
||||
},
|
||||
};
|
@ -1,52 +0,0 @@
|
||||
{
|
||||
"plugins": ["@typescript-eslint/eslint-plugin", "import"],
|
||||
"extends": ["next/core-web-vitals"],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"argsIgnorePattern": "^_",
|
||||
"varsIgnorePattern": "^_",
|
||||
"caughtErrorsIgnorePattern": "^_"
|
||||
}
|
||||
],
|
||||
"import/newline-after-import": "error",
|
||||
"import/order": [
|
||||
"error",
|
||||
{
|
||||
"groups": [
|
||||
"builtin", // Built-in imports (come from NodeJS native) go first
|
||||
"external", // <- External imports
|
||||
"unknown", // <- unknown
|
||||
"index", // <- index imports
|
||||
"internal", // <- Absolute imports
|
||||
"parent", // <- Relative imports, the sibling and parent types they can be mingled together
|
||||
"sibling"
|
||||
],
|
||||
"newlines-between": "always",
|
||||
"alphabetize": {
|
||||
/* sort in ascending order. Options: ["ignore", "asc", "desc"] */
|
||||
"order": "asc",
|
||||
/* ignore case. Options: [true, false] */
|
||||
"caseInsensitive": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"newline-after-var": "error",
|
||||
"newline-before-return": "error",
|
||||
"no-console": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"object-shorthand": "error",
|
||||
"padding-line-between-statements": [
|
||||
"error",
|
||||
{ "blankLine": "never", "prev": ["const"], "next": "const" }
|
||||
],
|
||||
"react/jsx-curly-brace-presence": "warn",
|
||||
"react/self-closing-comp": "error"
|
||||
},
|
||||
"settings": {
|
||||
"react": {
|
||||
"version": "detect"
|
||||
}
|
||||
}
|
||||
}
|
@ -52,6 +52,7 @@
|
||||
"eslint": "^8.42.0",
|
||||
"eslint-config-next": "14.2.3",
|
||||
"eslint-import-resolver-typescript": "~3.6.1",
|
||||
"eslint-plugin-license-header": "^0.6.1",
|
||||
"random-seed": "^0.3.0",
|
||||
"typescript": "^5.5.3"
|
||||
},
|
||||
|
@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Copyright © 2024 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).
|
||||
*/
|
||||
|
||||
import { CircularProgress, Grid } from "@mui/material";
|
||||
import { FC } from "react";
|
||||
|
||||
|
@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Copyright © 2024 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).
|
||||
*/
|
||||
|
||||
import { css, keyframes } from "@emotion/react";
|
||||
import styled from "@emotion/styled";
|
||||
import {
|
||||
|
@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Copyright © 2024 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).
|
||||
*/
|
||||
|
||||
import {
|
||||
DefaultLinkModel,
|
||||
DefaultLinkModelOptions,
|
||||
|
@ -5,6 +5,7 @@
|
||||
* 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).
|
||||
*/
|
||||
|
||||
import {
|
||||
OptionsObject,
|
||||
enqueueSnackbar,
|
||||
|
@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Copyright © 2024 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).
|
||||
*/
|
||||
|
||||
import { TOptionsBase } from "i18next";
|
||||
|
||||
/*
|
||||
|
@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Copyright © 2024 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).
|
||||
*/
|
||||
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
type ResponseData = {
|
||||
|
19
package-lock.json
generated
19
package-lock.json
generated
@ -86,6 +86,7 @@
|
||||
"eslint": "^8.42.0",
|
||||
"eslint-config-next": "14.2.3",
|
||||
"eslint-import-resolver-typescript": "~3.6.1",
|
||||
"eslint-plugin-license-header": "^0.6.1",
|
||||
"random-seed": "^0.3.0",
|
||||
"typescript": "^5.5.3"
|
||||
},
|
||||
@ -5303,6 +5304,15 @@
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-license-header": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-license-header/-/eslint-plugin-license-header-0.6.1.tgz",
|
||||
"integrity": "sha512-9aIz8q3OaMr1/uQmCGCWySjTs5nEXUJexNegz/8lluNcZbEl82Ag1Vyr1Hu3oIveRW1NbXDPs6nu4zu9mbrmWA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"requireindex": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-react": {
|
||||
"version": "7.35.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.35.0.tgz",
|
||||
@ -8457,6 +8467,15 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/requireindex": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz",
|
||||
"integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.5"
|
||||
}
|
||||
},
|
||||
"node_modules/reselect": {
|
||||
"version": "4.1.8",
|
||||
"resolved": "https://registry.npmjs.org/reselect/-/reselect-4.1.8.tgz",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"plugins": ["@typescript-eslint/eslint-plugin", "import", "react"],
|
||||
"plugins": [
|
||||
"@typescript-eslint/eslint-plugin",
|
||||
"import",
|
||||
"react",
|
||||
"license-header"
|
||||
],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
@ -46,7 +51,19 @@
|
||||
{ "blankLine": "never", "prev": ["const"], "next": "const" }
|
||||
],
|
||||
"react/jsx-curly-brace-presence": "warn",
|
||||
"react/self-closing-comp": "error"
|
||||
"react/self-closing-comp": "error",
|
||||
"license-header/header": [
|
||||
"error",
|
||||
[
|
||||
"/*",
|
||||
" * Copyright © 2024 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).",
|
||||
" */"
|
||||
]
|
||||
]
|
||||
},
|
||||
"settings": {
|
||||
"react": {
|
||||
|
3
widget/src/vite-env.d.ts
vendored
3
widget/src/vite-env.d.ts
vendored
@ -5,3 +5,6 @@
|
||||
* 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).
|
||||
*/
|
||||
|
||||
//added to bypass ESLint issue happing when we add an copyright header in a empty file
|
||||
type empty = never;
|
||||
|
@ -1,32 +1,39 @@
|
||||
/*
|
||||
* Copyright © 2024 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).
|
||||
*/
|
||||
|
||||
import { resolve } from "path";
|
||||
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig } from "vite";
|
||||
import dts from "vite-plugin-dts";
|
||||
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
return {
|
||||
plugins: [react(), dts()],
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
host: "0.0.0.0",
|
||||
},
|
||||
define: {
|
||||
'process.env':
|
||||
mode === 'development' ? { 'process.env': process.env } : {},
|
||||
"process.env":
|
||||
mode === "development" ? { "process.env": process.env } : {},
|
||||
},
|
||||
build: {
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'src/ChatWidget.tsx'),
|
||||
name: 'HexabotWidget',
|
||||
entry: resolve(__dirname, "src/ChatWidget.tsx"),
|
||||
name: "HexabotWidget",
|
||||
fileName: (format) => `hexabot-widget.${format}.js`,
|
||||
},
|
||||
rollupOptions: {
|
||||
external: ['react', 'react-dom'],
|
||||
external: ["react", "react-dom"],
|
||||
output: {
|
||||
globals: {
|
||||
react: 'React',
|
||||
'react-dom': 'ReactDOM',
|
||||
react: "React",
|
||||
"react-dom": "ReactDOM",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user