@debbl/eslint-config 3.2.0-beta.3 → 3.2.0-beta.4
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 +17 -27
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +17 -27
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -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
|
}
|
|
@@ -1513,11 +1520,7 @@ async function next() {
|
|
|
1513
1520
|
];
|
|
1514
1521
|
}
|
|
1515
1522
|
var react = async (options) => {
|
|
1516
|
-
const {
|
|
1517
|
-
next: enableNext = false,
|
|
1518
|
-
reactCompiler: enableReactCompiler = false,
|
|
1519
|
-
overrides = {}
|
|
1520
|
-
} = options;
|
|
1523
|
+
const { next: enableNext = false, overrides = {} } = options;
|
|
1521
1524
|
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all(
|
|
1522
1525
|
[
|
|
1523
1526
|
// @ts-expect-error missing types
|
|
@@ -1570,24 +1573,6 @@ var react = async (options) => {
|
|
|
1570
1573
|
}
|
|
1571
1574
|
}
|
|
1572
1575
|
];
|
|
1573
|
-
const reactCompiler = [
|
|
1574
|
-
{
|
|
1575
|
-
name: "eslint/react/compiler",
|
|
1576
|
-
files: [GLOB_TSX, GLOB_JSX],
|
|
1577
|
-
plugins: {
|
|
1578
|
-
"react-compiler": await interopDefault(
|
|
1579
|
-
// @ts-expect-error missing types
|
|
1580
|
-
import("eslint-plugin-react-compiler")
|
|
1581
|
-
)
|
|
1582
|
-
},
|
|
1583
|
-
rules: {
|
|
1584
|
-
"react-compiler/react-compiler": "error"
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
];
|
|
1588
|
-
if (enableReactCompiler) {
|
|
1589
|
-
_react.push(...reactCompiler);
|
|
1590
|
-
}
|
|
1591
1576
|
return combine(_react, enableNext ? next() : []);
|
|
1592
1577
|
};
|
|
1593
1578
|
|
|
@@ -1679,11 +1664,16 @@ function config(options = {}) {
|
|
|
1679
1664
|
})
|
|
1680
1665
|
);
|
|
1681
1666
|
}
|
|
1682
|
-
if (enableTailwindcss) {
|
|
1667
|
+
if (typeof enableTailwindcss === "boolean" && enableTailwindcss) {
|
|
1683
1668
|
configs.push(tailwindcss());
|
|
1684
1669
|
}
|
|
1685
1670
|
if (options.prettier ?? true) {
|
|
1686
|
-
configs.push(
|
|
1671
|
+
configs.push(
|
|
1672
|
+
prettier({
|
|
1673
|
+
...getConfigOption(options.prettier),
|
|
1674
|
+
tailwindcss: enableTailwindcss === "prettier"
|
|
1675
|
+
})
|
|
1676
|
+
);
|
|
1687
1677
|
}
|
|
1688
1678
|
const merged = combine(...configs, options.customConfig ?? []);
|
|
1689
1679
|
return merged;
|
package/dist/index.d.cts
CHANGED
|
@@ -4,8 +4,6 @@ import { RequiredOptions } from 'prettier';
|
|
|
4
4
|
|
|
5
5
|
type ReactConfig = (options: {
|
|
6
6
|
next?: boolean;
|
|
7
|
-
/** only work in react@19 */
|
|
8
|
-
reactCompiler?: boolean;
|
|
9
7
|
} & OptionsOverrides) => ReturnType<ConfigFn>;
|
|
10
8
|
|
|
11
9
|
declare function comments(): Promise<ConfigItem[]>;
|
|
@@ -73,7 +71,9 @@ declare const test: TestConfig;
|
|
|
73
71
|
declare function perfectionist(): Promise<ConfigItem[]>;
|
|
74
72
|
|
|
75
73
|
type PrettierRequiredOptions = Partial<RequiredOptions>;
|
|
76
|
-
type PrettierConfig = (options: PrettierRequiredOptions
|
|
74
|
+
type PrettierConfig = ({ options, }: PrettierRequiredOptions & {
|
|
75
|
+
tailwindcss?: boolean;
|
|
76
|
+
}) => Promise<ConfigItem[]>;
|
|
77
77
|
declare const prettier: PrettierConfig;
|
|
78
78
|
|
|
79
79
|
type Awaitable<T> = T | Promise<T>;
|
|
@@ -182,12 +182,13 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
182
182
|
*
|
|
183
183
|
* @default true
|
|
184
184
|
*/
|
|
185
|
-
prettier?: boolean | GetConfigOption<PrettierConfig>;
|
|
185
|
+
prettier?: boolean | Omit<GetConfigOption<PrettierConfig>, "tailwindcss">;
|
|
186
186
|
/**
|
|
187
187
|
* Enable Tailwind CSS support.
|
|
188
|
+
* if set to "prettier", it will use `prettier-plugin-tailwindcss` @see https://github.com/tailwindlabs/prettier-plugin-tailwindcss
|
|
188
189
|
* @default false
|
|
189
190
|
*/
|
|
190
|
-
tailwindcss?: boolean;
|
|
191
|
+
tailwindcss?: boolean | "prettier";
|
|
191
192
|
/**
|
|
192
193
|
* Custom config
|
|
193
194
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,6 @@ import { RequiredOptions } from 'prettier';
|
|
|
4
4
|
|
|
5
5
|
type ReactConfig = (options: {
|
|
6
6
|
next?: boolean;
|
|
7
|
-
/** only work in react@19 */
|
|
8
|
-
reactCompiler?: boolean;
|
|
9
7
|
} & OptionsOverrides) => ReturnType<ConfigFn>;
|
|
10
8
|
|
|
11
9
|
declare function comments(): Promise<ConfigItem[]>;
|
|
@@ -73,7 +71,9 @@ declare const test: TestConfig;
|
|
|
73
71
|
declare function perfectionist(): Promise<ConfigItem[]>;
|
|
74
72
|
|
|
75
73
|
type PrettierRequiredOptions = Partial<RequiredOptions>;
|
|
76
|
-
type PrettierConfig = (options: PrettierRequiredOptions
|
|
74
|
+
type PrettierConfig = ({ options, }: PrettierRequiredOptions & {
|
|
75
|
+
tailwindcss?: boolean;
|
|
76
|
+
}) => Promise<ConfigItem[]>;
|
|
77
77
|
declare const prettier: PrettierConfig;
|
|
78
78
|
|
|
79
79
|
type Awaitable<T> = T | Promise<T>;
|
|
@@ -182,12 +182,13 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
182
182
|
*
|
|
183
183
|
* @default true
|
|
184
184
|
*/
|
|
185
|
-
prettier?: boolean | GetConfigOption<PrettierConfig>;
|
|
185
|
+
prettier?: boolean | Omit<GetConfigOption<PrettierConfig>, "tailwindcss">;
|
|
186
186
|
/**
|
|
187
187
|
* Enable Tailwind CSS support.
|
|
188
|
+
* if set to "prettier", it will use `prettier-plugin-tailwindcss` @see https://github.com/tailwindlabs/prettier-plugin-tailwindcss
|
|
188
189
|
* @default false
|
|
189
190
|
*/
|
|
190
|
-
tailwindcss?: boolean;
|
|
191
|
+
tailwindcss?: boolean | "prettier";
|
|
191
192
|
/**
|
|
192
193
|
* Custom config
|
|
193
194
|
*/
|
package/dist/index.js
CHANGED
|
@@ -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
|
}
|
|
@@ -1431,11 +1438,7 @@ async function next() {
|
|
|
1431
1438
|
];
|
|
1432
1439
|
}
|
|
1433
1440
|
var react = async (options) => {
|
|
1434
|
-
const {
|
|
1435
|
-
next: enableNext = false,
|
|
1436
|
-
reactCompiler: enableReactCompiler = false,
|
|
1437
|
-
overrides = {}
|
|
1438
|
-
} = options;
|
|
1441
|
+
const { next: enableNext = false, overrides = {} } = options;
|
|
1439
1442
|
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all(
|
|
1440
1443
|
[
|
|
1441
1444
|
// @ts-expect-error missing types
|
|
@@ -1488,24 +1491,6 @@ var react = async (options) => {
|
|
|
1488
1491
|
}
|
|
1489
1492
|
}
|
|
1490
1493
|
];
|
|
1491
|
-
const reactCompiler = [
|
|
1492
|
-
{
|
|
1493
|
-
name: "eslint/react/compiler",
|
|
1494
|
-
files: [GLOB_TSX, GLOB_JSX],
|
|
1495
|
-
plugins: {
|
|
1496
|
-
"react-compiler": await interopDefault(
|
|
1497
|
-
// @ts-expect-error missing types
|
|
1498
|
-
import("eslint-plugin-react-compiler")
|
|
1499
|
-
)
|
|
1500
|
-
},
|
|
1501
|
-
rules: {
|
|
1502
|
-
"react-compiler/react-compiler": "error"
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
];
|
|
1506
|
-
if (enableReactCompiler) {
|
|
1507
|
-
_react.push(...reactCompiler);
|
|
1508
|
-
}
|
|
1509
1494
|
return combine(_react, enableNext ? next() : []);
|
|
1510
1495
|
};
|
|
1511
1496
|
|
|
@@ -1597,11 +1582,16 @@ function config(options = {}) {
|
|
|
1597
1582
|
})
|
|
1598
1583
|
);
|
|
1599
1584
|
}
|
|
1600
|
-
if (enableTailwindcss) {
|
|
1585
|
+
if (typeof enableTailwindcss === "boolean" && enableTailwindcss) {
|
|
1601
1586
|
configs.push(tailwindcss());
|
|
1602
1587
|
}
|
|
1603
1588
|
if (options.prettier ?? true) {
|
|
1604
|
-
configs.push(
|
|
1589
|
+
configs.push(
|
|
1590
|
+
prettier({
|
|
1591
|
+
...getConfigOption(options.prettier),
|
|
1592
|
+
tailwindcss: enableTailwindcss === "prettier"
|
|
1593
|
+
})
|
|
1594
|
+
);
|
|
1605
1595
|
}
|
|
1606
1596
|
const merged = combine(...configs, options.customConfig ?? []);
|
|
1607
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.2.0-beta.
|
|
4
|
+
"version": "3.2.0-beta.4",
|
|
5
5
|
"description": "Brendan Dash's ESLint config",
|
|
6
6
|
"author": "Debbl <me@aiwan.run> (https://github.com/Debbl/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"globals": "^15.2.0",
|
|
56
56
|
"jsonc-eslint-parser": "^2.4.0",
|
|
57
57
|
"prettier": "^3.2.5",
|
|
58
|
+
"prettier-plugin-tailwindcss": "^0.5.14",
|
|
58
59
|
"toml-eslint-parser": "^0.9.3",
|
|
59
60
|
"vue-eslint-parser": "^9.4.2",
|
|
60
61
|
"yaml-eslint-parser": "^1.2.2"
|