@zayne-labs/eslint-config 0.3.0 → 0.4.1
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 +371 -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,310 @@ 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
|
+
...type !== "app" && {
|
|
1423
|
+
"eslint-comments/require-description": "warn"
|
|
1424
|
+
},
|
|
1425
|
+
...overrides
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
];
|
|
1429
|
+
};
|
|
1430
|
+
|
|
1431
|
+
// src/configs/toml.ts
|
|
1432
|
+
var toml = async (options = {}) => {
|
|
1433
|
+
const { files = [GLOB_TOML], overrides, stylistic: stylistic2 = true } = options;
|
|
1434
|
+
const [pluginToml, parserToml] = await Promise.all([
|
|
1435
|
+
interopDefault(import('eslint-plugin-toml')),
|
|
1436
|
+
interopDefault(import('toml-eslint-parser'))
|
|
1437
|
+
]);
|
|
1438
|
+
return [
|
|
1439
|
+
{
|
|
1440
|
+
name: "zayne/toml/setup",
|
|
1441
|
+
plugins: {
|
|
1442
|
+
toml: pluginToml
|
|
1443
|
+
}
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
files,
|
|
1447
|
+
languageOptions: {
|
|
1448
|
+
parser: parserToml
|
|
1449
|
+
},
|
|
1450
|
+
name: "zayne/toml/rules",
|
|
1451
|
+
rules: {
|
|
1452
|
+
"style/spaced-comment": "off",
|
|
1453
|
+
"toml/comma-style": "error",
|
|
1454
|
+
"toml/keys-order": "error",
|
|
1455
|
+
"toml/no-space-dots": "error",
|
|
1456
|
+
"toml/no-unreadable-number-separator": "error",
|
|
1457
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
1458
|
+
"toml/precision-of-integer": "error",
|
|
1459
|
+
"toml/tables-order": "error",
|
|
1460
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
1461
|
+
...stylistic2 && {
|
|
1462
|
+
"toml/array-bracket-newline": "error",
|
|
1463
|
+
"toml/array-bracket-spacing": "error",
|
|
1464
|
+
"toml/array-element-newline": "error",
|
|
1465
|
+
// "toml/indent": ["error", indent],
|
|
1466
|
+
"toml/inline-table-curly-spacing": "error",
|
|
1467
|
+
"toml/key-spacing": "error",
|
|
1468
|
+
"toml/padding-line-between-pairs": "error",
|
|
1469
|
+
"toml/padding-line-between-tables": "error",
|
|
1470
|
+
"toml/quoted-keys": "error",
|
|
1471
|
+
"toml/spaced-comment": "error",
|
|
1472
|
+
"toml/table-bracket-spacing": "error"
|
|
1473
|
+
},
|
|
1474
|
+
...overrides
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
];
|
|
1478
|
+
};
|
|
1479
|
+
|
|
1480
|
+
// src/configs/yaml.ts
|
|
1481
|
+
var yaml = async (options = {}) => {
|
|
1482
|
+
const { files = [GLOB_YAML], overrides, stylistic: stylistic2 = true } = options;
|
|
1483
|
+
const [pluginYaml, parserYaml] = await Promise.all([
|
|
1484
|
+
interopDefault(import('eslint-plugin-yml')),
|
|
1485
|
+
interopDefault(import('yaml-eslint-parser'))
|
|
1486
|
+
]);
|
|
1487
|
+
return [
|
|
1488
|
+
{
|
|
1489
|
+
name: "antfu/yaml/setup",
|
|
1490
|
+
plugins: {
|
|
1491
|
+
yaml: pluginYaml
|
|
1492
|
+
}
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
files,
|
|
1496
|
+
languageOptions: {
|
|
1497
|
+
parser: parserYaml
|
|
1498
|
+
},
|
|
1499
|
+
name: "antfu/yaml/rules",
|
|
1500
|
+
rules: {
|
|
1501
|
+
"style/spaced-comment": "off",
|
|
1502
|
+
"yaml/block-mapping": "error",
|
|
1503
|
+
"yaml/block-sequence": "error",
|
|
1504
|
+
"yaml/no-empty-key": "error",
|
|
1505
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
1506
|
+
"yaml/no-irregular-whitespace": "error",
|
|
1507
|
+
"yaml/plain-scalar": "error",
|
|
1508
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
1509
|
+
...stylistic2 ? {
|
|
1510
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
1511
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
1512
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
1513
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
1514
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
1515
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
1516
|
+
// "yaml/indent": ["error", indent],
|
|
1517
|
+
"yaml/key-spacing": "error",
|
|
1518
|
+
"yaml/no-tab-indent": "error",
|
|
1519
|
+
// "yaml/quotes": [
|
|
1520
|
+
// "error",
|
|
1521
|
+
// { avoidEscape: true, prefer: quotes === "backtick" ? "double" : quotes },
|
|
1522
|
+
// ],
|
|
1523
|
+
"yaml/spaced-comment": "error"
|
|
1524
|
+
} : {},
|
|
1525
|
+
...overrides
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
];
|
|
1529
|
+
};
|
|
1530
|
+
async function vue(options = {}) {
|
|
1531
|
+
const {
|
|
1532
|
+
files = [GLOB_VUE],
|
|
1533
|
+
indent = 3,
|
|
1534
|
+
overrides,
|
|
1535
|
+
stylistic: stylistic2 = true,
|
|
1536
|
+
typescript: typescript2 = true,
|
|
1537
|
+
vueVersion = 3
|
|
1538
|
+
} = options;
|
|
1539
|
+
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
1540
|
+
await ensurePackages([
|
|
1541
|
+
"eslint-plugin-vue",
|
|
1542
|
+
"vue-eslint-parser",
|
|
1543
|
+
...sfcBlocks ? ["eslint-processor-vue-blocks"] : []
|
|
1544
|
+
]);
|
|
1545
|
+
const [pluginVue, parserVue, processorVueBlocks] = await Promise.all([
|
|
1546
|
+
interopDefault(import('eslint-plugin-vue')),
|
|
1547
|
+
interopDefault(import('vue-eslint-parser')),
|
|
1548
|
+
interopDefault(import('eslint-processor-vue-blocks'))
|
|
1549
|
+
]);
|
|
1550
|
+
return [
|
|
1551
|
+
{
|
|
1552
|
+
// This allows Vue plugin to work with auto imports
|
|
1553
|
+
// https://github.com/vuejs/eslint-plugin-vue/pull/2422
|
|
1554
|
+
languageOptions: {
|
|
1555
|
+
globals: {
|
|
1556
|
+
computed: "readonly",
|
|
1557
|
+
defineEmits: "readonly",
|
|
1558
|
+
defineExpose: "readonly",
|
|
1559
|
+
defineProps: "readonly",
|
|
1560
|
+
onMounted: "readonly",
|
|
1561
|
+
onUnmounted: "readonly",
|
|
1562
|
+
reactive: "readonly",
|
|
1563
|
+
ref: "readonly",
|
|
1564
|
+
shallowReactive: "readonly",
|
|
1565
|
+
shallowRef: "readonly",
|
|
1566
|
+
toRef: "readonly",
|
|
1567
|
+
toRefs: "readonly",
|
|
1568
|
+
watch: "readonly",
|
|
1569
|
+
watchEffect: "readonly"
|
|
1570
|
+
}
|
|
1571
|
+
},
|
|
1572
|
+
name: "zayne/vue/setup",
|
|
1573
|
+
plugins: {
|
|
1574
|
+
vue: pluginVue
|
|
1575
|
+
}
|
|
1576
|
+
},
|
|
1577
|
+
{
|
|
1578
|
+
files,
|
|
1579
|
+
languageOptions: {
|
|
1580
|
+
parser: parserVue,
|
|
1581
|
+
parserOptions: {
|
|
1582
|
+
ecmaFeatures: {
|
|
1583
|
+
jsx: true
|
|
1584
|
+
},
|
|
1585
|
+
extraFileExtensions: [".vue"],
|
|
1586
|
+
// eslint-disable-next-line import/no-extraneous-dependencies -- allow this for now, might change later
|
|
1587
|
+
parser: typescript2 ? await interopDefault(import('./dist-RQW5ZYTC.js')) : void 0,
|
|
1588
|
+
sourceType: "module"
|
|
1589
|
+
}
|
|
1590
|
+
},
|
|
1591
|
+
name: "zayne/vue/rules",
|
|
1592
|
+
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors([
|
|
1593
|
+
pluginVue.processors[".vue"],
|
|
1594
|
+
processorVueBlocks({
|
|
1595
|
+
...sfcBlocks,
|
|
1596
|
+
blocks: {
|
|
1597
|
+
styles: true,
|
|
1598
|
+
...sfcBlocks.blocks
|
|
1599
|
+
}
|
|
1600
|
+
})
|
|
1601
|
+
]),
|
|
1602
|
+
rules: {
|
|
1603
|
+
...pluginVue.configs.base.rules,
|
|
1604
|
+
...vueVersion === 2 ? {
|
|
1605
|
+
...pluginVue.configs.essential.rules,
|
|
1606
|
+
...pluginVue.configs["strongly-recommended"].rules,
|
|
1607
|
+
...pluginVue.configs.recommended.rules
|
|
1608
|
+
} : {
|
|
1609
|
+
...pluginVue.configs["vue3-essential"].rules,
|
|
1610
|
+
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
1611
|
+
...pluginVue.configs["vue3-recommended"].rules
|
|
1612
|
+
},
|
|
1613
|
+
"node/prefer-global/process": "off",
|
|
1614
|
+
"vue/block-order": [
|
|
1615
|
+
"error",
|
|
1616
|
+
{
|
|
1617
|
+
order: ["script", "template", "style"]
|
|
1618
|
+
}
|
|
1619
|
+
],
|
|
1620
|
+
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1621
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1622
|
+
// == this is deprecated
|
|
1623
|
+
"vue/component-tags-order": "off",
|
|
1624
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1625
|
+
"vue/define-macros-order": [
|
|
1626
|
+
"error",
|
|
1627
|
+
{
|
|
1628
|
+
order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
|
|
1629
|
+
}
|
|
1630
|
+
],
|
|
1631
|
+
"vue/dot-location": ["error", "property"],
|
|
1632
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1633
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
1634
|
+
"vue/html-indent": ["error", indent],
|
|
1635
|
+
"vue/html-quotes": ["error", "double"],
|
|
1636
|
+
"vue/max-attributes-per-line": "off",
|
|
1637
|
+
"vue/multi-word-component-names": "off",
|
|
1638
|
+
"vue/no-dupe-keys": "off",
|
|
1639
|
+
"vue/no-empty-pattern": "error",
|
|
1640
|
+
"vue/no-irregular-whitespace": "error",
|
|
1641
|
+
"vue/no-loss-of-precision": "error",
|
|
1642
|
+
"vue/no-restricted-syntax": [
|
|
1643
|
+
"error",
|
|
1644
|
+
"DebuggerStatement",
|
|
1645
|
+
"LabeledStatement",
|
|
1646
|
+
"WithStatement"
|
|
1647
|
+
],
|
|
1648
|
+
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1649
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
1650
|
+
"vue/no-sparse-arrays": "error",
|
|
1651
|
+
"vue/no-unused-refs": "error",
|
|
1652
|
+
"vue/no-useless-v-bind": "error",
|
|
1653
|
+
"vue/no-v-html": "off",
|
|
1654
|
+
"vue/object-shorthand": [
|
|
1655
|
+
"error",
|
|
1656
|
+
"always",
|
|
1657
|
+
{
|
|
1658
|
+
avoidQuotes: true,
|
|
1659
|
+
ignoreConstructors: false
|
|
1660
|
+
}
|
|
1661
|
+
],
|
|
1662
|
+
"vue/prefer-separate-static-class": "error",
|
|
1663
|
+
"vue/prefer-template": "error",
|
|
1664
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1665
|
+
"vue/require-default-prop": "off",
|
|
1666
|
+
"vue/require-prop-types": "off",
|
|
1667
|
+
"vue/space-infix-ops": "error",
|
|
1668
|
+
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1669
|
+
...stylistic2 && {
|
|
1670
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1671
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1672
|
+
"vue/block-spacing": ["error", "always"],
|
|
1673
|
+
"vue/block-tag-newline": [
|
|
1674
|
+
"error",
|
|
1675
|
+
{
|
|
1676
|
+
multiline: "always",
|
|
1677
|
+
singleline: "always"
|
|
1678
|
+
}
|
|
1679
|
+
],
|
|
1680
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1681
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1682
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1683
|
+
"vue/comma-style": ["error", "last"],
|
|
1684
|
+
"vue/html-comment-content-spacing": [
|
|
1685
|
+
"error",
|
|
1686
|
+
"always",
|
|
1687
|
+
{
|
|
1688
|
+
exceptions: ["-"]
|
|
1689
|
+
}
|
|
1690
|
+
],
|
|
1691
|
+
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1692
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1693
|
+
"vue/object-curly-newline": "off",
|
|
1694
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1695
|
+
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1696
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1697
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1698
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1699
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1700
|
+
"vue/template-curly-spacing": "error"
|
|
1701
|
+
},
|
|
1702
|
+
...overrides
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
];
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1393
1708
|
// src/configs/jsx.ts
|
|
1394
1709
|
var jsx = () => {
|
|
1395
1710
|
return [
|
|
@@ -1409,35 +1724,54 @@ var jsx = () => {
|
|
|
1409
1724
|
|
|
1410
1725
|
// src/factory.ts
|
|
1411
1726
|
var ReactPackages = ["react", "react-dom"];
|
|
1727
|
+
var VuePackages = ["vue", "nuxt", "vitepress", "@slidev/cli"];
|
|
1412
1728
|
var resolveOptions = (option) => isObject(option) ? option : {};
|
|
1413
1729
|
var zayne = (options = {}, userConfigs = []) => {
|
|
1414
1730
|
const {
|
|
1731
|
+
type = "app",
|
|
1732
|
+
/* eslint-disable perfectionist/sort-objects -- I just want to put `type` at the beginning */
|
|
1415
1733
|
autoRenamePlugins = true,
|
|
1734
|
+
/* eslint-enable perfectionist/sort-objects -- I just want to put `type` at the beginning */
|
|
1735
|
+
comments: enableComments = true,
|
|
1416
1736
|
componentExts = [],
|
|
1417
1737
|
gitignore: enableGitignore = true,
|
|
1738
|
+
imports: enableImports = true,
|
|
1739
|
+
jsdoc: enableJsdoc = true,
|
|
1418
1740
|
jsonc: enableJsonc = true,
|
|
1419
1741
|
jsx: enableJsx = true,
|
|
1420
1742
|
node: enableNode = true,
|
|
1421
1743
|
perfectionist: enablePerfectionist = true,
|
|
1422
1744
|
react: enableReact = ReactPackages.some((pkg) => isPackageExists(pkg)),
|
|
1423
1745
|
stylistic: enableStylistic = true,
|
|
1424
|
-
|
|
1746
|
+
toml: enableToml = true,
|
|
1425
1747
|
typescript: enableTypeScript = isPackageExists("typescript"),
|
|
1426
1748
|
unicorn: enableUnicorn = true,
|
|
1749
|
+
vue: enableVue = VuePackages.some((pkg) => isPackageExists(pkg)),
|
|
1750
|
+
yaml: enableYaml = true,
|
|
1427
1751
|
...restOfOptions
|
|
1428
1752
|
} = options;
|
|
1429
1753
|
const isStylistic = Boolean(enableStylistic);
|
|
1430
1754
|
const tsconfigPath = isObject(enableTypeScript) && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : null;
|
|
1755
|
+
const isTypeAware = Boolean(tsconfigPath);
|
|
1431
1756
|
const configs = [];
|
|
1757
|
+
configs.push(ignores(restOfOptions.ignores), javascript(restOfOptions.javascript));
|
|
1758
|
+
if (enableJsx) {
|
|
1759
|
+
configs.push(jsx());
|
|
1760
|
+
}
|
|
1761
|
+
if (enableStylistic) {
|
|
1762
|
+
configs.push(stylistic({ jsx: enableJsx, ...resolveOptions(enableStylistic) }));
|
|
1763
|
+
}
|
|
1764
|
+
if (enableComments) {
|
|
1765
|
+
configs.push(comments(resolveOptions(enableComments)));
|
|
1766
|
+
}
|
|
1432
1767
|
if (enableGitignore) {
|
|
1433
1768
|
configs.push(gitIgnores(resolveOptions(enableGitignore)));
|
|
1434
1769
|
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
);
|
|
1770
|
+
if (enableImports) {
|
|
1771
|
+
configs.push(
|
|
1772
|
+
imports({ stylistic: isStylistic, typescript: isTypeAware, ...resolveOptions(enableImports) })
|
|
1773
|
+
);
|
|
1774
|
+
}
|
|
1441
1775
|
if (enableNode) {
|
|
1442
1776
|
configs.push(node({ type, ...resolveOptions(enableNode) }));
|
|
1443
1777
|
}
|
|
@@ -1447,23 +1781,19 @@ var zayne = (options = {}, userConfigs = []) => {
|
|
|
1447
1781
|
if (enableUnicorn) {
|
|
1448
1782
|
configs.push(unicorn({ type, ...resolveOptions(enableUnicorn) }));
|
|
1449
1783
|
}
|
|
1784
|
+
if (enableJsdoc) {
|
|
1785
|
+
configs.push(jsdoc({ stylistic: isStylistic, ...resolveOptions(enableJsdoc) }));
|
|
1786
|
+
}
|
|
1450
1787
|
if (enableJsonc) {
|
|
1451
1788
|
configs.push(
|
|
1452
|
-
jsonc({
|
|
1453
|
-
stylistic: isStylistic,
|
|
1454
|
-
...resolveOptions(enableJsonc)
|
|
1455
|
-
}),
|
|
1789
|
+
jsonc({ stylistic: isStylistic, ...resolveOptions(enableJsonc) }),
|
|
1456
1790
|
sortPackageJson(),
|
|
1457
1791
|
sortTsconfig()
|
|
1458
1792
|
);
|
|
1459
1793
|
}
|
|
1460
1794
|
if (enableTypeScript) {
|
|
1461
1795
|
configs.push(
|
|
1462
|
-
typescript({
|
|
1463
|
-
componentExts,
|
|
1464
|
-
stylistic: isStylistic,
|
|
1465
|
-
...resolveOptions(enableTypeScript)
|
|
1466
|
-
})
|
|
1796
|
+
typescript({ componentExts, stylistic: isStylistic, ...resolveOptions(enableTypeScript) })
|
|
1467
1797
|
);
|
|
1468
1798
|
}
|
|
1469
1799
|
if (restOfOptions.tailwindcss) {
|
|
@@ -1472,29 +1802,31 @@ var zayne = (options = {}, userConfigs = []) => {
|
|
|
1472
1802
|
if (restOfOptions.tanstack) {
|
|
1473
1803
|
configs.push(tanstack(resolveOptions(restOfOptions.tanstack)));
|
|
1474
1804
|
}
|
|
1475
|
-
if (
|
|
1476
|
-
configs.push(jsx());
|
|
1477
|
-
}
|
|
1478
|
-
if (enableStylistic) {
|
|
1479
|
-
const stylisticOptions = resolveOptions(enableStylistic);
|
|
1805
|
+
if (enableToml) {
|
|
1480
1806
|
configs.push(
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1807
|
+
toml({
|
|
1808
|
+
stylistic: isStylistic,
|
|
1809
|
+
...resolveOptions(enableToml)
|
|
1484
1810
|
})
|
|
1485
1811
|
);
|
|
1486
1812
|
}
|
|
1487
|
-
if (
|
|
1813
|
+
if (enableYaml) {
|
|
1488
1814
|
configs.push(
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1815
|
+
yaml({
|
|
1816
|
+
stylistic: isStylistic,
|
|
1817
|
+
...resolveOptions(enableYaml)
|
|
1492
1818
|
})
|
|
1493
1819
|
);
|
|
1494
1820
|
}
|
|
1821
|
+
if (enableReact) {
|
|
1822
|
+
configs.push(react({ typescript: isTypeAware, ...resolveOptions(enableReact) }));
|
|
1823
|
+
}
|
|
1824
|
+
if (enableVue) {
|
|
1825
|
+
configs.push(vue({ typescript: isTypeAware, ...resolveOptions(enableVue) }));
|
|
1826
|
+
}
|
|
1495
1827
|
if ("files" in restOfOptions) {
|
|
1496
1828
|
throw new Error(
|
|
1497
|
-
|
|
1829
|
+
`[@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
1830
|
);
|
|
1499
1831
|
}
|
|
1500
1832
|
let composer = new FlatConfigComposer();
|
|
@@ -1505,6 +1837,6 @@ var zayne = (options = {}, userConfigs = []) => {
|
|
|
1505
1837
|
return composer;
|
|
1506
1838
|
};
|
|
1507
1839
|
|
|
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,
|
|
1840
|
+
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
1841
|
//# sourceMappingURL=index.js.map
|
|
1510
1842
|
//# sourceMappingURL=index.js.map
|