@ivanmaxlogiudice/eslint-config 3.0.0-beta.1 → 3.0.0-beta.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/LICENSE +2 -2
- package/README.md +22 -214
- package/bin/index.js +1 -1
- package/dist/cli.js +157 -263
- package/dist/index.d.ts +13445 -3
- package/dist/index.js +1375 -32
- package/package.json +111 -144
- package/dist/cli.cjs +0 -579
- package/dist/cli.d.cts +0 -2
- package/dist/index.cjs +0 -80
- package/dist/index.d.cts +0 -5
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022-PRESENT Iván
|
|
3
|
+
Copyright (c) 2022-PRESENT Iván Máximiliano, Lo Giudice<https://github.com/ivanmaxlogiudice>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,47 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
# @ivanmaxlogiudice/eslint-config
|
|
2
2
|
|
|
3
3
|
[![npm version][npm-version-src]][npm-version-href]
|
|
4
4
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
5
|
[![License][license-src]][license-href]
|
|
6
|
-
[![code style][antfu-src]][antfu-href]
|
|
7
|
-
|
|
8
|
-
My ESlint configuration, based on `@antfu/eslint-config` with personal customizations. Nicely integrates with Nuxt and provides optional rules for Tailwind.
|
|
9
|
-
|
|
10
|
-
[Release Notes](/releases)
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
</div>
|
|
15
6
|
|
|
16
7
|
## 🌟 Features
|
|
17
8
|
|
|
18
|
-
|
|
9
|
+
- Auto fix for formatting (aimed to be used standalone **without** Prettier).
|
|
10
|
+
- Reasonable defaults, best practices, only one line of config.
|
|
11
|
+
- Designed to work with TypeScript, Vue, JSON, YAML, Markdown, etc. Out-of-box.
|
|
12
|
+
- Sort imports, `package.json`, `tsconfig.json`...
|
|
13
|
+
- Ignores common files like `dist`, `node_modules`, `coverage`, and files in `.gitignore`.
|
|
14
|
+
- **Style principle**: Minimal for reading, stable for diff, consistent
|
|
15
|
+
- Sorted imports, dangling commas
|
|
16
|
+
- Single quotes, no semi
|
|
17
|
+
- Indentation 4 spaces.
|
|
18
|
+
- Using [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- Indentation: 4 spaces.
|
|
23
|
-
- (Vue) Set block order to `<template>`, `<script>`, `<style>`.
|
|
24
|
-
- And some other minor tweaks.
|
|
25
|
-
|
|
26
|
-
## 🛠️ Setup
|
|
20
|
+
## 🛠️ Install
|
|
27
21
|
|
|
28
22
|
### Starter Wizard
|
|
29
23
|
|
|
30
|
-
We provided a CLI tool to help you set up your project, or migrate from the legacy config to the new flat config with one command.
|
|
31
|
-
|
|
32
24
|
```bash
|
|
33
|
-
|
|
25
|
+
bunx @ivanmaxlogiudice/eslint-config@latest
|
|
34
26
|
```
|
|
35
27
|
|
|
36
|
-
### Manual
|
|
37
|
-
|
|
38
|
-
If you prefer to set up manually:
|
|
28
|
+
### Manual instalation
|
|
39
29
|
|
|
40
30
|
```bash
|
|
41
|
-
|
|
31
|
+
bun add -D eslint @ivanmaxlogiudice/eslint-config
|
|
42
32
|
```
|
|
43
33
|
|
|
44
|
-
And create `eslint.config.
|
|
34
|
+
And create `eslint.config.mjs` in your project root:
|
|
45
35
|
|
|
46
36
|
```js
|
|
47
37
|
// eslint.config.js
|
|
@@ -50,197 +40,15 @@ import config from '@ivanmaxlogiudice/eslint-config'
|
|
|
50
40
|
export default config()
|
|
51
41
|
```
|
|
52
42
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```json
|
|
56
|
-
{
|
|
57
|
-
"scripts": {
|
|
58
|
-
"lint": "eslint .",
|
|
59
|
-
"lint:fix": "eslint . --fix"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## 📝 VS Code Support (auto fix on save)
|
|
65
|
-
|
|
66
|
-
Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint).
|
|
67
|
-
|
|
68
|
-
Add the following settings to your `.vscode/settings.json`:
|
|
69
|
-
|
|
70
|
-
```jsonc
|
|
71
|
-
{
|
|
72
|
-
// Disable the default formatter, use eslint instead
|
|
73
|
-
"prettier.enable": false,
|
|
74
|
-
"editor.formatOnSave": false,
|
|
75
|
-
|
|
76
|
-
// Auto fix
|
|
77
|
-
"editor.codeActionsOnSave": {
|
|
78
|
-
"source.fixAll.eslint": "explicit",
|
|
79
|
-
"source.organizeImports": "never"
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
83
|
-
"eslint.rules.customizations": [
|
|
84
|
-
{ "rule": "style/*", "severity": "off", "fixable": true },
|
|
85
|
-
{ "rule": "format/*", "severity": "off", "fixable": true },
|
|
86
|
-
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
87
|
-
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
|
88
|
-
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
|
89
|
-
{ "rule": "*-order", "severity": "off", "fixable": true },
|
|
90
|
-
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
|
91
|
-
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
|
92
|
-
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
|
93
|
-
{ "rule": "*semi", "severity": "off", "fixable": true }
|
|
94
|
-
],
|
|
95
|
-
|
|
96
|
-
// Enable eslint for all supported languages
|
|
97
|
-
"eslint.validate": [
|
|
98
|
-
"javascript",
|
|
99
|
-
"javascriptreact",
|
|
100
|
-
"typescript",
|
|
101
|
-
"typescriptreact",
|
|
102
|
-
"vue",
|
|
103
|
-
"html",
|
|
104
|
-
"markdown",
|
|
105
|
-
"json",
|
|
106
|
-
"jsonc",
|
|
107
|
-
"yaml",
|
|
108
|
-
"toml",
|
|
109
|
-
"xml",
|
|
110
|
-
"gql",
|
|
111
|
-
"graphql",
|
|
112
|
-
"astro",
|
|
113
|
-
"css",
|
|
114
|
-
"less",
|
|
115
|
-
"scss",
|
|
116
|
-
"pcss",
|
|
117
|
-
"postcss"
|
|
118
|
-
]
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
For more settings, check the "VS Code support" section in [antfu/eslint-config](https://github.com/antfu/eslint-config#vs-code-support-auto-fix)
|
|
123
|
-
|
|
124
|
-
### Customization
|
|
125
|
-
|
|
126
|
-
You can configure each integration individually, for example:
|
|
127
|
-
|
|
128
|
-
```js
|
|
129
|
-
// eslint.config.js
|
|
130
|
-
import config from '@ivanmaxlogiudice/eslint-config'
|
|
131
|
-
|
|
132
|
-
export default config({
|
|
133
|
-
// Type of the project. 'lib' for libraries, the default is 'app'
|
|
134
|
-
type: 'lib',
|
|
135
|
-
|
|
136
|
-
// Enable stylistic formatting rules
|
|
137
|
-
// stylistic: true,
|
|
138
|
-
|
|
139
|
-
// Or customize the stylistic rules
|
|
140
|
-
stylistic: {
|
|
141
|
-
quotes: 'double', // or 'double'
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
// TypeScript and Vue are autoetected, you can also explicitly enable them:
|
|
145
|
-
typescript: true,
|
|
146
|
-
vue: true,
|
|
147
|
-
|
|
148
|
-
// Disable jsonc and yaml support
|
|
149
|
-
jsonc: false,
|
|
150
|
-
yaml: false,
|
|
151
|
-
|
|
152
|
-
// `.eslintignore` is no longer supported in Flat config, use `ignores` instead
|
|
153
|
-
ignores: [
|
|
154
|
-
'**/fixtures',
|
|
155
|
-
// ...globs
|
|
156
|
-
]
|
|
157
|
-
})
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
#### Integrationg with Nuxt
|
|
161
|
-
|
|
162
|
-
1. Install the ESLint module with `pnpx nuxi module add eslint`, as described in the [official docs](https://eslint.nuxt.com/packages/module)
|
|
163
|
-
|
|
164
|
-
2. Set it to be "standalone", to prevent conflicting with `@ivanmaxlogiudice/eslint-config`:
|
|
165
|
-
|
|
166
|
-
```ts
|
|
167
|
-
// nuxt.config.ts
|
|
168
|
-
export default defineNuxtConfig({
|
|
169
|
-
modules: [
|
|
170
|
-
'@nuxt/eslint',
|
|
171
|
-
],
|
|
172
|
-
|
|
173
|
-
eslint: {
|
|
174
|
-
config: {
|
|
175
|
-
standalone: false, // <-- Important to work correctly
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
})
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
3. Integrate this config by prepending it to the Nuxt provided one:
|
|
182
|
-
|
|
183
|
-
```js
|
|
184
|
-
// eslint.config.js
|
|
185
|
-
import config from '@ivanmaxlogiudice/eslint-config'
|
|
186
|
-
import withNuxt from './.nuxt/eslint.config.mjs'
|
|
187
|
-
|
|
188
|
-
export default withNuxt(
|
|
189
|
-
config({
|
|
190
|
-
// options
|
|
191
|
-
}),
|
|
192
|
-
// ...your other rules
|
|
193
|
-
)
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Lint Staged
|
|
197
|
-
|
|
198
|
-
If you want to apply lint and auto-fix before every commit, you can add the following to your `package.json`:
|
|
199
|
-
|
|
200
|
-
```json
|
|
201
|
-
{
|
|
202
|
-
"simple-git-hooks": {
|
|
203
|
-
"pre-commit": "pnpm lint-staged"
|
|
204
|
-
},
|
|
205
|
-
"lint-staged": {
|
|
206
|
-
"*": "eslint --fix"
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
and then
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
pnpm add -D lint-staged simple-git-hooks
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## View what rules are enabled
|
|
218
|
-
|
|
219
|
-
Use [@eslint/config-inspector](https://github.com/eslint/config-inspector) to view what rules are enabled in your project and apply them to what files,
|
|
220
|
-
|
|
221
|
-
Go to your project root that contains `eslint.config.js` and run:
|
|
222
|
-
|
|
223
|
-
```bash
|
|
224
|
-
pnpx @eslint/config-inspector
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
You can check more customization in [@antfu/eslint-config](https://github.com/antfu/eslint-config?tab=readme-ov-file#customization).
|
|
228
|
-
|
|
229
|
-
## 📝 License
|
|
230
|
-
|
|
231
|
-
[MIT](https://github.com/ivanmaxlogiudice/eslint-config/blob/main/LICENSE)
|
|
43
|
+
## License
|
|
232
44
|
|
|
233
|
-
© 2022-
|
|
45
|
+
[MIT](./LICENSE) License © 2022-PRESENT [Iván Máximiliano, Lo Giudice](https://github.com/ivanmaxlogiudice)
|
|
234
46
|
|
|
235
47
|
<!-- Badges -->
|
|
236
48
|
|
|
237
|
-
[npm-version-src]: https://img.shields.io/npm/v/@ivanmaxlogiudice/eslint-config
|
|
49
|
+
[npm-version-src]: https://img.shields.io/npm/v/@ivanmaxlogiudice/eslint-config?style=flat&colorA=080f12&colorB=1fa669
|
|
238
50
|
[npm-version-href]: https://npmjs.com/package/@ivanmaxlogiudice/eslint-config
|
|
239
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/@ivanmaxlogiudice/eslint-config
|
|
51
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@ivanmaxlogiudice/eslint-config?style=flat&colorA=080f12&colorB=1fa669
|
|
240
52
|
[npm-downloads-href]: https://npmjs.com/package/@ivanmaxlogiudice/eslint-config
|
|
241
|
-
[
|
|
242
|
-
[
|
|
243
|
-
[license-src]: https://img.shields.io/npm/l/@ivanmaxlogiudice/eslint-config.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
244
|
-
[license-href]: https://npmjs.com/package/@ivanmaxlogiudice/eslint-config
|
|
245
|
-
[antfu-src]: https://antfu.me/badge-code-style.svg
|
|
246
|
-
[antfu-href]: https://github.com/antfu/eslint-config
|
|
53
|
+
[license-src]: https://img.shields.io/github/license/ivanmaxlogiudice/eslint-config.svg?style=flat&colorA=080f12&colorB=1fa669
|
|
54
|
+
[license-href]: https://github.com/ivanmaxlogiudice/eslint-config/blob/main/LICENSE
|
package/bin/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
2
|
import '../dist/cli.js'
|