@acfatah/eslint-preset 1.0.3 → 1.2.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 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 [`antfu/eslint-config`][1].
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 antfu(
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, add the following configurations to `.vscode/tailwindcss.json`.
202
+ Then, copy `src/files/.vscode/tailwind.json` file to `.vscode/tailwind.json`.
192
203
 
193
- ```jsonc
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
  *
@@ -36,6 +38,12 @@ export declare const preset: {
36
38
  "perfectionist/sort-imports": (string | {
37
39
  partitionByNewLine: boolean;
38
40
  newlinesBetween: string;
41
+ ignoreCase: boolean;
42
+ })[];
43
+ "perfectionist/sort-exports": (string | {
44
+ partitionByNewLine: boolean;
45
+ newlinesBetween: string;
46
+ ignoreCase: boolean;
39
47
  })[];
40
48
  "space-before-function-paren": (string | {
41
49
  anonymous: string;
@@ -73,4 +81,8 @@ export declare const vue: {
73
81
  })[];
74
82
  };
75
83
 
84
+ export {
85
+ config,
86
+ };
87
+
76
88
  export {};
package/dist/index.mjs CHANGED
@@ -6,7 +6,13 @@ var preset = {
6
6
  "sort-imports": "off",
7
7
  "perfectionist/sort-imports": ["error", {
8
8
  partitionByNewLine: true,
9
- newlinesBetween: "ignore"
9
+ newlinesBetween: "ignore",
10
+ ignoreCase: false
11
+ }],
12
+ "perfectionist/sort-exports": ["error", {
13
+ partitionByNewLine: true,
14
+ newlinesBetween: "ignore",
15
+ ignoreCase: false
10
16
  }],
11
17
  "space-before-function-paren": ["error", {
12
18
  anonymous: "never",
@@ -15,7 +21,11 @@ var preset = {
15
21
  }],
16
22
  "style/padding-line-between-statements": [
17
23
  "error",
18
- { blankLine: "always", prev: "*", next: "return" }
24
+ {
25
+ blankLine: "always",
26
+ prev: "*",
27
+ next: "return"
28
+ }
19
29
  ]
20
30
  };
21
31
  // src/rules/tailwind.ts
@@ -35,9 +45,12 @@ var vue = {
35
45
  allowAllPropertiesOnSameLine: true
36
46
  }]
37
47
  };
48
+ // src/index.ts
49
+ import { default as default2 } from "@antfu/eslint-config";
38
50
  export {
39
51
  vue,
40
52
  tailwind,
41
53
  preset,
42
- markdown
54
+ markdown,
55
+ default2 as config
43
56
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@acfatah/eslint-preset",
3
3
  "type": "module",
4
- "version": "1.0.3",
4
+ "version": "1.2.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": "bun run build && npm publish --access public"
40
+ "publish": "npm publish --access public"
41
41
  },
42
42
  "dependencies": {
43
43
  "@antfu/eslint-config": "^6.7.1",
@@ -49,7 +49,6 @@
49
49
  "@commitlint/cli": "^20.2.0",
50
50
  "@commitlint/config-conventional": "^20.2.0",
51
51
  "@types/bun": "^1.3.5",
52
- "@types/node": "^20.19.27",
53
52
  "bumpp": "^10.3.2",
54
53
  "bun-plugin-dts": "^0.3.0",
55
54
  "eslint": "^9.39.2",