js-style-kit 0.8.1 → 0.8.3
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/bin/index.cjs +1 -1
- package/dist/bin/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +55 -43
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/eslint/convex/README.md +48 -0
- package/src/eslint/convex/config.ts +14 -1
- package/src/eslint/ignores.ts +1 -0
- package/src/eslint/index.ts +52 -50
- package/src/eslint/unicorn/README.md +17 -0
package/dist/index.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ interface EslintConfigOptions {
|
|
|
87
87
|
* @param options - The optional configuration object.
|
|
88
88
|
* @param options.convex - Whether to include Convex rules.
|
|
89
89
|
* @param options.functionStyle - The function style to enforce. Defaults to "arrow".
|
|
90
|
-
* @param options.ignores - Additional paths to ignore. Already excludes `node_modules` and `
|
|
90
|
+
* @param options.ignores - Additional paths to ignore. Already excludes `node_modules`, `dist`, and `build`.
|
|
91
91
|
* @param options.importPlugin - Whether to include the import plugin. Defaults to true.
|
|
92
92
|
* @param options.jsdoc - Whether to include JSDoc rules. Set to false to disable, or provide an object to configure.
|
|
93
93
|
* @param options.query - Whether to include TanStack Query rules.
|
package/dist/index.js
CHANGED
|
@@ -499,7 +499,7 @@ var convexRules = {
|
|
|
499
499
|
// src/eslint/convex/config.ts
|
|
500
500
|
var require2 = createRequire(import.meta.url);
|
|
501
501
|
var convexPlugin = require2("@convex-dev/eslint-plugin");
|
|
502
|
-
var convexConfig = (customRules) => ({
|
|
502
|
+
var convexConfig = (customRules, unicorn2) => ({
|
|
503
503
|
files: ["**/convex/**/*.{ts,js}"],
|
|
504
504
|
name: configNames.convex,
|
|
505
505
|
plugins: {
|
|
@@ -507,7 +507,16 @@ var convexConfig = (customRules) => ({
|
|
|
507
507
|
},
|
|
508
508
|
rules: {
|
|
509
509
|
...convexRules,
|
|
510
|
-
...customRules ?? {}
|
|
510
|
+
...customRules ?? {},
|
|
511
|
+
// Convex files must be camelCase
|
|
512
|
+
...unicorn2 ? {
|
|
513
|
+
"unicorn/filename-case": [
|
|
514
|
+
"warn",
|
|
515
|
+
{
|
|
516
|
+
case: "camelCase"
|
|
517
|
+
}
|
|
518
|
+
]
|
|
519
|
+
} : {}
|
|
511
520
|
}
|
|
512
521
|
});
|
|
513
522
|
|
|
@@ -519,6 +528,7 @@ var ignoresConfig = ({
|
|
|
519
528
|
}) => ({
|
|
520
529
|
ignores: [
|
|
521
530
|
"**/dist/",
|
|
531
|
+
"**/build/",
|
|
522
532
|
...reactFramework === "next" ? [".next"] : [],
|
|
523
533
|
...reactFramework === "react-router" ? [".react-router"] : [],
|
|
524
534
|
...storybook ? ["!.storybook"] : [],
|
|
@@ -1653,11 +1663,10 @@ var eslintConfig = ({
|
|
|
1653
1663
|
categorizedRules[configNames.base]
|
|
1654
1664
|
)
|
|
1655
1665
|
];
|
|
1656
|
-
if (
|
|
1666
|
+
if (functionStyle === "arrow") {
|
|
1657
1667
|
configs.push(
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
categorizedRules[configNames.jsdoc]
|
|
1668
|
+
preferArrowFunctionConfig(
|
|
1669
|
+
categorizedRules[configNames.preferArrowFunction]
|
|
1661
1670
|
)
|
|
1662
1671
|
);
|
|
1663
1672
|
}
|
|
@@ -1674,35 +1683,27 @@ var eslintConfig = ({
|
|
|
1674
1683
|
importConfig(Boolean(typescript), categorizedRules[configNames.import])
|
|
1675
1684
|
);
|
|
1676
1685
|
}
|
|
1677
|
-
if (
|
|
1678
|
-
const
|
|
1679
|
-
const shouldUseReactRefresh = (
|
|
1680
|
-
// Explicit setting takes precedence
|
|
1681
|
-
reactOptions.reactRefresh === true || // Framework-based default (vite/none use reactRefresh by default)
|
|
1682
|
-
(reactOptions.framework === "vite" || reactOptions.framework === "none") && reactOptions.reactRefresh !== false
|
|
1683
|
-
);
|
|
1684
|
-
if (shouldUseReactRefresh) {
|
|
1685
|
-
configs.push(
|
|
1686
|
-
reactRefreshEslintConfig(categorizedRules[configNames.reactRefresh])
|
|
1687
|
-
);
|
|
1688
|
-
}
|
|
1686
|
+
if (unicorn2) {
|
|
1687
|
+
const filenameCase = isObject(unicorn2) ? unicorn2.filenameCase : void 0;
|
|
1689
1688
|
configs.push(
|
|
1690
|
-
|
|
1691
|
-
customRules: categorizedRules[configNames.
|
|
1692
|
-
|
|
1693
|
-
reactCompiler: reactOptions.reactCompiler ?? true,
|
|
1694
|
-
typescript: Boolean(typescript)
|
|
1689
|
+
unicornConfig({
|
|
1690
|
+
customRules: categorizedRules[configNames.unicorn],
|
|
1691
|
+
filenameCase
|
|
1695
1692
|
})
|
|
1696
1693
|
);
|
|
1697
|
-
if (isObject(react2) && react2.framework === "next") {
|
|
1698
|
-
configs.push(nextjsConfig(categorizedRules[configNames.nextjs]));
|
|
1699
|
-
}
|
|
1700
1694
|
}
|
|
1701
|
-
if (
|
|
1702
|
-
configs.push(
|
|
1695
|
+
if (sorting) {
|
|
1696
|
+
configs.push(
|
|
1697
|
+
perfectionistConfig(categorizedRules[configNames.perfectionist])
|
|
1698
|
+
);
|
|
1703
1699
|
}
|
|
1704
|
-
if (
|
|
1705
|
-
configs.push(
|
|
1700
|
+
if (jsdoc2 !== false) {
|
|
1701
|
+
configs.push(
|
|
1702
|
+
jsdocConfig(
|
|
1703
|
+
jsdoc2.requireJsdoc ?? false,
|
|
1704
|
+
categorizedRules[configNames.jsdoc]
|
|
1705
|
+
)
|
|
1706
|
+
);
|
|
1706
1707
|
}
|
|
1707
1708
|
if (testing !== false) {
|
|
1708
1709
|
const defaultTestingConfig = {
|
|
@@ -1737,25 +1738,36 @@ var eslintConfig = ({
|
|
|
1737
1738
|
)
|
|
1738
1739
|
);
|
|
1739
1740
|
}
|
|
1740
|
-
if (
|
|
1741
|
-
|
|
1742
|
-
|
|
1741
|
+
if (react2) {
|
|
1742
|
+
const reactOptions = isObject(react2) ? react2 : {};
|
|
1743
|
+
const shouldUseReactRefresh = (
|
|
1744
|
+
// Explicit setting takes precedence
|
|
1745
|
+
reactOptions.reactRefresh === true || // Framework-based default (vite/none use reactRefresh by default)
|
|
1746
|
+
(reactOptions.framework === "vite" || reactOptions.framework === "none") && reactOptions.reactRefresh !== false
|
|
1743
1747
|
);
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1748
|
+
if (shouldUseReactRefresh) {
|
|
1749
|
+
configs.push(
|
|
1750
|
+
reactRefreshEslintConfig(categorizedRules[configNames.reactRefresh])
|
|
1751
|
+
);
|
|
1752
|
+
}
|
|
1747
1753
|
configs.push(
|
|
1748
|
-
|
|
1749
|
-
customRules: categorizedRules[configNames.
|
|
1750
|
-
|
|
1754
|
+
reactEslintConfig({
|
|
1755
|
+
customRules: categorizedRules[configNames.react],
|
|
1756
|
+
functionStyle,
|
|
1757
|
+
reactCompiler: reactOptions.reactCompiler ?? true,
|
|
1758
|
+
typescript: Boolean(typescript)
|
|
1751
1759
|
})
|
|
1752
1760
|
);
|
|
1761
|
+
if (isObject(react2) && react2.framework === "next") {
|
|
1762
|
+
configs.push(nextjsConfig(categorizedRules[configNames.nextjs]));
|
|
1763
|
+
}
|
|
1753
1764
|
}
|
|
1754
|
-
if (
|
|
1765
|
+
if (query) {
|
|
1766
|
+
configs.push(queryConfig(categorizedRules[configNames.query]));
|
|
1767
|
+
}
|
|
1768
|
+
if (convex) {
|
|
1755
1769
|
configs.push(
|
|
1756
|
-
|
|
1757
|
-
categorizedRules[configNames.preferArrowFunction]
|
|
1758
|
-
)
|
|
1770
|
+
convexConfig(categorizedRules[configNames.convex], Boolean(unicorn2))
|
|
1759
1771
|
);
|
|
1760
1772
|
}
|
|
1761
1773
|
if (storybook) {
|