@whoisfreire/eslint-config 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +127 -0
- package/node.mjs +2 -1
- package/package.json +2 -1
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# @whoisfreire/eslint-config
|
|
2
|
+
|
|
3
|
+
Configuração customizada de ESLint para projetos WhoIsFreire. Baseada na configuração customizada de ESLint da Rocketseat.
|
|
4
|
+
|
|
5
|
+
Inclui:
|
|
6
|
+
|
|
7
|
+
- **ESLint** recommended
|
|
8
|
+
- **TypeScript ESLint** (typescript-eslint)
|
|
9
|
+
- **Neostandard** (estilo Standard com suporte a flat config)
|
|
10
|
+
- Regras de estilo (max-len, array-bracket-spacing, space-before-function-paren)
|
|
11
|
+
|
|
12
|
+
## Requisitos
|
|
13
|
+
|
|
14
|
+
- **ESLint** >= 9 (usa [flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new))
|
|
15
|
+
- **TypeScript** >= 5 (opcional; necessário apenas em projetos TypeScript)
|
|
16
|
+
|
|
17
|
+
## Instalação
|
|
18
|
+
|
|
19
|
+
Com **pnpm**:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add -D eslint @whoisfreire/eslint-config
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Com **npm**:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install -D eslint @whoisfreire/eslint-config
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Com **yarn**:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
yarn add -D eslint @whoisfreire/eslint-config
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Para projetos **TypeScript**, instale também o TypeScript como dependência de desenvolvimento:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm add -D typescript
|
|
41
|
+
# ou: npm install -D typescript
|
|
42
|
+
# ou: yarn add -D typescript
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Configuração
|
|
46
|
+
|
|
47
|
+
### 1. Usar apenas a config base
|
|
48
|
+
|
|
49
|
+
Crie um arquivo `eslint.config.mjs` na raiz do projeto:
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
import config from '@whoisfreire/eslint-config'
|
|
53
|
+
|
|
54
|
+
export default config
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2. Estender e customizar
|
|
58
|
+
|
|
59
|
+
Você pode estender a configuração e adicionar suas próprias regras ou arquivos:
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
import config from '@whoisfreire/eslint-config'
|
|
63
|
+
|
|
64
|
+
export default [
|
|
65
|
+
...config,
|
|
66
|
+
{
|
|
67
|
+
languageOptions: {
|
|
68
|
+
parserOptions: {
|
|
69
|
+
ecmaVersion: 'latest',
|
|
70
|
+
sourceType: 'module',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
rules: {
|
|
74
|
+
// suas regras adicionais
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 3. Configuração para Node.js
|
|
81
|
+
|
|
82
|
+
O pacote exporta também uma config específica para ambiente Node (com globals do Node e regras ajustadas). Para usar:
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
import config from '@whoisfreire/eslint-config/node.mjs'
|
|
86
|
+
|
|
87
|
+
export default config
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Ou combinando com a base e outros ajustes:
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
import baseConfig from '@whoisfreire/eslint-config'
|
|
94
|
+
import nodeConfig from '@whoisfreire/eslint-config/node.mjs'
|
|
95
|
+
|
|
96
|
+
export default [
|
|
97
|
+
...baseConfig,
|
|
98
|
+
...nodeConfig,
|
|
99
|
+
// suas customizações
|
|
100
|
+
]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Nota:** A config Node inclui o pacote `globals` como dependência do pacote; não é necessário instalá-lo no seu projeto.
|
|
104
|
+
|
|
105
|
+
## Estrutura do pacote
|
|
106
|
+
|
|
107
|
+
| Entrada | Descrição |
|
|
108
|
+
|----------------------|------------------------------------|
|
|
109
|
+
| `@whoisfreire/eslint-config` | Config base (recomendado + TypeScript + Neostandard + regras de estilo) |
|
|
110
|
+
| `@whoisfreire/eslint-config/node.mjs` | Config base + regras e globals para Node.js |
|
|
111
|
+
|
|
112
|
+
## Scripts no `package.json`
|
|
113
|
+
|
|
114
|
+
Sugestão de scripts para rodar o ESLint no projeto:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"scripts": {
|
|
119
|
+
"lint": "eslint .",
|
|
120
|
+
"lint:fix": "eslint . --fix"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Licença
|
|
126
|
+
|
|
127
|
+
MIT © WhoIsFreire
|
package/node.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whoisfreire/eslint-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"private": false,
|
|
5
|
+
"url": "https://github.com/whoisfreire/eslint-config",
|
|
5
6
|
"description": "Custom ESLint configuration for WhoIsFreire projects. Based on Rocketseat ESLint custom configuration.",
|
|
6
7
|
"main": "base.mjs",
|
|
7
8
|
"license": "MIT",
|