@zayne-labs/eslint-config 0.3.0 → 0.4.0
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 +17 -22
- package/dist/chunk-VUNV25KB.js +14 -0
- package/dist/chunk-VUNV25KB.js.map +1 -0
- package/dist/dist-RQW5ZYTC.js +235156 -0
- package/dist/dist-RQW5ZYTC.js.map +1 -0
- package/dist/index.d.ts +4272 -967
- package/dist/index.js +372 -39
- package/dist/index.js.map +1 -1
- package/package.json +59 -41
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import './chunk-VUNV25KB.js';
|
|
1
2
|
import { fileURLToPath } from 'node:url';
|
|
2
3
|
import { isPackageExists } from 'local-pkg';
|
|
3
4
|
import globals from 'globals';
|
|
4
5
|
import { fixupPluginRules } from '@eslint/compat';
|
|
6
|
+
import { mergeProcessors } from 'eslint-merge-processors';
|
|
5
7
|
import { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
6
8
|
|
|
7
|
-
// src/utils.ts
|
|
8
9
|
var isObject = (value) => {
|
|
9
10
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10
11
|
};
|
|
@@ -610,7 +611,10 @@ var unicorn = async (options = {}) => {
|
|
|
610
611
|
const { overrides, type = "app" } = options;
|
|
611
612
|
const eslintPluginUnicorn = await interopDefault(import('eslint-plugin-unicorn'));
|
|
612
613
|
return [
|
|
613
|
-
{
|
|
614
|
+
{
|
|
615
|
+
...eslintPluginUnicorn.configs["flat/recommended"],
|
|
616
|
+
name: "zayne/unicorn/recommended"
|
|
617
|
+
},
|
|
614
618
|
{
|
|
615
619
|
name: "zayne/unicorn/rules",
|
|
616
620
|
rules: {
|
|
@@ -866,13 +870,19 @@ var stylistic = async (options = {}) => {
|
|
|
866
870
|
},
|
|
867
871
|
...overrides
|
|
868
872
|
}
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
files: [GLOB_YAML],
|
|
876
|
+
rules: {
|
|
877
|
+
"stylistic/spaced-comment": "off"
|
|
878
|
+
}
|
|
869
879
|
}
|
|
870
880
|
];
|
|
871
881
|
};
|
|
872
882
|
|
|
873
883
|
// src/configs/jsonc.ts
|
|
874
884
|
var jsonc = async (options = {}) => {
|
|
875
|
-
const { files, overrides, stylistic: stylistic2 = true } = options;
|
|
885
|
+
const { files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC], overrides, stylistic: stylistic2 = true } = options;
|
|
876
886
|
const [eslintPluginJsonc, jsoncParser] = await Promise.all([
|
|
877
887
|
interopDefault(import('eslint-plugin-jsonc')),
|
|
878
888
|
interopDefault(import('jsonc-eslint-parser'))
|
|
@@ -885,7 +895,7 @@ var jsonc = async (options = {}) => {
|
|
|
885
895
|
}
|
|
886
896
|
},
|
|
887
897
|
{
|
|
888
|
-
files
|
|
898
|
+
files,
|
|
889
899
|
languageOptions: {
|
|
890
900
|
parser: jsoncParser
|
|
891
901
|
},
|
|
@@ -979,9 +989,9 @@ var defaultPluginRenameMap = {
|
|
|
979
989
|
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
980
990
|
"@eslint-react/naming-convention": "react-naming-convention",
|
|
981
991
|
"@eslint-react/web-api": "react-web-api",
|
|
982
|
-
/* eslint-disable perfectionist/sort-objects */
|
|
983
|
-
// @eslint-react has to be below the rest to avoid rename issues
|
|
992
|
+
/* eslint-disable perfectionist/sort-objects -- @eslint-react has to be below the rest to avoid plugin rename issues */
|
|
984
993
|
"@eslint-react": "react",
|
|
994
|
+
/* eslint-enable perfectionist/sort-objects -- @eslint-react has to be below the rest to avoid plugin rename issues */
|
|
985
995
|
"@next/next": "nextjs-next",
|
|
986
996
|
"@stylistic": "stylistic",
|
|
987
997
|
"@tanstack/query": "tanstack-query",
|
|
@@ -1001,8 +1011,7 @@ var react = async (options = {}) => {
|
|
|
1001
1011
|
"@eslint-react/eslint-plugin",
|
|
1002
1012
|
"eslint-plugin-react-hooks",
|
|
1003
1013
|
"eslint-plugin-react-refresh",
|
|
1004
|
-
...nextjs ? ["@next/eslint-plugin-next"] : []
|
|
1005
|
-
"typescript-eslint"
|
|
1014
|
+
...nextjs ? ["@next/eslint-plugin-next"] : []
|
|
1006
1015
|
]);
|
|
1007
1016
|
const [eslintPluginReact, eslintReactHooks, eslintPluginReactRefresh, eslintPluginNextjs] = await Promise.all([
|
|
1008
1017
|
interopDefault(import('@eslint-react/eslint-plugin')),
|
|
@@ -1091,11 +1100,13 @@ var react = async (options = {}) => {
|
|
|
1091
1100
|
"nextjs-next": fixupPluginRules(eslintPluginNextjs)
|
|
1092
1101
|
},
|
|
1093
1102
|
rules: renameRules(
|
|
1094
|
-
|
|
1103
|
+
// eslint-disable-next-line ts-eslint/no-unsafe-argument -- eslint-plugin-nextjs is not typed
|
|
1095
1104
|
{
|
|
1096
1105
|
// @ts-expect-error - eslint-plugin-nextjs is not typed
|
|
1106
|
+
// eslint-disable-next-line ts-eslint/no-unsafe-member-access -- eslint-plugin-nextjs is not typed
|
|
1097
1107
|
...eslintPluginNextjs.configs?.recommended?.rules,
|
|
1098
1108
|
// @ts-expect-error - eslint-plugin-nextjs is not typed
|
|
1109
|
+
// eslint-disable-next-line ts-eslint/no-unsafe-member-access -- eslint-plugin-nextjs is not typed
|
|
1099
1110
|
...eslintPluginNextjs.configs?.["core-web-vitals"]?.rules
|
|
1100
1111
|
},
|
|
1101
1112
|
defaultPluginRenameMap
|
|
@@ -1390,6 +1401,311 @@ var node = async (options = {}) => {
|
|
|
1390
1401
|
];
|
|
1391
1402
|
};
|
|
1392
1403
|
|
|
1404
|
+
// src/configs/comments.ts
|
|
1405
|
+
var comments = async (options = {}) => {
|
|
1406
|
+
const { overrides, type = "app-strict" } = options;
|
|
1407
|
+
const eslintPluginComments = await interopDefault(
|
|
1408
|
+
import('@eslint-community/eslint-plugin-eslint-comments')
|
|
1409
|
+
);
|
|
1410
|
+
return [
|
|
1411
|
+
{
|
|
1412
|
+
name: "zayne/eslint-comments/rules",
|
|
1413
|
+
plugins: {
|
|
1414
|
+
"eslint-comments": eslintPluginComments
|
|
1415
|
+
},
|
|
1416
|
+
rules: {
|
|
1417
|
+
"eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
|
|
1418
|
+
"eslint-comments/no-aggregating-enable": "error",
|
|
1419
|
+
"eslint-comments/no-duplicate-disable": "error",
|
|
1420
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
1421
|
+
"eslint-comments/no-unused-enable": "error",
|
|
1422
|
+
"eslint-comments/require-description": "warn",
|
|
1423
|
+
...type !== "app" && {
|
|
1424
|
+
"eslint-comments/require-description": "warn"
|
|
1425
|
+
},
|
|
1426
|
+
...overrides
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
];
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
// src/configs/toml.ts
|
|
1433
|
+
var toml = async (options = {}) => {
|
|
1434
|
+
const { files = [GLOB_TOML], overrides, stylistic: stylistic2 = true } = options;
|
|
1435
|
+
const [pluginToml, parserToml] = await Promise.all([
|
|
1436
|
+
interopDefault(import('eslint-plugin-toml')),
|
|
1437
|
+
interopDefault(import('toml-eslint-parser'))
|
|
1438
|
+
]);
|
|
1439
|
+
return [
|
|
1440
|
+
{
|
|
1441
|
+
name: "zayne/toml/setup",
|
|
1442
|
+
plugins: {
|
|
1443
|
+
toml: pluginToml
|
|
1444
|
+
}
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
files,
|
|
1448
|
+
languageOptions: {
|
|
1449
|
+
parser: parserToml
|
|
1450
|
+
},
|
|
1451
|
+
name: "zayne/toml/rules",
|
|
1452
|
+
rules: {
|
|
1453
|
+
"style/spaced-comment": "off",
|
|
1454
|
+
"toml/comma-style": "error",
|
|
1455
|
+
"toml/keys-order": "error",
|
|
1456
|
+
"toml/no-space-dots": "error",
|
|
1457
|
+
"toml/no-unreadable-number-separator": "error",
|
|
1458
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
1459
|
+
"toml/precision-of-integer": "error",
|
|
1460
|
+
"toml/tables-order": "error",
|
|
1461
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
1462
|
+
...stylistic2 && {
|
|
1463
|
+
"toml/array-bracket-newline": "error",
|
|
1464
|
+
"toml/array-bracket-spacing": "error",
|
|
1465
|
+
"toml/array-element-newline": "error",
|
|
1466
|
+
// "toml/indent": ["error", indent],
|
|
1467
|
+
"toml/inline-table-curly-spacing": "error",
|
|
1468
|
+
"toml/key-spacing": "error",
|
|
1469
|
+
"toml/padding-line-between-pairs": "error",
|
|
1470
|
+
"toml/padding-line-between-tables": "error",
|
|
1471
|
+
"toml/quoted-keys": "error",
|
|
1472
|
+
"toml/spaced-comment": "error",
|
|
1473
|
+
"toml/table-bracket-spacing": "error"
|
|
1474
|
+
},
|
|
1475
|
+
...overrides
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
];
|
|
1479
|
+
};
|
|
1480
|
+
|
|
1481
|
+
// src/configs/yaml.ts
|
|
1482
|
+
var yaml = async (options = {}) => {
|
|
1483
|
+
const { files = [GLOB_YAML], overrides, stylistic: stylistic2 = true } = options;
|
|
1484
|
+
const [pluginYaml, parserYaml] = await Promise.all([
|
|
1485
|
+
interopDefault(import('eslint-plugin-yml')),
|
|
1486
|
+
interopDefault(import('yaml-eslint-parser'))
|
|
1487
|
+
]);
|
|
1488
|
+
return [
|
|
1489
|
+
{
|
|
1490
|
+
name: "antfu/yaml/setup",
|
|
1491
|
+
plugins: {
|
|
1492
|
+
yaml: pluginYaml
|
|
1493
|
+
}
|
|
1494
|
+
},
|
|
1495
|
+
{
|
|
1496
|
+
files,
|
|
1497
|
+
languageOptions: {
|
|
1498
|
+
parser: parserYaml
|
|
1499
|
+
},
|
|
1500
|
+
name: "antfu/yaml/rules",
|
|
1501
|
+
rules: {
|
|
1502
|
+
"style/spaced-comment": "off",
|
|
1503
|
+
"yaml/block-mapping": "error",
|
|
1504
|
+
"yaml/block-sequence": "error",
|
|
1505
|
+
"yaml/no-empty-key": "error",
|
|
1506
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
1507
|
+
"yaml/no-irregular-whitespace": "error",
|
|
1508
|
+
"yaml/plain-scalar": "error",
|
|
1509
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
1510
|
+
...stylistic2 ? {
|
|
1511
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
1512
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
1513
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
1514
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
1515
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
1516
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
1517
|
+
// "yaml/indent": ["error", indent],
|
|
1518
|
+
"yaml/key-spacing": "error",
|
|
1519
|
+
"yaml/no-tab-indent": "error",
|
|
1520
|
+
// "yaml/quotes": [
|
|
1521
|
+
// "error",
|
|
1522
|
+
// { avoidEscape: true, prefer: quotes === "backtick" ? "double" : quotes },
|
|
1523
|
+
// ],
|
|
1524
|
+
"yaml/spaced-comment": "error"
|
|
1525
|
+
} : {},
|
|
1526
|
+
...overrides
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
];
|
|
1530
|
+
};
|
|
1531
|
+
async function vue(options = {}) {
|
|
1532
|
+
const {
|
|
1533
|
+
files = [GLOB_VUE],
|
|
1534
|
+
indent = 3,
|
|
1535
|
+
overrides,
|
|
1536
|
+
stylistic: stylistic2 = true,
|
|
1537
|
+
typescript: typescript2 = true,
|
|
1538
|
+
vueVersion = 3
|
|
1539
|
+
} = options;
|
|
1540
|
+
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
1541
|
+
await ensurePackages([
|
|
1542
|
+
"eslint-plugin-vue",
|
|
1543
|
+
"vue-eslint-parser",
|
|
1544
|
+
...sfcBlocks ? ["eslint-processor-vue-blocks"] : []
|
|
1545
|
+
]);
|
|
1546
|
+
const [pluginVue, parserVue, processorVueBlocks] = await Promise.all([
|
|
1547
|
+
interopDefault(import('eslint-plugin-vue')),
|
|
1548
|
+
interopDefault(import('vue-eslint-parser')),
|
|
1549
|
+
interopDefault(import('eslint-processor-vue-blocks'))
|
|
1550
|
+
]);
|
|
1551
|
+
return [
|
|
1552
|
+
{
|
|
1553
|
+
// This allows Vue plugin to work with auto imports
|
|
1554
|
+
// https://github.com/vuejs/eslint-plugin-vue/pull/2422
|
|
1555
|
+
languageOptions: {
|
|
1556
|
+
globals: {
|
|
1557
|
+
computed: "readonly",
|
|
1558
|
+
defineEmits: "readonly",
|
|
1559
|
+
defineExpose: "readonly",
|
|
1560
|
+
defineProps: "readonly",
|
|
1561
|
+
onMounted: "readonly",
|
|
1562
|
+
onUnmounted: "readonly",
|
|
1563
|
+
reactive: "readonly",
|
|
1564
|
+
ref: "readonly",
|
|
1565
|
+
shallowReactive: "readonly",
|
|
1566
|
+
shallowRef: "readonly",
|
|
1567
|
+
toRef: "readonly",
|
|
1568
|
+
toRefs: "readonly",
|
|
1569
|
+
watch: "readonly",
|
|
1570
|
+
watchEffect: "readonly"
|
|
1571
|
+
}
|
|
1572
|
+
},
|
|
1573
|
+
name: "zayne/vue/setup",
|
|
1574
|
+
plugins: {
|
|
1575
|
+
vue: pluginVue
|
|
1576
|
+
}
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
files,
|
|
1580
|
+
languageOptions: {
|
|
1581
|
+
parser: parserVue,
|
|
1582
|
+
parserOptions: {
|
|
1583
|
+
ecmaFeatures: {
|
|
1584
|
+
jsx: true
|
|
1585
|
+
},
|
|
1586
|
+
extraFileExtensions: [".vue"],
|
|
1587
|
+
// eslint-disable-next-line import/no-extraneous-dependencies -- allow this for now, might change later
|
|
1588
|
+
parser: typescript2 ? await interopDefault(import('./dist-RQW5ZYTC.js')) : void 0,
|
|
1589
|
+
sourceType: "module"
|
|
1590
|
+
}
|
|
1591
|
+
},
|
|
1592
|
+
name: "zayne/vue/rules",
|
|
1593
|
+
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors([
|
|
1594
|
+
pluginVue.processors[".vue"],
|
|
1595
|
+
processorVueBlocks({
|
|
1596
|
+
...sfcBlocks,
|
|
1597
|
+
blocks: {
|
|
1598
|
+
styles: true,
|
|
1599
|
+
...sfcBlocks.blocks
|
|
1600
|
+
}
|
|
1601
|
+
})
|
|
1602
|
+
]),
|
|
1603
|
+
rules: {
|
|
1604
|
+
...pluginVue.configs.base.rules,
|
|
1605
|
+
...vueVersion === 2 ? {
|
|
1606
|
+
...pluginVue.configs.essential.rules,
|
|
1607
|
+
...pluginVue.configs["strongly-recommended"].rules,
|
|
1608
|
+
...pluginVue.configs.recommended.rules
|
|
1609
|
+
} : {
|
|
1610
|
+
...pluginVue.configs["vue3-essential"].rules,
|
|
1611
|
+
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
1612
|
+
...pluginVue.configs["vue3-recommended"].rules
|
|
1613
|
+
},
|
|
1614
|
+
"node/prefer-global/process": "off",
|
|
1615
|
+
"vue/block-order": [
|
|
1616
|
+
"error",
|
|
1617
|
+
{
|
|
1618
|
+
order: ["script", "template", "style"]
|
|
1619
|
+
}
|
|
1620
|
+
],
|
|
1621
|
+
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1622
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1623
|
+
// == this is deprecated
|
|
1624
|
+
"vue/component-tags-order": "off",
|
|
1625
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1626
|
+
"vue/define-macros-order": [
|
|
1627
|
+
"error",
|
|
1628
|
+
{
|
|
1629
|
+
order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
|
|
1630
|
+
}
|
|
1631
|
+
],
|
|
1632
|
+
"vue/dot-location": ["error", "property"],
|
|
1633
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1634
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
1635
|
+
"vue/html-indent": ["error", indent],
|
|
1636
|
+
"vue/html-quotes": ["error", "double"],
|
|
1637
|
+
"vue/max-attributes-per-line": "off",
|
|
1638
|
+
"vue/multi-word-component-names": "off",
|
|
1639
|
+
"vue/no-dupe-keys": "off",
|
|
1640
|
+
"vue/no-empty-pattern": "error",
|
|
1641
|
+
"vue/no-irregular-whitespace": "error",
|
|
1642
|
+
"vue/no-loss-of-precision": "error",
|
|
1643
|
+
"vue/no-restricted-syntax": [
|
|
1644
|
+
"error",
|
|
1645
|
+
"DebuggerStatement",
|
|
1646
|
+
"LabeledStatement",
|
|
1647
|
+
"WithStatement"
|
|
1648
|
+
],
|
|
1649
|
+
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1650
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
1651
|
+
"vue/no-sparse-arrays": "error",
|
|
1652
|
+
"vue/no-unused-refs": "error",
|
|
1653
|
+
"vue/no-useless-v-bind": "error",
|
|
1654
|
+
"vue/no-v-html": "off",
|
|
1655
|
+
"vue/object-shorthand": [
|
|
1656
|
+
"error",
|
|
1657
|
+
"always",
|
|
1658
|
+
{
|
|
1659
|
+
avoidQuotes: true,
|
|
1660
|
+
ignoreConstructors: false
|
|
1661
|
+
}
|
|
1662
|
+
],
|
|
1663
|
+
"vue/prefer-separate-static-class": "error",
|
|
1664
|
+
"vue/prefer-template": "error",
|
|
1665
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1666
|
+
"vue/require-default-prop": "off",
|
|
1667
|
+
"vue/require-prop-types": "off",
|
|
1668
|
+
"vue/space-infix-ops": "error",
|
|
1669
|
+
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1670
|
+
...stylistic2 && {
|
|
1671
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1672
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1673
|
+
"vue/block-spacing": ["error", "always"],
|
|
1674
|
+
"vue/block-tag-newline": [
|
|
1675
|
+
"error",
|
|
1676
|
+
{
|
|
1677
|
+
multiline: "always",
|
|
1678
|
+
singleline: "always"
|
|
1679
|
+
}
|
|
1680
|
+
],
|
|
1681
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1682
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1683
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1684
|
+
"vue/comma-style": ["error", "last"],
|
|
1685
|
+
"vue/html-comment-content-spacing": [
|
|
1686
|
+
"error",
|
|
1687
|
+
"always",
|
|
1688
|
+
{
|
|
1689
|
+
exceptions: ["-"]
|
|
1690
|
+
}
|
|
1691
|
+
],
|
|
1692
|
+
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1693
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1694
|
+
"vue/object-curly-newline": "off",
|
|
1695
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1696
|
+
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1697
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1698
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1699
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1700
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1701
|
+
"vue/template-curly-spacing": "error"
|
|
1702
|
+
},
|
|
1703
|
+
...overrides
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
];
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1393
1709
|
// src/configs/jsx.ts
|
|
1394
1710
|
var jsx = () => {
|
|
1395
1711
|
return [
|
|
@@ -1409,35 +1725,54 @@ var jsx = () => {
|
|
|
1409
1725
|
|
|
1410
1726
|
// src/factory.ts
|
|
1411
1727
|
var ReactPackages = ["react", "react-dom"];
|
|
1728
|
+
var VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
|
|
1412
1729
|
var resolveOptions = (option) => isObject(option) ? option : {};
|
|
1413
1730
|
var zayne = (options = {}, userConfigs = []) => {
|
|
1414
1731
|
const {
|
|
1732
|
+
type = "app",
|
|
1733
|
+
/* eslint-disable perfectionist/sort-objects -- I just want to put `type` at the beginning */
|
|
1415
1734
|
autoRenamePlugins = true,
|
|
1735
|
+
/* eslint-enable perfectionist/sort-objects -- I just want to put `type` at the beginning */
|
|
1736
|
+
comments: enableComments = true,
|
|
1416
1737
|
componentExts = [],
|
|
1417
1738
|
gitignore: enableGitignore = true,
|
|
1739
|
+
imports: enableImports = true,
|
|
1740
|
+
jsdoc: enableJsdoc = true,
|
|
1418
1741
|
jsonc: enableJsonc = true,
|
|
1419
1742
|
jsx: enableJsx = true,
|
|
1420
1743
|
node: enableNode = true,
|
|
1421
1744
|
perfectionist: enablePerfectionist = true,
|
|
1422
1745
|
react: enableReact = ReactPackages.some((pkg) => isPackageExists(pkg)),
|
|
1423
1746
|
stylistic: enableStylistic = true,
|
|
1424
|
-
|
|
1747
|
+
toml: enableToml = true,
|
|
1425
1748
|
typescript: enableTypeScript = isPackageExists("typescript"),
|
|
1426
1749
|
unicorn: enableUnicorn = true,
|
|
1750
|
+
vue: enableVue = VuePackages.some((pkg) => isPackageExists(pkg)),
|
|
1751
|
+
yaml: enableYaml = true,
|
|
1427
1752
|
...restOfOptions
|
|
1428
1753
|
} = options;
|
|
1429
1754
|
const isStylistic = Boolean(enableStylistic);
|
|
1430
1755
|
const tsconfigPath = isObject(enableTypeScript) && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : null;
|
|
1756
|
+
const isTypeAware = Boolean(tsconfigPath);
|
|
1431
1757
|
const configs = [];
|
|
1758
|
+
configs.push(ignores(restOfOptions.ignores), javascript(restOfOptions.javascript));
|
|
1759
|
+
if (enableJsx) {
|
|
1760
|
+
configs.push(jsx());
|
|
1761
|
+
}
|
|
1762
|
+
if (enableStylistic) {
|
|
1763
|
+
configs.push(stylistic({ jsx: enableJsx, ...resolveOptions(enableStylistic) }));
|
|
1764
|
+
}
|
|
1765
|
+
if (enableComments) {
|
|
1766
|
+
configs.push(comments(resolveOptions(enableComments)));
|
|
1767
|
+
}
|
|
1432
1768
|
if (enableGitignore) {
|
|
1433
1769
|
configs.push(gitIgnores(resolveOptions(enableGitignore)));
|
|
1434
1770
|
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
);
|
|
1771
|
+
if (enableImports) {
|
|
1772
|
+
configs.push(
|
|
1773
|
+
imports({ stylistic: isStylistic, typescript: isTypeAware, ...resolveOptions(enableImports) })
|
|
1774
|
+
);
|
|
1775
|
+
}
|
|
1441
1776
|
if (enableNode) {
|
|
1442
1777
|
configs.push(node({ type, ...resolveOptions(enableNode) }));
|
|
1443
1778
|
}
|
|
@@ -1447,23 +1782,19 @@ var zayne = (options = {}, userConfigs = []) => {
|
|
|
1447
1782
|
if (enableUnicorn) {
|
|
1448
1783
|
configs.push(unicorn({ type, ...resolveOptions(enableUnicorn) }));
|
|
1449
1784
|
}
|
|
1785
|
+
if (enableJsdoc) {
|
|
1786
|
+
configs.push(jsdoc({ stylistic: isStylistic, ...resolveOptions(enableJsdoc) }));
|
|
1787
|
+
}
|
|
1450
1788
|
if (enableJsonc) {
|
|
1451
1789
|
configs.push(
|
|
1452
|
-
jsonc({
|
|
1453
|
-
stylistic: isStylistic,
|
|
1454
|
-
...resolveOptions(enableJsonc)
|
|
1455
|
-
}),
|
|
1790
|
+
jsonc({ stylistic: isStylistic, ...resolveOptions(enableJsonc) }),
|
|
1456
1791
|
sortPackageJson(),
|
|
1457
1792
|
sortTsconfig()
|
|
1458
1793
|
);
|
|
1459
1794
|
}
|
|
1460
1795
|
if (enableTypeScript) {
|
|
1461
1796
|
configs.push(
|
|
1462
|
-
typescript({
|
|
1463
|
-
componentExts,
|
|
1464
|
-
stylistic: isStylistic,
|
|
1465
|
-
...resolveOptions(enableTypeScript)
|
|
1466
|
-
})
|
|
1797
|
+
typescript({ componentExts, stylistic: isStylistic, ...resolveOptions(enableTypeScript) })
|
|
1467
1798
|
);
|
|
1468
1799
|
}
|
|
1469
1800
|
if (restOfOptions.tailwindcss) {
|
|
@@ -1472,29 +1803,31 @@ var zayne = (options = {}, userConfigs = []) => {
|
|
|
1472
1803
|
if (restOfOptions.tanstack) {
|
|
1473
1804
|
configs.push(tanstack(resolveOptions(restOfOptions.tanstack)));
|
|
1474
1805
|
}
|
|
1475
|
-
if (
|
|
1476
|
-
configs.push(jsx());
|
|
1477
|
-
}
|
|
1478
|
-
if (enableStylistic) {
|
|
1479
|
-
const stylisticOptions = resolveOptions(enableStylistic);
|
|
1806
|
+
if (enableToml) {
|
|
1480
1807
|
configs.push(
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1808
|
+
toml({
|
|
1809
|
+
stylistic: isStylistic,
|
|
1810
|
+
...resolveOptions(enableToml)
|
|
1484
1811
|
})
|
|
1485
1812
|
);
|
|
1486
1813
|
}
|
|
1487
|
-
if (
|
|
1814
|
+
if (enableYaml) {
|
|
1488
1815
|
configs.push(
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1816
|
+
yaml({
|
|
1817
|
+
stylistic: isStylistic,
|
|
1818
|
+
...resolveOptions(enableYaml)
|
|
1492
1819
|
})
|
|
1493
1820
|
);
|
|
1494
1821
|
}
|
|
1822
|
+
if (enableReact) {
|
|
1823
|
+
configs.push(react({ typescript: isTypeAware, ...resolveOptions(enableReact) }));
|
|
1824
|
+
}
|
|
1825
|
+
if (enableVue) {
|
|
1826
|
+
configs.push(vue({ typescript: isTypeAware, ...resolveOptions(enableVue) }));
|
|
1827
|
+
}
|
|
1495
1828
|
if ("files" in restOfOptions) {
|
|
1496
1829
|
throw new Error(
|
|
1497
|
-
|
|
1830
|
+
`[@zayne-labs/eslint-config] The first argument should not contain the "files" property as the options are supposed to be global. Place it in the second config array instead.`
|
|
1498
1831
|
);
|
|
1499
1832
|
}
|
|
1500
1833
|
let composer = new FlatConfigComposer();
|
|
@@ -1505,6 +1838,6 @@ var zayne = (options = {}, userConfigs = []) => {
|
|
|
1505
1838
|
return composer;
|
|
1506
1839
|
};
|
|
1507
1840
|
|
|
1508
|
-
export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLES, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, combine,
|
|
1841
|
+
export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLES, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, combine, comments, ensurePackages, gitIgnores, ignores, imports, interopDefault, isObject, isPackageInScope, javascript, jsdoc, jsonc, node, perfectionist, react, renamePluginInConfigs, renamePlugins, renameRules, sortPackageJson, sortTsconfig, stylistic, tailwindcss, tanstack, toml, typescript, unicorn, vue, yaml, zayne };
|
|
1509
1842
|
//# sourceMappingURL=index.js.map
|
|
1510
1843
|
//# sourceMappingURL=index.js.map
|