@acfatah/eslint-preset 4.0.7 → 5.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/README.md +14 -21
- package/dist/index.d.ts +10 -66
- package/dist/index.mjs +76 -50
- package/package.json +5 -7
package/README.md
CHANGED
|
@@ -41,12 +41,12 @@ This preset declares `@antfu/eslint-config`, `@eslint/markdown`, `eslint`,
|
|
|
41
41
|
automatically when you add the preset, so you do not need to list each plugin
|
|
42
42
|
manually in your `package.json`.
|
|
43
43
|
|
|
44
|
-
Add `eslint.config.ts` file with the following content. `
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
Add an `eslint.config.ts` file with the following content. `defineConfig` is a
|
|
45
|
+
wrapper around the `antfu` factory function. See [antfu
|
|
46
|
+
Customization][antfu-factory-fuction] for details.
|
|
47
47
|
|
|
48
48
|
```typescript
|
|
49
|
-
import { defineConfig, markdown,
|
|
49
|
+
import { defineConfig, markdown, typescript, vue } from '@acfatah/eslint-preset'
|
|
50
50
|
|
|
51
51
|
export default defineConfig(
|
|
52
52
|
{
|
|
@@ -74,17 +74,11 @@ export default defineConfig(
|
|
|
74
74
|
plugins: {
|
|
75
75
|
// ...
|
|
76
76
|
},
|
|
77
|
-
|
|
78
|
-
rules: {
|
|
79
|
-
...preset,
|
|
80
|
-
|
|
81
|
-
// Optional markdown rules
|
|
82
|
-
...markdown,
|
|
83
|
-
|
|
84
|
-
// Specifically for Vue projects
|
|
85
|
-
...vue,
|
|
86
|
-
},
|
|
87
77
|
},
|
|
78
|
+
|
|
79
|
+
typescript,
|
|
80
|
+
markdown,
|
|
81
|
+
vue,
|
|
88
82
|
)
|
|
89
83
|
```
|
|
90
84
|
|
|
@@ -105,23 +99,22 @@ export default defineConfig(
|
|
|
105
99
|
...betterTailwindcssPlugin,
|
|
106
100
|
},
|
|
107
101
|
|
|
108
|
-
rules: {
|
|
109
|
-
// other rules...
|
|
110
|
-
|
|
111
|
-
...tailwind,
|
|
112
|
-
},
|
|
113
|
-
|
|
114
102
|
settings: {
|
|
115
103
|
// See: https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md
|
|
116
104
|
'better-tailwindcss': {
|
|
117
105
|
// Required to work properly. Adjust accordingly.
|
|
118
106
|
entryPoint: 'src/styles/global.css',
|
|
119
107
|
// Optional variable names used to store Tailwind class names
|
|
120
|
-
variables: [
|
|
108
|
+
variables: [
|
|
109
|
+
['variant', [{ match: 'objectValues' }]],
|
|
110
|
+
['size', [{ match: 'objectValues' }]],
|
|
111
|
+
],
|
|
121
112
|
},
|
|
122
113
|
}
|
|
123
114
|
},
|
|
124
115
|
|
|
116
|
+
tailwind,
|
|
117
|
+
|
|
125
118
|
// other flat configs...
|
|
126
119
|
)
|
|
127
120
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -3,89 +3,33 @@
|
|
|
3
3
|
import antfu from '@antfu/eslint-config';
|
|
4
4
|
import { ESLint } from 'eslint';
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
export declare const betterTailwindcssPlugin: Record<string, ESLint.Plugin>;
|
|
6
|
+
export type Config = Parameters<typeof antfu>[1];
|
|
8
7
|
/**
|
|
9
8
|
* Eslint preset for Markdown files.
|
|
10
9
|
*
|
|
11
10
|
* This preset integrates the `@eslint/markdown` plugin.
|
|
12
11
|
* See: https://github.com/eslint/markdown
|
|
13
12
|
*/
|
|
14
|
-
export declare const markdown:
|
|
15
|
-
|
|
16
|
-
"sort-imports": "off";
|
|
17
|
-
"perfectionist/sort-imports": [
|
|
18
|
-
"error",
|
|
19
|
-
{
|
|
20
|
-
ignoreCase: false;
|
|
21
|
-
newlinesBetween: number;
|
|
22
|
-
partitionByComment: true;
|
|
23
|
-
}
|
|
24
|
-
];
|
|
25
|
-
"perfectionist/sort-exports": [
|
|
26
|
-
"error",
|
|
27
|
-
{
|
|
28
|
-
ignoreCase: false;
|
|
29
|
-
newlinesBetween: number;
|
|
30
|
-
partitionByComment: true;
|
|
31
|
-
}
|
|
32
|
-
];
|
|
33
|
-
"space-before-function-paren": [
|
|
34
|
-
"error",
|
|
35
|
-
{
|
|
36
|
-
anonymous: "never";
|
|
37
|
-
named: "never";
|
|
38
|
-
asyncArrow: "always";
|
|
39
|
-
}
|
|
40
|
-
];
|
|
41
|
-
"style/padding-line-between-statements": [
|
|
42
|
-
"error",
|
|
43
|
-
{
|
|
44
|
-
blankLine: "always";
|
|
45
|
-
prev: "*";
|
|
46
|
-
next: "return";
|
|
47
|
-
}
|
|
48
|
-
];
|
|
49
|
-
};
|
|
13
|
+
export declare const markdown: Config;
|
|
14
|
+
type Config$1 = Parameters<typeof antfu>[1];
|
|
50
15
|
/**
|
|
51
16
|
* Eslint preset for Tailwind CSS.
|
|
52
17
|
*
|
|
53
18
|
* This preset integrates the `eslint-plugin-better-tailwindcss` plugin.
|
|
54
19
|
* See: https://github.com/schoero/eslint-plugin-better-tailwindcss
|
|
55
20
|
*/
|
|
56
|
-
export declare const tailwind:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
printWidth: number;
|
|
61
|
-
}
|
|
62
|
-
];
|
|
63
|
-
"better-tailwindcss/no-restricted-classes": "off";
|
|
64
|
-
"better-tailwindcss/no-unknown-classes": "off";
|
|
65
|
-
"better-tailwindcss/enforce-canonical-classes": "error";
|
|
66
|
-
"better-tailwindcss/enforce-consistent-class-order": "error";
|
|
67
|
-
"better-tailwindcss/no-deprecated-classes": "error";
|
|
68
|
-
"better-tailwindcss/no-duplicate-classes": "error";
|
|
69
|
-
"better-tailwindcss/no-unnecessary-whitespace": "error";
|
|
70
|
-
"better-tailwindcss/no-conflicting-classes": "error";
|
|
71
|
-
};
|
|
21
|
+
export declare const tailwind: Config$1;
|
|
22
|
+
type Config$2 = Parameters<typeof antfu>[1];
|
|
23
|
+
export declare const typescript: Config$2;
|
|
24
|
+
type Config$3 = Parameters<typeof antfu>[1];
|
|
72
25
|
/**
|
|
73
26
|
* Eslint preset for Vue.js files.
|
|
74
27
|
*
|
|
75
28
|
* This preset integrates the `eslint-plugin-vue` plugin.
|
|
76
29
|
* See: https://eslint.vuejs.org/
|
|
77
30
|
*/
|
|
78
|
-
export declare const vue:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
{
|
|
82
|
-
allowAllPropertiesOnSameLine: true;
|
|
83
|
-
}
|
|
84
|
-
];
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export {
|
|
88
|
-
defineConfig as config,
|
|
89
|
-
};
|
|
31
|
+
export declare const vue: Config$3;
|
|
32
|
+
export declare function defineConfig(options: Parameters<typeof antfu>[0], ...userConfigs: Parameters<typeof antfu>[1][]): ReturnType<typeof antfu>;
|
|
33
|
+
export declare const betterTailwindcssPlugin: Record<string, ESLint.Plugin>;
|
|
90
34
|
|
|
91
35
|
export {};
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,76 @@
|
|
|
1
|
+
// src/configs/markdown.ts
|
|
2
|
+
var markdown = {
|
|
3
|
+
files: [
|
|
4
|
+
"**/*.md"
|
|
5
|
+
],
|
|
6
|
+
rules: {
|
|
7
|
+
"perfectionist/sort-exports": "off",
|
|
8
|
+
"perfectionist/sort-imports": "off"
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
// src/configs/tailwind.ts
|
|
12
|
+
import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
|
|
13
|
+
var tailwind = {
|
|
14
|
+
files: [
|
|
15
|
+
"**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}"
|
|
16
|
+
],
|
|
17
|
+
rules: {
|
|
18
|
+
...eslintPluginBetterTailwindcss.configs["recommended-warn"]?.rules,
|
|
19
|
+
...eslintPluginBetterTailwindcss.configs["recommended-error"]?.rules,
|
|
20
|
+
"better-tailwindcss/enforce-consistent-line-wrapping": ["warn", {
|
|
21
|
+
printWidth: 100
|
|
22
|
+
}],
|
|
23
|
+
"better-tailwindcss/no-restricted-classes": "off",
|
|
24
|
+
"better-tailwindcss/no-unknown-classes": "off"
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
// src/configs/typescript.ts
|
|
28
|
+
var typescript = {
|
|
29
|
+
files: [
|
|
30
|
+
"**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}"
|
|
31
|
+
],
|
|
32
|
+
rules: {
|
|
33
|
+
"sort-imports": "off",
|
|
34
|
+
"perfectionist/sort-imports": ["error", {
|
|
35
|
+
ignoreCase: false,
|
|
36
|
+
newlinesBetween: 1,
|
|
37
|
+
partitionByComment: true
|
|
38
|
+
}],
|
|
39
|
+
"perfectionist/sort-exports": ["error", {
|
|
40
|
+
ignoreCase: false,
|
|
41
|
+
newlinesBetween: 1,
|
|
42
|
+
partitionByComment: true
|
|
43
|
+
}],
|
|
44
|
+
"space-before-function-paren": ["error", {
|
|
45
|
+
anonymous: "never",
|
|
46
|
+
named: "never",
|
|
47
|
+
asyncArrow: "always"
|
|
48
|
+
}],
|
|
49
|
+
"style/padding-line-between-statements": [
|
|
50
|
+
"error",
|
|
51
|
+
{
|
|
52
|
+
blankLine: "always",
|
|
53
|
+
prev: "*",
|
|
54
|
+
next: "return"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
// src/configs/vue.ts
|
|
60
|
+
var vue = {
|
|
61
|
+
files: [
|
|
62
|
+
"**/*.vue"
|
|
63
|
+
],
|
|
64
|
+
rules: {
|
|
65
|
+
"vue/object-property-newline": ["error", {
|
|
66
|
+
allowAllPropertiesOnSameLine: true
|
|
67
|
+
}],
|
|
68
|
+
"vue/max-attributes-per-line": ["error", {
|
|
69
|
+
singleline: { max: 2 },
|
|
70
|
+
multiline: { max: 1 }
|
|
71
|
+
}]
|
|
72
|
+
}
|
|
73
|
+
};
|
|
1
74
|
// src/define-config.ts
|
|
2
75
|
import antfu from "@antfu/eslint-config";
|
|
3
76
|
function defineConfig(options, ...userConfigs) {
|
|
@@ -8,62 +81,15 @@ function defineConfig(options, ...userConfigs) {
|
|
|
8
81
|
}, ...userConfigs);
|
|
9
82
|
}
|
|
10
83
|
// src/plugins/better-tailwindcss.ts
|
|
11
|
-
import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
|
|
12
|
-
var betterTailwindcssPlugin = {
|
|
13
|
-
"better-tailwindcss": eslintPluginBetterTailwindcss
|
|
14
|
-
};
|
|
15
|
-
// src/rules/markdown.ts
|
|
16
|
-
var markdown = {};
|
|
17
|
-
// src/rules/preset.ts
|
|
18
|
-
var preset = {
|
|
19
|
-
"sort-imports": "off",
|
|
20
|
-
"perfectionist/sort-imports": ["error", {
|
|
21
|
-
ignoreCase: false,
|
|
22
|
-
newlinesBetween: 1,
|
|
23
|
-
partitionByComment: true
|
|
24
|
-
}],
|
|
25
|
-
"perfectionist/sort-exports": ["error", {
|
|
26
|
-
ignoreCase: false,
|
|
27
|
-
newlinesBetween: 1,
|
|
28
|
-
partitionByComment: true
|
|
29
|
-
}],
|
|
30
|
-
"space-before-function-paren": ["error", {
|
|
31
|
-
anonymous: "never",
|
|
32
|
-
named: "never",
|
|
33
|
-
asyncArrow: "always"
|
|
34
|
-
}],
|
|
35
|
-
"style/padding-line-between-statements": [
|
|
36
|
-
"error",
|
|
37
|
-
{
|
|
38
|
-
blankLine: "always",
|
|
39
|
-
prev: "*",
|
|
40
|
-
next: "return"
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
};
|
|
44
|
-
// src/rules/tailwind.ts
|
|
45
84
|
import eslintPluginBetterTailwindcss2 from "eslint-plugin-better-tailwindcss";
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
...eslintPluginBetterTailwindcss2.configs["recommended-error"]?.rules,
|
|
49
|
-
"better-tailwindcss/enforce-consistent-line-wrapping": ["warn", {
|
|
50
|
-
printWidth: 100
|
|
51
|
-
}],
|
|
52
|
-
"better-tailwindcss/no-restricted-classes": "off",
|
|
53
|
-
"better-tailwindcss/no-unknown-classes": "off"
|
|
54
|
-
};
|
|
55
|
-
// src/rules/vue.ts
|
|
56
|
-
var vue = {
|
|
57
|
-
"vue/object-property-newline": ["error", {
|
|
58
|
-
allowAllPropertiesOnSameLine: true
|
|
59
|
-
}]
|
|
85
|
+
var betterTailwindcssPlugin = {
|
|
86
|
+
"better-tailwindcss": eslintPluginBetterTailwindcss2
|
|
60
87
|
};
|
|
61
88
|
export {
|
|
62
89
|
vue,
|
|
90
|
+
typescript,
|
|
63
91
|
tailwind,
|
|
64
|
-
preset,
|
|
65
92
|
markdown,
|
|
66
93
|
defineConfig,
|
|
67
|
-
defineConfig as config,
|
|
68
94
|
betterTailwindcssPlugin
|
|
69
95
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acfatah/eslint-preset",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0-beta.2",
|
|
5
5
|
"description": "Eslint config preset.",
|
|
6
6
|
"author": "Achmad F. Ibrahim <acfatah@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -42,21 +42,19 @@
|
|
|
42
42
|
"release": "bun run build && bunx --bun bumpp"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@antfu/eslint-config": "^
|
|
45
|
+
"@antfu/eslint-config": "^7.7.3",
|
|
46
46
|
"@eslint/markdown": "^7.5.1",
|
|
47
|
-
"bun": "^1.3.11",
|
|
48
47
|
"eslint": "^10.0.3",
|
|
49
48
|
"eslint-plugin-better-tailwindcss": "^4.3.2",
|
|
50
|
-
"eslint-plugin-format": "^
|
|
49
|
+
"eslint-plugin-format": "^2.0.1",
|
|
51
50
|
"eslint-plugin-vue": "^10.8.0",
|
|
52
|
-
"install": "^0.13.0",
|
|
53
51
|
"jiti": "^2.6.1"
|
|
54
52
|
},
|
|
55
53
|
"devDependencies": {
|
|
56
54
|
"@commitlint/cli": "^20.5.0",
|
|
57
55
|
"@commitlint/config-conventional": "^20.5.0",
|
|
58
|
-
"@types/bun": "^1.3.
|
|
59
|
-
"bumpp": "^
|
|
56
|
+
"@types/bun": "^1.3.10",
|
|
57
|
+
"bumpp": "^11.0.1",
|
|
60
58
|
"bun-plugin-dts": "^0.4.0",
|
|
61
59
|
"simple-git-hooks": "^2.13.1"
|
|
62
60
|
},
|