@debbl/eslint-config 3.1.5 → 3.1.7
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/dist/index.cjs +46 -34
- package/dist/index.d.cts +8 -9
- package/dist/index.d.ts +8 -9
- package/dist/index.js +46 -34
- package/package.json +4 -10
package/dist/index.cjs
CHANGED
|
@@ -80,6 +80,36 @@ __export(src_exports, {
|
|
|
80
80
|
});
|
|
81
81
|
module.exports = __toCommonJS(src_exports);
|
|
82
82
|
|
|
83
|
+
// src/utils.ts
|
|
84
|
+
var parserPlain = {
|
|
85
|
+
meta: {
|
|
86
|
+
name: "parser-plain"
|
|
87
|
+
},
|
|
88
|
+
parseForESLint: (code) => ({
|
|
89
|
+
ast: {
|
|
90
|
+
body: [],
|
|
91
|
+
comments: [],
|
|
92
|
+
loc: { end: code.length, start: 0 },
|
|
93
|
+
range: [0, code.length],
|
|
94
|
+
tokens: [],
|
|
95
|
+
type: "Program"
|
|
96
|
+
},
|
|
97
|
+
scopeManager: null,
|
|
98
|
+
services: { isPlain: true },
|
|
99
|
+
visitorKeys: {
|
|
100
|
+
Program: []
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
};
|
|
104
|
+
async function combine(...configs) {
|
|
105
|
+
const resolved = await Promise.all(configs);
|
|
106
|
+
return resolved.flat();
|
|
107
|
+
}
|
|
108
|
+
async function interopDefault(m) {
|
|
109
|
+
const resolved = await m;
|
|
110
|
+
return resolved.default || resolved;
|
|
111
|
+
}
|
|
112
|
+
|
|
83
113
|
// src/configs/comments.ts
|
|
84
114
|
async function comments() {
|
|
85
115
|
const pluginComments = await interopDefault(
|
|
@@ -201,36 +231,6 @@ var ignores = async (options) => {
|
|
|
201
231
|
];
|
|
202
232
|
};
|
|
203
233
|
|
|
204
|
-
// src/utils.ts
|
|
205
|
-
var parserPlain = {
|
|
206
|
-
meta: {
|
|
207
|
-
name: "parser-plain"
|
|
208
|
-
},
|
|
209
|
-
parseForESLint: (code) => ({
|
|
210
|
-
ast: {
|
|
211
|
-
body: [],
|
|
212
|
-
comments: [],
|
|
213
|
-
loc: { end: code.length, start: 0 },
|
|
214
|
-
range: [0, code.length],
|
|
215
|
-
tokens: [],
|
|
216
|
-
type: "Program"
|
|
217
|
-
},
|
|
218
|
-
scopeManager: null,
|
|
219
|
-
services: { isPlain: true },
|
|
220
|
-
visitorKeys: {
|
|
221
|
-
Program: []
|
|
222
|
-
}
|
|
223
|
-
})
|
|
224
|
-
};
|
|
225
|
-
async function combine(...configs) {
|
|
226
|
-
const resolved = await Promise.all(configs);
|
|
227
|
-
return resolved.flat();
|
|
228
|
-
}
|
|
229
|
-
async function interopDefault(m) {
|
|
230
|
-
const resolved = await m;
|
|
231
|
-
return resolved.default || resolved;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
234
|
// src/configs/imports.ts
|
|
235
235
|
async function imports() {
|
|
236
236
|
const pluginImport = await interopDefault(import("eslint-plugin-import-x"));
|
|
@@ -1383,7 +1383,7 @@ async function perfectionist() {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
|
|
1385
1385
|
// src/configs/prettier.ts
|
|
1386
|
-
var prettier = async (options) => {
|
|
1386
|
+
var prettier = async ({ tailwindcss: tailwindcss2, ...options }) => {
|
|
1387
1387
|
const [pluginPrettier, configPrettier] = await Promise.all([
|
|
1388
1388
|
interopDefault(import("eslint-plugin-prettier")),
|
|
1389
1389
|
// @ts-expect-error missing types
|
|
@@ -1458,11 +1458,18 @@ var prettier = async (options) => {
|
|
|
1458
1458
|
name: "eslint/prettier/rules",
|
|
1459
1459
|
ignores: [GLOB_TOML],
|
|
1460
1460
|
rules: {
|
|
1461
|
+
// disable rules with prettier conflicts
|
|
1461
1462
|
...configPrettier.rules,
|
|
1462
|
-
|
|
1463
|
+
// eslint-plugin-prettier recommended rules
|
|
1464
|
+
...{
|
|
1465
|
+
"prettier/prettier": "error",
|
|
1466
|
+
"arrow-body-style": "off",
|
|
1467
|
+
"prefer-arrow-callback": "off"
|
|
1468
|
+
},
|
|
1463
1469
|
"prettier/prettier": [
|
|
1464
1470
|
"warn",
|
|
1465
1471
|
{
|
|
1472
|
+
plugins: tailwindcss2 ? ["prettier-plugin-tailwindcss"] : [],
|
|
1466
1473
|
quoteProps: "consistent",
|
|
1467
1474
|
...options
|
|
1468
1475
|
}
|
|
@@ -1657,11 +1664,16 @@ function config(options = {}) {
|
|
|
1657
1664
|
})
|
|
1658
1665
|
);
|
|
1659
1666
|
}
|
|
1660
|
-
if (enableTailwindcss) {
|
|
1667
|
+
if (typeof enableTailwindcss === "boolean" && enableTailwindcss) {
|
|
1661
1668
|
configs.push(tailwindcss());
|
|
1662
1669
|
}
|
|
1663
1670
|
if (options.prettier ?? true) {
|
|
1664
|
-
configs.push(
|
|
1671
|
+
configs.push(
|
|
1672
|
+
prettier({
|
|
1673
|
+
...getConfigOption(options.prettier),
|
|
1674
|
+
tailwindcss: enableTailwindcss === "prettier"
|
|
1675
|
+
})
|
|
1676
|
+
);
|
|
1665
1677
|
}
|
|
1666
1678
|
const merged = combine(...configs, options.customConfig ?? []);
|
|
1667
1679
|
return merged;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
2
|
-
import {
|
|
2
|
+
import { Linter } from 'eslint';
|
|
3
3
|
import { RequiredOptions } from 'prettier';
|
|
4
4
|
|
|
5
5
|
type ReactConfig = (options: {
|
|
@@ -71,16 +71,14 @@ declare const test: TestConfig;
|
|
|
71
71
|
declare function perfectionist(): Promise<ConfigItem[]>;
|
|
72
72
|
|
|
73
73
|
type PrettierRequiredOptions = Partial<RequiredOptions>;
|
|
74
|
-
type PrettierConfig = (options: PrettierRequiredOptions
|
|
74
|
+
type PrettierConfig = ({ options, }: PrettierRequiredOptions & {
|
|
75
|
+
tailwindcss?: boolean;
|
|
76
|
+
}) => Promise<ConfigItem[]>;
|
|
75
77
|
declare const prettier: PrettierConfig;
|
|
76
78
|
|
|
77
79
|
type Awaitable<T> = T | Promise<T>;
|
|
78
80
|
type GetConfigOption<T extends (...args: any) => any> = Parameters<T>[0];
|
|
79
|
-
interface ConfigItem extends
|
|
80
|
-
/**
|
|
81
|
-
* Custom name of each config item
|
|
82
|
-
*/
|
|
83
|
-
name?: string;
|
|
81
|
+
interface ConfigItem extends Linter.FlatConfig {
|
|
84
82
|
/**
|
|
85
83
|
* An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
|
|
86
84
|
*
|
|
@@ -184,12 +182,13 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
184
182
|
*
|
|
185
183
|
* @default true
|
|
186
184
|
*/
|
|
187
|
-
prettier?: boolean | GetConfigOption<PrettierConfig>;
|
|
185
|
+
prettier?: boolean | Omit<GetConfigOption<PrettierConfig>, "tailwindcss">;
|
|
188
186
|
/**
|
|
189
187
|
* Enable Tailwind CSS support.
|
|
188
|
+
* if set to "prettier", it will use `prettier-plugin-tailwindcss`
|
|
190
189
|
* @default false
|
|
191
190
|
*/
|
|
192
|
-
tailwindcss?: boolean;
|
|
191
|
+
tailwindcss?: boolean | "prettier";
|
|
193
192
|
/**
|
|
194
193
|
* Custom config
|
|
195
194
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
2
|
-
import {
|
|
2
|
+
import { Linter } from 'eslint';
|
|
3
3
|
import { RequiredOptions } from 'prettier';
|
|
4
4
|
|
|
5
5
|
type ReactConfig = (options: {
|
|
@@ -71,16 +71,14 @@ declare const test: TestConfig;
|
|
|
71
71
|
declare function perfectionist(): Promise<ConfigItem[]>;
|
|
72
72
|
|
|
73
73
|
type PrettierRequiredOptions = Partial<RequiredOptions>;
|
|
74
|
-
type PrettierConfig = (options: PrettierRequiredOptions
|
|
74
|
+
type PrettierConfig = ({ options, }: PrettierRequiredOptions & {
|
|
75
|
+
tailwindcss?: boolean;
|
|
76
|
+
}) => Promise<ConfigItem[]>;
|
|
75
77
|
declare const prettier: PrettierConfig;
|
|
76
78
|
|
|
77
79
|
type Awaitable<T> = T | Promise<T>;
|
|
78
80
|
type GetConfigOption<T extends (...args: any) => any> = Parameters<T>[0];
|
|
79
|
-
interface ConfigItem extends
|
|
80
|
-
/**
|
|
81
|
-
* Custom name of each config item
|
|
82
|
-
*/
|
|
83
|
-
name?: string;
|
|
81
|
+
interface ConfigItem extends Linter.FlatConfig {
|
|
84
82
|
/**
|
|
85
83
|
* An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
|
|
86
84
|
*
|
|
@@ -184,12 +182,13 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
184
182
|
*
|
|
185
183
|
* @default true
|
|
186
184
|
*/
|
|
187
|
-
prettier?: boolean | GetConfigOption<PrettierConfig>;
|
|
185
|
+
prettier?: boolean | Omit<GetConfigOption<PrettierConfig>, "tailwindcss">;
|
|
188
186
|
/**
|
|
189
187
|
* Enable Tailwind CSS support.
|
|
188
|
+
* if set to "prettier", it will use `prettier-plugin-tailwindcss`
|
|
190
189
|
* @default false
|
|
191
190
|
*/
|
|
192
|
-
tailwindcss?: boolean;
|
|
191
|
+
tailwindcss?: boolean | "prettier";
|
|
193
192
|
/**
|
|
194
193
|
* Custom config
|
|
195
194
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
// src/utils.ts
|
|
2
|
+
var parserPlain = {
|
|
3
|
+
meta: {
|
|
4
|
+
name: "parser-plain"
|
|
5
|
+
},
|
|
6
|
+
parseForESLint: (code) => ({
|
|
7
|
+
ast: {
|
|
8
|
+
body: [],
|
|
9
|
+
comments: [],
|
|
10
|
+
loc: { end: code.length, start: 0 },
|
|
11
|
+
range: [0, code.length],
|
|
12
|
+
tokens: [],
|
|
13
|
+
type: "Program"
|
|
14
|
+
},
|
|
15
|
+
scopeManager: null,
|
|
16
|
+
services: { isPlain: true },
|
|
17
|
+
visitorKeys: {
|
|
18
|
+
Program: []
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
async function combine(...configs) {
|
|
23
|
+
const resolved = await Promise.all(configs);
|
|
24
|
+
return resolved.flat();
|
|
25
|
+
}
|
|
26
|
+
async function interopDefault(m) {
|
|
27
|
+
const resolved = await m;
|
|
28
|
+
return resolved.default || resolved;
|
|
29
|
+
}
|
|
30
|
+
|
|
1
31
|
// src/configs/comments.ts
|
|
2
32
|
async function comments() {
|
|
3
33
|
const pluginComments = await interopDefault(
|
|
@@ -119,36 +149,6 @@ var ignores = async (options) => {
|
|
|
119
149
|
];
|
|
120
150
|
};
|
|
121
151
|
|
|
122
|
-
// src/utils.ts
|
|
123
|
-
var parserPlain = {
|
|
124
|
-
meta: {
|
|
125
|
-
name: "parser-plain"
|
|
126
|
-
},
|
|
127
|
-
parseForESLint: (code) => ({
|
|
128
|
-
ast: {
|
|
129
|
-
body: [],
|
|
130
|
-
comments: [],
|
|
131
|
-
loc: { end: code.length, start: 0 },
|
|
132
|
-
range: [0, code.length],
|
|
133
|
-
tokens: [],
|
|
134
|
-
type: "Program"
|
|
135
|
-
},
|
|
136
|
-
scopeManager: null,
|
|
137
|
-
services: { isPlain: true },
|
|
138
|
-
visitorKeys: {
|
|
139
|
-
Program: []
|
|
140
|
-
}
|
|
141
|
-
})
|
|
142
|
-
};
|
|
143
|
-
async function combine(...configs) {
|
|
144
|
-
const resolved = await Promise.all(configs);
|
|
145
|
-
return resolved.flat();
|
|
146
|
-
}
|
|
147
|
-
async function interopDefault(m) {
|
|
148
|
-
const resolved = await m;
|
|
149
|
-
return resolved.default || resolved;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
152
|
// src/configs/imports.ts
|
|
153
153
|
async function imports() {
|
|
154
154
|
const pluginImport = await interopDefault(import("eslint-plugin-import-x"));
|
|
@@ -1301,7 +1301,7 @@ async function perfectionist() {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
|
|
1303
1303
|
// src/configs/prettier.ts
|
|
1304
|
-
var prettier = async (options) => {
|
|
1304
|
+
var prettier = async ({ tailwindcss: tailwindcss2, ...options }) => {
|
|
1305
1305
|
const [pluginPrettier, configPrettier] = await Promise.all([
|
|
1306
1306
|
interopDefault(import("eslint-plugin-prettier")),
|
|
1307
1307
|
// @ts-expect-error missing types
|
|
@@ -1376,11 +1376,18 @@ var prettier = async (options) => {
|
|
|
1376
1376
|
name: "eslint/prettier/rules",
|
|
1377
1377
|
ignores: [GLOB_TOML],
|
|
1378
1378
|
rules: {
|
|
1379
|
+
// disable rules with prettier conflicts
|
|
1379
1380
|
...configPrettier.rules,
|
|
1380
|
-
|
|
1381
|
+
// eslint-plugin-prettier recommended rules
|
|
1382
|
+
...{
|
|
1383
|
+
"prettier/prettier": "error",
|
|
1384
|
+
"arrow-body-style": "off",
|
|
1385
|
+
"prefer-arrow-callback": "off"
|
|
1386
|
+
},
|
|
1381
1387
|
"prettier/prettier": [
|
|
1382
1388
|
"warn",
|
|
1383
1389
|
{
|
|
1390
|
+
plugins: tailwindcss2 ? ["prettier-plugin-tailwindcss"] : [],
|
|
1384
1391
|
quoteProps: "consistent",
|
|
1385
1392
|
...options
|
|
1386
1393
|
}
|
|
@@ -1575,11 +1582,16 @@ function config(options = {}) {
|
|
|
1575
1582
|
})
|
|
1576
1583
|
);
|
|
1577
1584
|
}
|
|
1578
|
-
if (enableTailwindcss) {
|
|
1585
|
+
if (typeof enableTailwindcss === "boolean" && enableTailwindcss) {
|
|
1579
1586
|
configs.push(tailwindcss());
|
|
1580
1587
|
}
|
|
1581
1588
|
if (options.prettier ?? true) {
|
|
1582
|
-
configs.push(
|
|
1589
|
+
configs.push(
|
|
1590
|
+
prettier({
|
|
1591
|
+
...getConfigOption(options.prettier),
|
|
1592
|
+
tailwindcss: enableTailwindcss === "prettier"
|
|
1593
|
+
})
|
|
1594
|
+
);
|
|
1583
1595
|
}
|
|
1584
1596
|
const merged = combine(...configs, options.customConfig ?? []);
|
|
1585
1597
|
return merged;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@debbl/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.7",
|
|
5
5
|
"description": "Brendan Dash's ESLint config",
|
|
6
6
|
"author": "Debbl <me@aiwan.run> (https://github.com/Debbl/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -23,20 +23,13 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"eslint": ">=8.40.0"
|
|
27
|
-
"eslint-plugin-tailwindcss": "^3.15.1"
|
|
28
|
-
},
|
|
29
|
-
"peerDependenciesMeta": {
|
|
30
|
-
"eslint-plugin-tailwindcss": {
|
|
31
|
-
"optional": true
|
|
32
|
-
}
|
|
26
|
+
"eslint": ">=8.40.0"
|
|
33
27
|
},
|
|
34
28
|
"dependencies": {
|
|
35
29
|
"@next/eslint-plugin-next": "^14.2.3",
|
|
36
30
|
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
|
37
31
|
"@typescript-eslint/parser": "^7.8.0",
|
|
38
32
|
"eslint-config-prettier": "^9.1.0",
|
|
39
|
-
"eslint-define-config": "^2.1.0",
|
|
40
33
|
"eslint-mdx": "^3.1.5",
|
|
41
34
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
42
35
|
"eslint-plugin-import-x": "^0.5.0",
|
|
@@ -51,6 +44,7 @@
|
|
|
51
44
|
"eslint-plugin-react": "^7.34.1",
|
|
52
45
|
"eslint-plugin-react-hooks": "4.6.2",
|
|
53
46
|
"eslint-plugin-react-refresh": "^0.4.6",
|
|
47
|
+
"eslint-plugin-tailwindcss": "^3.15.2",
|
|
54
48
|
"eslint-plugin-toml": "^0.11.0",
|
|
55
49
|
"eslint-plugin-unicorn": "^52.0.0",
|
|
56
50
|
"eslint-plugin-unused-imports": "^3.2.0",
|
|
@@ -60,6 +54,7 @@
|
|
|
60
54
|
"globals": "^15.1.0",
|
|
61
55
|
"jsonc-eslint-parser": "^2.4.0",
|
|
62
56
|
"prettier": "^3.2.5",
|
|
57
|
+
"prettier-plugin-tailwindcss": "^0.5.14",
|
|
63
58
|
"toml-eslint-parser": "^0.9.3",
|
|
64
59
|
"vue-eslint-parser": "^9.4.2",
|
|
65
60
|
"yaml-eslint-parser": "^1.2.2"
|
|
@@ -71,7 +66,6 @@
|
|
|
71
66
|
"@types/react": "^18.3.1",
|
|
72
67
|
"bumpp": "^9.4.1",
|
|
73
68
|
"eslint": "^8.57.0",
|
|
74
|
-
"eslint-plugin-tailwindcss": "^3.15.1",
|
|
75
69
|
"execa": "^8.0.1",
|
|
76
70
|
"fast-glob": "^3.3.2",
|
|
77
71
|
"fs-extra": "^11.2.0",
|