Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-09-27 17:02:02 +02:00
parent 8f09caeb35
commit 67d141b0e5
25 changed files with 3281 additions and 232 deletions

View File

@ -0,0 +1,7 @@
/node_modules/**
/dist/**
/static/**
/public/**
/tmp/**
/coverage/**
/custom/**

View File

@ -0,0 +1,214 @@
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:import/typescript",
"plugin:compat/recommended"
],
"env": {
"browser": true,
"node": true,
"es6": true,
"jest": true
},
"globals": {
"ATTACHMENT_HOST": false
},
"plugins": [
"import",
"promise",
"@typescript-eslint"
],
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true
},
"ecmaVersion": 2018
},
"settings": {
"import/extensions": [
".js",
".cjs",
".mjs",
".ts"
],
"import/ignore": [
"node_modules",
"\\.(css|scss|json)$"
],
"import/resolver": {
"typescript": true,
"node": true
},
"polyfills": [
"es:all",
"fetch",
"IntersectionObserver",
"Promise",
"ResizeObserver",
"URL",
"URLSearchParams"
],
"tailwindcss": {
"config": "tailwind.config.ts"
}
},
"rules": {
"brace-style": "error",
"comma-dangle": [
"error",
"always-multiline"
],
"comma-spacing": [
"warn",
{
"before": false,
"after": true
}
],
"comma-style": [
"warn",
"last"
],
"import/no-duplicates": "error",
"space-before-function-paren": [
"error",
"never"
],
"space-infix-ops": "error",
"space-in-parens": [
"error",
"never"
],
"keyword-spacing": "error",
"dot-notation": "error",
"eqeqeq": "error",
"indent": [
"error",
2,
{
"SwitchCase": 1,
"ignoredNodes": [
"TemplateLiteral"
]
}
],
"key-spacing": [
"error",
{
"mode": "minimum"
}
],
"no-catch-shadow": "error",
"no-cond-assign": "error",
"no-console": [
"warn",
{
"allow": [
"error",
"warn"
]
}
],
"no-extra-semi": "error",
"no-const-assign": "error",
"no-fallthrough": "error",
"no-irregular-whitespace": "error",
"no-loop-func": "error",
"no-mixed-spaces-and-tabs": "error",
"no-nested-ternary": "warn",
"no-trailing-spaces": "warn",
"no-undef": "error",
"no-unreachable": "error",
"no-unused-expressions": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"vars": "all",
"args": "none",
"ignoreRestSiblings": true
}
],
"no-useless-escape": "warn",
"no-var": "error",
"object-curly-spacing": [
"error",
"always"
],
"padded-blocks": [
"error",
{
"classes": "always"
}
],
"prefer-const": "error",
"quotes": [
"error",
"single"
],
"semi": "error",
"space-unary-ops": [
"error",
{
"words": true,
"nonwords": false
}
],
"strict": "off",
"valid-typeof": "error",
"import/extensions": [
"error",
"always",
{
"js": "never",
"mjs": "ignorePackages",
"ts": "never"
}
],
"import/newline-after-import": "error",
"import/no-extraneous-dependencies": "error",
"import/no-unresolved": "error",
"import/no-webpack-loader-syntax": "error",
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type"
],
"newlines-between": "always",
"alphabetize": {
"order": "asc"
}
}
],
"@typescript-eslint/member-delimiter-style": "error",
"promise/catch-or-return": "error",
"sort-imports": [
"error",
{
"ignoreCase": true,
"ignoreDeclarationSort": true
}
],
"eol-last": "error"
},
"overrides": [
{
"files": ["**/*.ts"],
"rules": {
"no-undef": "off",
"space-before-function-paren": "off"
},
"parser": "@typescript-eslint/parser"
}
]
}

24
packages/pl-hooks/.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@ -0,0 +1,18 @@
# `pl-hooks`
> This project should be considered unstable before the 1.0.0 release. I will not provide any changelog or information on breaking changes until then.
## License
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>pl-hooks</title>
</head>
<body>
<script type="module" src="/lib/main.ts"></script>
</body>
</html>

View File

View File

@ -0,0 +1,40 @@
{
"name": "pl-hooks",
"version": "0.0.1",
"type": "module",
"homepage": "https://github.com/mkljczk/pl-fe/tree/fork/packages/pl-hooks",
"repository": {
"type": "git",
"url": "https://github.com/mkljczk/pl-fe"
},
"bugs": {
"url": "https://github.com/mkljczk/pl-fe/issues"
},
"scripts": {
"dev": "vite",
"build": "tsc --p ./tsconfig-build.json && vite build",
"preview": "vite preview",
"lint": "npx eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx . --cache"
},
"license": "AGPL-3.0-or-later",
"devDependencies": {
"@types/node": "^20.14.12",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.0.0",
"eslint": "^8.49.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-compat": "^6.0.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-promise": "^6.0.0",
"typescript": "^5.6.2",
"vite": "^5.4.0",
"vite-plugin-dts": "^4.2.1"
},
"dependencies": {
},
"module": "./dist/main.es.js",
"types": "dist/main.d.ts",
"files": [
"dist"
]
}

View File

@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["lib"]
}

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src", "lib"]
}

View File

@ -0,0 +1,19 @@
import { resolve } from 'path';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
export default defineConfig({
plugins: [dts({ include: ['lib'], insertTypesEntry: true })],
build: {
copyPublicDir: false,
lib: {
entry: resolve(__dirname, 'lib/main.ts'),
fileName: (format) => `main.${format}.js`,
formats: ['es'],
name: 'pl-api',
},
target: 'esnext',
sourcemap: true,
},
});

2556
packages/pl-hooks/yarn.lock Normal file

File diff suppressed because it is too large Load Diff