@acfatah/eslint-preset 1.0.2 → 1.1.0
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 +30 -122
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +9 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,13 +5,19 @@
|
|
|
5
5
|
<img
|
|
6
6
|
alt="Code Style"
|
|
7
7
|
src="https://antfu.me/badge-code-style.svg"></a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/@acfatah/eslint-preset">
|
|
9
|
+
<img
|
|
10
|
+
alt="NPM Version"
|
|
11
|
+
src="https://img.shields.io/npm/v/%40acfatah%2Feslint-preset"></a>
|
|
8
12
|
<a href="https://github.com/antfu/eslint-config">
|
|
9
13
|
<img
|
|
10
14
|
alt="GitHub last commit (by committer)"
|
|
11
15
|
src="https://img.shields.io/github/last-commit/acfatah/eslint-preset?display_timestamp=committer&style=flat-square"></a>
|
|
12
16
|
</p>
|
|
13
17
|
|
|
14
|
-
An opinionated ESLint configuration preset for TypeScript projects, based on
|
|
18
|
+
An opinionated ESLint configuration preset for TypeScript projects, based on
|
|
19
|
+
[`antfu/eslint-config`][1]. I use this preset across my personal and professional
|
|
20
|
+
projects to maintain a consistent code style and quality.
|
|
15
21
|
|
|
16
22
|
Additional rules included are:
|
|
17
23
|
|
|
@@ -27,18 +33,32 @@ To install the config, run:
|
|
|
27
33
|
bun add --dev @acfatah/eslint-preset
|
|
28
34
|
```
|
|
29
35
|
|
|
30
|
-
Add `eslint.config.ts` file with the following content
|
|
36
|
+
Add `eslint.config.ts` file with the following content. `config` is just a wrapper
|
|
37
|
+
to the `antfu` factory function. See [antfu Customization][antfu-factory-fuction]
|
|
38
|
+
section for more details.
|
|
31
39
|
|
|
32
40
|
```typescript
|
|
41
|
+
import { config } from '@acfatah/eslint-preset'
|
|
33
42
|
import { markdown, preset, vue } from '@acfatah/eslint-preset/rules'
|
|
34
|
-
import antfu from '@antfu/eslint-config'
|
|
35
43
|
|
|
36
|
-
export default
|
|
44
|
+
export default config(
|
|
37
45
|
{
|
|
38
46
|
formatters: true,
|
|
39
47
|
|
|
48
|
+
// Type of the project. 'lib' for libraries, the default is 'app'
|
|
49
|
+
type: 'lib',
|
|
50
|
+
|
|
40
51
|
// Specifically for Vue projects
|
|
41
52
|
vue: true,
|
|
53
|
+
|
|
54
|
+
// Files and directories to ignore. Adjust accordingly.
|
|
55
|
+
ignores: [
|
|
56
|
+
'**/coverage/**',
|
|
57
|
+
'**/dist/**',
|
|
58
|
+
'**/logs/**',
|
|
59
|
+
'bun.lock',
|
|
60
|
+
'tsconfig.*',
|
|
61
|
+
],
|
|
42
62
|
},
|
|
43
63
|
|
|
44
64
|
{
|
|
@@ -50,17 +70,6 @@ export default antfu(
|
|
|
50
70
|
...vue,
|
|
51
71
|
},
|
|
52
72
|
},
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
name: 'app/files-to-ignore',
|
|
56
|
-
ignores: [
|
|
57
|
-
'**/coverage/**',
|
|
58
|
-
'**/dist/**',
|
|
59
|
-
'**/logs/**',
|
|
60
|
-
'bun.lock',
|
|
61
|
-
'tsconfig.*',
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
73
|
)
|
|
65
74
|
```
|
|
66
75
|
|
|
@@ -103,6 +112,8 @@ Install the [VS Code ESLint extension][2].
|
|
|
103
112
|
|
|
104
113
|
Add the following vscode configuration to `.vscode/settings.json`,
|
|
105
114
|
|
|
115
|
+
File: `src/files/.vscode/settings.json`
|
|
116
|
+
|
|
106
117
|
```jsonc
|
|
107
118
|
{
|
|
108
119
|
// Disable the default formatter, use eslint instead
|
|
@@ -188,114 +199,10 @@ Add the following custom Tailwind CSS v4 functions and directives lines to the `
|
|
|
188
199
|
}
|
|
189
200
|
```
|
|
190
201
|
|
|
191
|
-
Then,
|
|
202
|
+
Then, copy `src/files/.vscode/tailwind.json` file to `.vscode/tailwind.json`.
|
|
192
203
|
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
"version": 1.1,
|
|
196
|
-
"atDirectives": [
|
|
197
|
-
{
|
|
198
|
-
"name": "@apply",
|
|
199
|
-
"description": "Inline any existing utility classes into custom CSS.",
|
|
200
|
-
"references": [
|
|
201
|
-
{
|
|
202
|
-
"name": "Tailwind Documentation",
|
|
203
|
-
"url": "https://tailwindcss.com/docs/functions-and-directives#apply-directive"
|
|
204
|
-
}
|
|
205
|
-
]
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
"name": "@config",
|
|
209
|
-
"description": "Load legacy JavaScript-based configuration file (compatibility with v3.x).",
|
|
210
|
-
"references": [
|
|
211
|
-
{
|
|
212
|
-
"name": "Tailwind Documentation",
|
|
213
|
-
"url": "https://tailwindcss.com/docs/functions-and-directives#config-directive"
|
|
214
|
-
}
|
|
215
|
-
]
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
"name": "@custom-variant",
|
|
219
|
-
"description": "Add a custom variant in the project.",
|
|
220
|
-
"references": [
|
|
221
|
-
{
|
|
222
|
-
"name": "Tailwind Documentation",
|
|
223
|
-
"url": "https://tailwindcss.com/docs/functions-and-directives#custom-variant-directive"
|
|
224
|
-
}
|
|
225
|
-
]
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
"name": "@import",
|
|
229
|
-
"description": "Use the @import directive to inline import CSS files, including Tailwind itself.",
|
|
230
|
-
"references": [
|
|
231
|
-
{
|
|
232
|
-
"name": "Tailwind Documentation",
|
|
233
|
-
"url": "https://tailwindcss.com/docs/functions-and-directives#import-directive"
|
|
234
|
-
}
|
|
235
|
-
]
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
"name": "@plugin",
|
|
239
|
-
"description": "Load legacy JavaScript-based plugin (compatibility with v3.x).",
|
|
240
|
-
"references": [
|
|
241
|
-
{
|
|
242
|
-
"name": "Tailwind Documentation",
|
|
243
|
-
"url": "https://tailwindcss.com/docs/upgrading-to-v4#plugins"
|
|
244
|
-
}
|
|
245
|
-
]
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
"name": "@reference",
|
|
249
|
-
"description": "Import main stylesheet for reference without including styles, for use with frameworks like React, Svelte, etc.",
|
|
250
|
-
"references": [
|
|
251
|
-
{
|
|
252
|
-
"name": "Tailwind Documentation",
|
|
253
|
-
"url": "https://tailwindcss.com/docs/functions-and-directives#reference-directive"
|
|
254
|
-
}
|
|
255
|
-
]
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
"name": "@source",
|
|
259
|
-
"description": "Specify source files not picked up by automatic content detection.",
|
|
260
|
-
"references": [
|
|
261
|
-
{
|
|
262
|
-
"name": "Tailwind Documentation",
|
|
263
|
-
"url": "https://tailwindcss.com/docs/functions-and-directives#source-directive"
|
|
264
|
-
}
|
|
265
|
-
]
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
"name": "@theme",
|
|
269
|
-
"description": "Define custom design tokens like fonts, colors, breakpoints.",
|
|
270
|
-
"references": [
|
|
271
|
-
{
|
|
272
|
-
"name": "Tailwind Documentation",
|
|
273
|
-
"url": "https://tailwindcss.com/docs/functions-and-directives#theme-directive"
|
|
274
|
-
}
|
|
275
|
-
]
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
"name": "@utility",
|
|
279
|
-
"description": "Add custom utilities that work with variants like hover, focus, lg.",
|
|
280
|
-
"references": [
|
|
281
|
-
{
|
|
282
|
-
"name": "Tailwind Documentation",
|
|
283
|
-
"url": "https://tailwindcss.com/docs/functions-and-directives#utility-directive"
|
|
284
|
-
}
|
|
285
|
-
]
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
"name": "@variant",
|
|
289
|
-
"description": "Apply a Tailwind variant to styles in CSS.",
|
|
290
|
-
"references": [
|
|
291
|
-
{
|
|
292
|
-
"name": "Tailwind Documentation",
|
|
293
|
-
"url": "https://tailwindcss.com/docs/functions-and-directives#variant-directive"
|
|
294
|
-
}
|
|
295
|
-
]
|
|
296
|
-
}
|
|
297
|
-
]
|
|
298
|
-
}
|
|
204
|
+
```bash
|
|
205
|
+
curl -s https://raw.githubusercontent.com/acfatah/eslint-preset/refs/heads/main/src/files/.vscode/tailwind.json -o .vscode/tailwind.json
|
|
299
206
|
```
|
|
300
207
|
|
|
301
208
|
## Acknowledgments
|
|
@@ -305,3 +212,4 @@ Then, add the following configurations to `.vscode/tailwindcss.json`.
|
|
|
305
212
|
[1]: https://github.com/antfu/eslint-config
|
|
306
213
|
[2]: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
|
|
307
214
|
[3]: https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss
|
|
215
|
+
[antfu-factory-fuction]: https://github.com/antfu/eslint-config?tab=readme-ov-file#customization
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
+
import { default as config } from '@antfu/eslint-config';
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Eslint preset for Markdown files.
|
|
5
7
|
*
|
|
@@ -73,4 +75,8 @@ export declare const vue: {
|
|
|
73
75
|
})[];
|
|
74
76
|
};
|
|
75
77
|
|
|
78
|
+
export {
|
|
79
|
+
config,
|
|
80
|
+
};
|
|
81
|
+
|
|
76
82
|
export {};
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,11 @@ var preset = {
|
|
|
15
15
|
}],
|
|
16
16
|
"style/padding-line-between-statements": [
|
|
17
17
|
"error",
|
|
18
|
-
{
|
|
18
|
+
{
|
|
19
|
+
blankLine: "always",
|
|
20
|
+
prev: "*",
|
|
21
|
+
next: "return"
|
|
22
|
+
}
|
|
19
23
|
]
|
|
20
24
|
};
|
|
21
25
|
// src/rules/tailwind.ts
|
|
@@ -35,9 +39,12 @@ var vue = {
|
|
|
35
39
|
allowAllPropertiesOnSameLine: true
|
|
36
40
|
}]
|
|
37
41
|
};
|
|
42
|
+
// src/index.ts
|
|
43
|
+
import { default as default2 } from "@antfu/eslint-config";
|
|
38
44
|
export {
|
|
39
45
|
vue,
|
|
40
46
|
tailwind,
|
|
41
47
|
preset,
|
|
42
|
-
markdown
|
|
48
|
+
markdown,
|
|
49
|
+
default2 as config
|
|
43
50
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acfatah/eslint-preset",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"description": "Eslint config preset.",
|
|
6
6
|
"author": "Achmad F. Ibrahim <acfatah@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"format": "bunx --bun eslint --fix",
|
|
38
38
|
"typecheck": "tsc --noEmit",
|
|
39
39
|
"release": "bunx --bun bumpp --execute=\"bun install\"",
|
|
40
|
-
"publish": "
|
|
40
|
+
"publish": "npm publish --access public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@antfu/eslint-config": "^6.7.1",
|