@acfatah/eslint-preset 1.2.0 → 1.3.1
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 +15 -5
- package/dist/index.d.ts +64 -54
- package/dist/index.mjs +11 -6
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -62,9 +62,13 @@ export default config(
|
|
|
62
62
|
},
|
|
63
63
|
|
|
64
64
|
{
|
|
65
|
+
// Optionally when using some plugins
|
|
66
|
+
plugins: {
|
|
67
|
+
// ...
|
|
68
|
+
},
|
|
69
|
+
|
|
65
70
|
rules: {
|
|
66
71
|
...preset,
|
|
67
|
-
...markdown,
|
|
68
72
|
|
|
69
73
|
// Specifically for Vue projects
|
|
70
74
|
...vue,
|
|
@@ -78,13 +82,19 @@ export default config(
|
|
|
78
82
|
Add the following configurations respectively.
|
|
79
83
|
|
|
80
84
|
```typescript
|
|
81
|
-
import { tailwind } from '@acfatah/eslint-preset
|
|
85
|
+
import { betterTailwindcssPlugin, tailwind } from '@acfatah/eslint-preset'
|
|
82
86
|
import antfu from '@antfu/eslint-config'
|
|
83
87
|
|
|
84
88
|
export default antfu(
|
|
85
|
-
|
|
89
|
+
{
|
|
90
|
+
// other configs...
|
|
91
|
+
},
|
|
86
92
|
|
|
87
93
|
{
|
|
94
|
+
plugins: {
|
|
95
|
+
...betterTailwindcssPlugin,
|
|
96
|
+
},
|
|
97
|
+
|
|
88
98
|
rules: {
|
|
89
99
|
// other rules...
|
|
90
100
|
|
|
@@ -102,7 +112,7 @@ export default antfu(
|
|
|
102
112
|
}
|
|
103
113
|
},
|
|
104
114
|
|
|
105
|
-
// other configs...
|
|
115
|
+
// other flat configs...
|
|
106
116
|
)
|
|
107
117
|
```
|
|
108
118
|
|
|
@@ -118,7 +128,7 @@ File: `src/files/.vscode/settings.json`
|
|
|
118
128
|
{
|
|
119
129
|
// Disable the default formatter, use eslint instead
|
|
120
130
|
"prettier.enable": false,
|
|
121
|
-
"editor.formatOnSave":
|
|
131
|
+
"editor.formatOnSave": true,
|
|
122
132
|
|
|
123
133
|
// Auto fix
|
|
124
134
|
"editor.codeActionsOnSave": {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,59 +2,63 @@
|
|
|
2
2
|
|
|
3
3
|
import { default as config } from '@antfu/eslint-config';
|
|
4
4
|
|
|
5
|
+
export declare const betterTailwindcssPlugin: {
|
|
6
|
+
"better-tailwindcss": {
|
|
7
|
+
configs: {
|
|
8
|
+
[x: string]: {
|
|
9
|
+
plugins: string[];
|
|
10
|
+
rules: {
|
|
11
|
+
[x: string]: "error" | "warn";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
meta: {
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
rules: {};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
5
21
|
/**
|
|
6
22
|
* Eslint preset for Markdown files.
|
|
7
23
|
*
|
|
8
24
|
* This preset integrates the `@eslint/markdown` plugin.
|
|
9
25
|
* See: https://github.com/eslint/markdown
|
|
10
26
|
*/
|
|
11
|
-
export declare const markdown: {
|
|
12
|
-
name: string;
|
|
13
|
-
files: string[];
|
|
14
|
-
language: string;
|
|
15
|
-
plugins: {};
|
|
16
|
-
rules: {
|
|
17
|
-
readonly "markdown/fenced-code-language": "error";
|
|
18
|
-
readonly "markdown/heading-increment": "error";
|
|
19
|
-
readonly "markdown/no-duplicate-definitions": "error";
|
|
20
|
-
readonly "markdown/no-empty-definitions": "error";
|
|
21
|
-
readonly "markdown/no-empty-images": "error";
|
|
22
|
-
readonly "markdown/no-empty-links": "error";
|
|
23
|
-
readonly "markdown/no-invalid-label-refs": "error";
|
|
24
|
-
readonly "markdown/no-missing-atx-heading-space": "error";
|
|
25
|
-
readonly "markdown/no-missing-label-refs": "error";
|
|
26
|
-
readonly "markdown/no-missing-link-fragments": "error";
|
|
27
|
-
readonly "markdown/no-multiple-h1": "error";
|
|
28
|
-
readonly "markdown/no-reference-like-urls": "error";
|
|
29
|
-
readonly "markdown/no-reversed-media-syntax": "error";
|
|
30
|
-
readonly "markdown/no-space-in-emphasis": "error";
|
|
31
|
-
readonly "markdown/no-unused-definitions": "error";
|
|
32
|
-
readonly "markdown/require-alt-text": "error";
|
|
33
|
-
readonly "markdown/table-column-count": "error";
|
|
34
|
-
};
|
|
35
|
-
}[];
|
|
27
|
+
export declare const markdown: {};
|
|
36
28
|
export declare const preset: {
|
|
37
|
-
"sort-imports":
|
|
38
|
-
"perfectionist/sort-imports":
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
29
|
+
"sort-imports": "off";
|
|
30
|
+
"perfectionist/sort-imports": [
|
|
31
|
+
"error",
|
|
32
|
+
{
|
|
33
|
+
partitionByNewLine: true;
|
|
34
|
+
newlinesBetween: "ignore";
|
|
35
|
+
ignoreCase: false;
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
"perfectionist/sort-exports": [
|
|
39
|
+
"error",
|
|
40
|
+
{
|
|
41
|
+
partitionByNewLine: true;
|
|
42
|
+
newlinesBetween: "ignore";
|
|
43
|
+
ignoreCase: false;
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
"space-before-function-paren": [
|
|
47
|
+
"error",
|
|
48
|
+
{
|
|
49
|
+
anonymous: "never";
|
|
50
|
+
named: "never";
|
|
51
|
+
asyncArrow: "always";
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
"style/padding-line-between-statements": [
|
|
55
|
+
"error",
|
|
56
|
+
{
|
|
57
|
+
blankLine: "always";
|
|
58
|
+
prev: "*";
|
|
59
|
+
next: "return";
|
|
60
|
+
}
|
|
61
|
+
];
|
|
58
62
|
};
|
|
59
63
|
/**
|
|
60
64
|
* Eslint preset for Tailwind CSS.
|
|
@@ -63,11 +67,14 @@ export declare const preset: {
|
|
|
63
67
|
* See: https://github.com/schoero/eslint-plugin-better-tailwindcss
|
|
64
68
|
*/
|
|
65
69
|
export declare const tailwind: {
|
|
66
|
-
"better-tailwindcss/enforce-consistent-line-wrapping":
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
"better-tailwindcss/enforce-consistent-line-wrapping": [
|
|
71
|
+
"warn",
|
|
72
|
+
{
|
|
73
|
+
printWidth: number;
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
"better-tailwindcss/no-restricted-classes": "off";
|
|
77
|
+
"better-tailwindcss/no-unregistered-classes": "off";
|
|
71
78
|
};
|
|
72
79
|
/**
|
|
73
80
|
* Eslint preset for Vue.js files.
|
|
@@ -76,9 +83,12 @@ export declare const tailwind: {
|
|
|
76
83
|
* See: https://eslint.vuejs.org/
|
|
77
84
|
*/
|
|
78
85
|
export declare const vue: {
|
|
79
|
-
"vue/object-property-newline":
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
"vue/object-property-newline": [
|
|
87
|
+
"error",
|
|
88
|
+
{
|
|
89
|
+
allowAllPropertiesOnSameLine: true;
|
|
90
|
+
}
|
|
91
|
+
];
|
|
82
92
|
};
|
|
83
93
|
|
|
84
94
|
export {
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
// src/plugins/better-tailwindcss.ts
|
|
2
|
+
import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
|
|
3
|
+
var betterTailwindcssPlugin = {
|
|
4
|
+
"better-tailwindcss": eslintPluginBetterTailwindcss
|
|
5
|
+
};
|
|
1
6
|
// src/rules/markdown.ts
|
|
2
|
-
|
|
3
|
-
var markdown = eslintMarkdown.configs.recommended;
|
|
7
|
+
var markdown = {};
|
|
4
8
|
// src/rules/preset.ts
|
|
5
9
|
var preset = {
|
|
6
10
|
"sort-imports": "off",
|
|
@@ -29,10 +33,10 @@ var preset = {
|
|
|
29
33
|
]
|
|
30
34
|
};
|
|
31
35
|
// src/rules/tailwind.ts
|
|
32
|
-
import
|
|
36
|
+
import eslintPluginBetterTailwindcss2 from "eslint-plugin-better-tailwindcss";
|
|
33
37
|
var tailwind = {
|
|
34
|
-
...
|
|
35
|
-
...
|
|
38
|
+
...eslintPluginBetterTailwindcss2.configs["recommended-warn"]?.rules,
|
|
39
|
+
...eslintPluginBetterTailwindcss2.configs["recommended-error"]?.rules,
|
|
36
40
|
"better-tailwindcss/enforce-consistent-line-wrapping": ["warn", {
|
|
37
41
|
printWidth: 100
|
|
38
42
|
}],
|
|
@@ -52,5 +56,6 @@ export {
|
|
|
52
56
|
tailwind,
|
|
53
57
|
preset,
|
|
54
58
|
markdown,
|
|
55
|
-
default2 as config
|
|
59
|
+
default2 as config,
|
|
60
|
+
betterTailwindcssPlugin
|
|
56
61
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acfatah/eslint-preset",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.1",
|
|
5
5
|
"description": "Eslint config preset.",
|
|
6
6
|
"author": "Achmad F. Ibrahim <acfatah@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
"node": "^20.19.0 || >=22.12.0"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "bun run
|
|
33
|
+
"build": "bun --version > .bun-version && bun install && bun run script/build.ts",
|
|
34
34
|
"lint": "bunx --bun eslint",
|
|
35
35
|
"lint:staged": "bunx --bun eslint --pass-on-no-patterns --no-warn-ignored $(git diff --relative --cached --name-only --diff-filter=d)",
|
|
36
36
|
"lint:commit-message": "bunx --bun commitlint --edit",
|
|
37
37
|
"format": "bunx --bun eslint --fix",
|
|
38
38
|
"typecheck": "tsc --noEmit",
|
|
39
|
-
"release": "bunx --bun bumpp
|
|
40
|
-
"publish": "npm publish --access public"
|
|
39
|
+
"release": "bun run build && bunx --bun bumpp"
|
|
41
40
|
},
|
|
42
41
|
"dependencies": {
|
|
43
42
|
"@antfu/eslint-config": "^6.7.1",
|
|
44
43
|
"@eslint/markdown": "^7.5.1",
|
|
45
44
|
"eslint-plugin-better-tailwindcss": "^3.8.0",
|
|
45
|
+
"eslint-plugin-format": "^1.1.0",
|
|
46
46
|
"eslint-plugin-vue": "^10.6.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"bumpp": "^10.3.2",
|
|
53
53
|
"bun-plugin-dts": "^0.3.0",
|
|
54
54
|
"eslint": "^9.39.2",
|
|
55
|
-
"eslint-plugin-format": "^1.1.0",
|
|
56
55
|
"simple-git-hooks": "^2.13.1"
|
|
57
56
|
},
|
|
58
57
|
"simple-git-hooks": {
|