Compare commits
2 commits
2d15095bd6
...
911cd6e0c8
| Author | SHA1 | Date | |
|---|---|---|---|
| 911cd6e0c8 | |||
| 4ef243bcad |
7 changed files with 161 additions and 98 deletions
|
|
@ -1,19 +1,17 @@
|
|||
{
|
||||
"root": false,
|
||||
"$schema": "../node_modules/@biomejs/biome/configuration_schema.json",
|
||||
"root": false,
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"suspicious": {
|
||||
"noDoubleEquals": "off",
|
||||
"noExplicitAny": "off",
|
||||
"noDebugger": "off",
|
||||
"noApproximativeNumericConstant": "off",
|
||||
"noAsyncPromiseExecutor": "off"
|
||||
"correctness": {
|
||||
"noUnusedVariables": "error",
|
||||
"noUnusedImports": "error",
|
||||
"noEmptyPattern": "error",
|
||||
"useExhaustiveDependencies": "off"
|
||||
},
|
||||
"style": {
|
||||
"noUselessElse": "off",
|
||||
"noParameterAssign": "error",
|
||||
"useAsConstAssertion": "error",
|
||||
"useDefaultParameterLast": "error",
|
||||
|
|
@ -24,25 +22,21 @@
|
|||
"useNumberNamespace": "error",
|
||||
"noInferrableTypes": "error"
|
||||
},
|
||||
"complexity": {
|
||||
"noBannedTypes": "off",
|
||||
"noForEach": "off",
|
||||
"useLiteralKeys": "off",
|
||||
"noUselessConstructor": "off",
|
||||
"useArrowFunction": "off",
|
||||
"useDateNow":"off",
|
||||
"noUselessFragments":"off"
|
||||
"suspicious": {
|
||||
"noDebugger": "error",
|
||||
"noDoubleEquals": "off",
|
||||
"noExplicitAny": "off",
|
||||
"noApproximativeNumericConstant": "warn",
|
||||
"noAsyncPromiseExecutor": "warn"
|
||||
},
|
||||
"correctness": {
|
||||
"noEmptyPattern": "off",
|
||||
"noUnusedVariables": "error",
|
||||
"noUnusedImports": "off",
|
||||
"useExhaustiveDependencies":"off"
|
||||
|
||||
|
||||
"complexity": {
|
||||
"noUselessConstructor": "error",
|
||||
"noBannedTypes": "warn",
|
||||
"useArrowFunction": "warn",
|
||||
"useDateNow": "off"
|
||||
},
|
||||
"performance": {
|
||||
"noAccumulatingSpread": "off"
|
||||
"noAccumulatingSpread": "warn"
|
||||
},
|
||||
"a11y": {
|
||||
"useSemanticElements": "off"
|
||||
|
|
@ -50,15 +44,15 @@
|
|||
}
|
||||
},
|
||||
"formatter": {
|
||||
"indentWidth": 2,
|
||||
"enabled": true,
|
||||
"indentStyle": "space",
|
||||
"enabled": true
|
||||
"indentWidth": 2
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"semicolons": "asNeeded",
|
||||
"arrowParentheses": "always",
|
||||
"enabled": true,
|
||||
"bracketSameLine": false,
|
||||
"trailingCommas": "all",
|
||||
"attributePosition": "multiline"
|
||||
|
|
|
|||
81
README.md
81
README.md
|
|
@ -1 +1,80 @@
|
|||
# comuns
|
||||
## ✅ Uso do BiomeJS para Autoformatação
|
||||
|
||||
Este guia mostra como configurar o [BiomeJS](https://biomejs.dev) para formatar e analisar código JavaScript/TypeScript no seu projeto.
|
||||
|
||||
---
|
||||
|
||||
### 1. Incluir o pacote de configuração comum
|
||||
|
||||
Certifique-se de que o pacote `p-comuns` (ou outro com a configuração compartilhada) esteja disponível no seu projeto. Ele deve conter o arquivo `Documentos/biome.json`.
|
||||
|
||||
---
|
||||
|
||||
### 2. Instalar o Biome com `pnpm`
|
||||
|
||||
```bash
|
||||
pnpm add --save-dev --save-exact @biomejs/biome@2.1.4
|
||||
```
|
||||
|
||||
> 🎯 Use `--save-exact` para garantir consistência de versões entre ambientes.
|
||||
|
||||
---
|
||||
|
||||
### 3. Criar o arquivo de configuração na raiz do projeto
|
||||
|
||||
Crie um arquivo chamado `biome.json` com o seguinte conteúdo:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
||||
"extends": ["./node_modules/p-comuns/Documentos/biome.json"],
|
||||
"files": {
|
||||
"includes": ["src/**/*.{js,ts,jsx,tsx}"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> ⚠️ Verifique o caminho correto do `extends` relativo à raiz do seu projeto. Use `./` sempre que possível para evitar erros de resolução.
|
||||
|
||||
---
|
||||
|
||||
### 4. Adicionar script no `package.json`
|
||||
|
||||
Inclua o comando abaixo em `"scripts"`:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"biome": "pnpm exec biome check --write"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Isso permite executar:
|
||||
|
||||
```bash
|
||||
pnpm biome
|
||||
```
|
||||
|
||||
> O comando irá **formatar e aplicar as regras de lint** nos arquivos do diretório `src/`.
|
||||
|
||||
---
|
||||
|
||||
### ✅ Dica extra: formatar todos os arquivos
|
||||
|
||||
Se quiser aplicar o Biome a todo o projeto (não só `src/`), altere o include:
|
||||
|
||||
```json
|
||||
"includes": ["**/*.{js,ts,jsx,tsx}"]
|
||||
```
|
||||
|
||||
|
||||
|
||||
adicionar em .vscode/settings.json
|
||||
|
||||
{
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports.biome": "always",
|
||||
"source.fixAll.biome": "always"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
18
biome.json
18
biome.json
|
|
@ -1,21 +1,7 @@
|
|||
{
|
||||
"$schema": "node_modules/@biomejs/biome/configuration_schema.json",
|
||||
"extends": ["Documentos/biome.json"],
|
||||
"files": {},
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": {
|
||||
"noParameterAssign": "error",
|
||||
"useAsConstAssertion": "error",
|
||||
"useDefaultParameterLast": "error",
|
||||
"useEnumInitializers": "error",
|
||||
"useSelfClosingElements": "error",
|
||||
"useSingleVarDeclarator": "error",
|
||||
"noUnusedTemplateLiteral": "error",
|
||||
"useNumberNamespace": "error",
|
||||
"noInferrableTypes": "error",
|
||||
"noUselessElse": "error"
|
||||
}
|
||||
}
|
||||
"files": {
|
||||
"includes": ["src/**/*.{js,ts,jsx,tsx}"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "p-comuns",
|
||||
"version": "0.209.0",
|
||||
"version": "0.211.0",
|
||||
"description": "",
|
||||
"main": "./dist-back/index.js",
|
||||
"module": "./dist-front/index.mjs",
|
||||
|
|
@ -13,9 +13,9 @@
|
|||
}
|
||||
},
|
||||
"scripts": {
|
||||
"biome": "npx @biomejs/biome check --write ./src",
|
||||
"biome": "pnpm exec biome check --write",
|
||||
"check": "pnpm run biome && npx tsc --noEmit",
|
||||
"build": "npm --no-git-tag-version version minor && pnpm run check && tsup --config ./tsup/tsup.config.ts"
|
||||
"build": "npm --no-git-tag-version version minor && pnpm run biome && tsup --config ./tsup/tsup.config.ts"
|
||||
},
|
||||
"author": {
|
||||
"name": "AZTECA SOFTWARE LTDA",
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
"zod": "3.24.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.0.6",
|
||||
"@biomejs/biome": "2.1.4",
|
||||
"@types/node": "^20.19.9",
|
||||
"tsup": "8.5.0",
|
||||
"typescript": "~5.9.2"
|
||||
|
|
|
|||
74
pnpm-lock.yaml
generated
74
pnpm-lock.yaml
generated
|
|
@ -22,8 +22,8 @@ importers:
|
|||
version: 3.24.1
|
||||
devDependencies:
|
||||
'@biomejs/biome':
|
||||
specifier: 2.0.6
|
||||
version: 2.0.6
|
||||
specifier: 2.1.4
|
||||
version: 2.1.4
|
||||
'@types/node':
|
||||
specifier: ^20.19.9
|
||||
version: 20.19.9
|
||||
|
|
@ -36,55 +36,55 @@ importers:
|
|||
|
||||
packages:
|
||||
|
||||
'@biomejs/biome@2.0.6':
|
||||
resolution: {integrity: sha512-RRP+9cdh5qwe2t0gORwXaa27oTOiQRQvrFf49x2PA1tnpsyU7FIHX4ZOFMtBC4QNtyWsN7Dqkf5EDbg4X+9iqA==}
|
||||
'@biomejs/biome@2.1.4':
|
||||
resolution: {integrity: sha512-QWlrqyxsU0FCebuMnkvBIkxvPqH89afiJzjMl+z67ybutse590jgeaFdDurE9XYtzpjRGTI1tlUZPGWmbKsElA==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
hasBin: true
|
||||
|
||||
'@biomejs/cli-darwin-arm64@2.0.6':
|
||||
resolution: {integrity: sha512-AzdiNNjNzsE6LfqWyBvcL29uWoIuZUkndu+wwlXW13EKcBHbbKjNQEZIJKYDc6IL+p7bmWGx3v9ZtcRyIoIz5A==}
|
||||
'@biomejs/cli-darwin-arm64@2.1.4':
|
||||
resolution: {integrity: sha512-sCrNENE74I9MV090Wq/9Dg7EhPudx3+5OiSoQOkIe3DLPzFARuL1dOwCWhKCpA3I5RHmbrsbNSRfZwCabwd8Qg==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@biomejs/cli-darwin-x64@2.0.6':
|
||||
resolution: {integrity: sha512-wJjjP4E7bO4WJmiQaLnsdXMa516dbtC6542qeRkyJg0MqMXP0fvs4gdsHhZ7p9XWTAmGIjZHFKXdsjBvKGIJJQ==}
|
||||
'@biomejs/cli-darwin-x64@2.1.4':
|
||||
resolution: {integrity: sha512-gOEICJbTCy6iruBywBDcG4X5rHMbqCPs3clh3UQ+hRKlgvJTk4NHWQAyHOXvaLe+AxD1/TNX1jbZeffBJzcrOw==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@biomejs/cli-linux-arm64-musl@2.0.6':
|
||||
resolution: {integrity: sha512-CVPEMlin3bW49sBqLBg2x016Pws7eUXA27XYDFlEtponD0luYjg2zQaMJ2nOqlkKG9fqzzkamdYxHdMDc2gZFw==}
|
||||
'@biomejs/cli-linux-arm64-musl@2.1.4':
|
||||
resolution: {integrity: sha512-nYr7H0CyAJPaLupFE2cH16KZmRC5Z9PEftiA2vWxk+CsFkPZQ6dBRdcC6RuS+zJlPc/JOd8xw3uCCt9Pv41WvQ==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@biomejs/cli-linux-arm64@2.0.6':
|
||||
resolution: {integrity: sha512-ZSVf6TYo5rNMUHIW1tww+rs/krol7U5A1Is/yzWyHVZguuB0lBnIodqyFuwCNqG9aJGyk7xIMS8HG0qGUPz0SA==}
|
||||
'@biomejs/cli-linux-arm64@2.1.4':
|
||||
resolution: {integrity: sha512-juhEkdkKR4nbUi5k/KRp1ocGPNWLgFRD4NrHZSveYrD6i98pyvuzmS9yFYgOZa5JhaVqo0HPnci0+YuzSwT2fw==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@biomejs/cli-linux-x64-musl@2.0.6':
|
||||
resolution: {integrity: sha512-mKHE/e954hR/hSnAcJSjkf4xGqZc/53Kh39HVW1EgO5iFi0JutTN07TSjEMg616julRtfSNJi0KNyxvc30Y4rQ==}
|
||||
'@biomejs/cli-linux-x64-musl@2.1.4':
|
||||
resolution: {integrity: sha512-lvwvb2SQQHctHUKvBKptR6PLFCM7JfRjpCCrDaTmvB7EeZ5/dQJPhTYBf36BE/B4CRWR2ZiBLRYhK7hhXBCZAg==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@biomejs/cli-linux-x64@2.0.6':
|
||||
resolution: {integrity: sha512-geM1MkHTV1Kh2Cs/Xzot9BOF3WBacihw6bkEmxkz4nSga8B9/hWy5BDiOG3gHDGIBa8WxT0nzsJs2f/hPqQIQw==}
|
||||
'@biomejs/cli-linux-x64@2.1.4':
|
||||
resolution: {integrity: sha512-Eoy9ycbhpJVYuR+LskV9s3uyaIkp89+qqgqhGQsWnp/I02Uqg2fXFblHJOpGZR8AxdB9ADy87oFVxn9MpFKUrw==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@biomejs/cli-win32-arm64@2.0.6':
|
||||
resolution: {integrity: sha512-290V4oSFoKaprKE1zkYVsDfAdn0An5DowZ+GIABgjoq1ndhvNxkJcpxPsiYtT7slbVe3xmlT0ncdfOsN7KruzA==}
|
||||
'@biomejs/cli-win32-arm64@2.1.4':
|
||||
resolution: {integrity: sha512-3WRYte7orvyi6TRfIZkDN9Jzoogbv+gSvR+b9VOXUg1We1XrjBg6WljADeVEaKTvOcpVdH0a90TwyOQ6ue4fGw==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@biomejs/cli-win32-x64@2.0.6':
|
||||
resolution: {integrity: sha512-bfM1Bce0d69Ao7pjTjUS+AWSZ02+5UHdiAP85Th8e9yV5xzw6JrHXbL5YWlcEKQ84FIZMdDc7ncuti1wd2sdbw==}
|
||||
'@biomejs/cli-win32-x64@2.1.4':
|
||||
resolution: {integrity: sha512-tBc+W7anBPSFXGAoQW+f/+svkpt8/uXfRwDzN1DvnatkRMt16KIYpEi/iw8u9GahJlFv98kgHcIrSsZHZTR0sw==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
|
@ -747,39 +747,39 @@ packages:
|
|||
|
||||
snapshots:
|
||||
|
||||
'@biomejs/biome@2.0.6':
|
||||
'@biomejs/biome@2.1.4':
|
||||
optionalDependencies:
|
||||
'@biomejs/cli-darwin-arm64': 2.0.6
|
||||
'@biomejs/cli-darwin-x64': 2.0.6
|
||||
'@biomejs/cli-linux-arm64': 2.0.6
|
||||
'@biomejs/cli-linux-arm64-musl': 2.0.6
|
||||
'@biomejs/cli-linux-x64': 2.0.6
|
||||
'@biomejs/cli-linux-x64-musl': 2.0.6
|
||||
'@biomejs/cli-win32-arm64': 2.0.6
|
||||
'@biomejs/cli-win32-x64': 2.0.6
|
||||
'@biomejs/cli-darwin-arm64': 2.1.4
|
||||
'@biomejs/cli-darwin-x64': 2.1.4
|
||||
'@biomejs/cli-linux-arm64': 2.1.4
|
||||
'@biomejs/cli-linux-arm64-musl': 2.1.4
|
||||
'@biomejs/cli-linux-x64': 2.1.4
|
||||
'@biomejs/cli-linux-x64-musl': 2.1.4
|
||||
'@biomejs/cli-win32-arm64': 2.1.4
|
||||
'@biomejs/cli-win32-x64': 2.1.4
|
||||
|
||||
'@biomejs/cli-darwin-arm64@2.0.6':
|
||||
'@biomejs/cli-darwin-arm64@2.1.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-darwin-x64@2.0.6':
|
||||
'@biomejs/cli-darwin-x64@2.1.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-linux-arm64-musl@2.0.6':
|
||||
'@biomejs/cli-linux-arm64-musl@2.1.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-linux-arm64@2.0.6':
|
||||
'@biomejs/cli-linux-arm64@2.1.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-linux-x64-musl@2.0.6':
|
||||
'@biomejs/cli-linux-x64-musl@2.1.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-linux-x64@2.0.6':
|
||||
'@biomejs/cli-linux-x64@2.1.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-win32-arm64@2.0.6':
|
||||
'@biomejs/cli-win32-arm64@2.1.4':
|
||||
optional: true
|
||||
|
||||
'@biomejs/cli-win32-x64@2.0.6':
|
||||
'@biomejs/cli-win32-x64@2.1.4':
|
||||
optional: true
|
||||
|
||||
'@esbuild/aix-ppc64@0.25.8':
|
||||
|
|
|
|||
|
|
@ -1,25 +1,29 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
/* Linguagem e Ambiente */
|
||||
"target": "ES2020", /* Define a versão do JavaScript para o código emitido. */
|
||||
"lib": ["dom.iterable"], /* Especifica as bibliotecas padrão a serem incluídas, como DOM para iteradores. */
|
||||
"experimentalDecorators": true, /* Habilita o suporte experimental a decoradores. */
|
||||
"emitDecoratorMetadata": true, /* Emite metadados de tipos de design para declarações decoradas. */
|
||||
"target": "ES2020" /* Define a versão do JavaScript para o código emitido. */,
|
||||
"lib": [
|
||||
"dom.iterable"
|
||||
] /* Especifica as bibliotecas padrão a serem incluídas, como DOM para iteradores. */,
|
||||
"experimentalDecorators": true /* Habilita o suporte experimental a decoradores. */,
|
||||
"emitDecoratorMetadata": true /* Emite metadados de tipos de design para declarações decoradas. */,
|
||||
|
||||
/* Módulos */
|
||||
"moduleResolution": "node", /* Define como o TypeScript resolve módulos. */
|
||||
"rootDir": "./src", /* Define a pasta raiz para os arquivos de origem. */
|
||||
"moduleResolution": "node" /* Define como o TypeScript resolve módulos. */,
|
||||
"rootDir": "./src" /* Define a pasta raiz para os arquivos de origem. */,
|
||||
|
||||
/* Emissão */
|
||||
"declaration": true, /* Gera arquivos .d.ts para os arquivos TypeScript. */
|
||||
"declaration": true /* Gera arquivos .d.ts para os arquivos TypeScript. */,
|
||||
|
||||
/* Interoperabilidade de Módulos */
|
||||
"esModuleInterop": true, /* Habilita a compatibilidade com módulos CommonJS ao importar. */
|
||||
"forceConsistentCasingInFileNames": true,/* Garante consistência na diferenciação entre maiúsculas e minúsculas em nomes de arquivos. */
|
||||
"esModuleInterop": true /* Habilita a compatibilidade com módulos CommonJS ao importar. */,
|
||||
"forceConsistentCasingInFileNames": true /* Garante consistência na diferenciação entre maiúsculas e minúsculas em nomes de arquivos. */,
|
||||
|
||||
/* Verificação de Tipos */
|
||||
"strict": true, /* Habilita todas as opções de verificação estrita de tipos. */
|
||||
"strict": true /* Habilita todas as opções de verificação estrita de tipos. */,
|
||||
"skipLibCheck": true /* Ignora a verificação de tipos em arquivos de declaração de bibliotecas. */
|
||||
},
|
||||
"include": ["src/**/*"] /* Inclui todos os arquivos TypeScript dentro da pasta src. */
|
||||
"include": [
|
||||
"src/**/*"
|
||||
] /* Inclui todos os arquivos TypeScript dentro da pasta src. */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// tsup.config.ts (Configuração Ajustada para Back-end)
|
||||
import { defineConfig, type Options } from "tsup"
|
||||
import { defineConfig } from "tsup"
|
||||
import { tsup_config_back } from "./tsup.config.back"
|
||||
import { tsup_config_front } from "./tsup.config.front"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue