@so1ve/eslint-config 1.0.2 → 1.1.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/dist/index.cjs +20 -9
- package/dist/index.d.ts +19 -10
- package/dist/index.mjs +19 -10
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1540,7 +1540,6 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1540
1540
|
solid: enableSolid = localPkg.isPackageExists("solid-js"),
|
|
1541
1541
|
typescript: enableTypeScript = localPkg.isPackageExists("typescript"),
|
|
1542
1542
|
gitignore: enableGitignore = true,
|
|
1543
|
-
overrides = {},
|
|
1544
1543
|
componentExts = []
|
|
1545
1544
|
} = options;
|
|
1546
1545
|
const configs = [];
|
|
@@ -1556,7 +1555,7 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1556
1555
|
configs.push(
|
|
1557
1556
|
ignores(),
|
|
1558
1557
|
javascript({
|
|
1559
|
-
overrides:
|
|
1558
|
+
overrides: getOverrides(options, "javascript")
|
|
1560
1559
|
}),
|
|
1561
1560
|
comments(),
|
|
1562
1561
|
node(),
|
|
@@ -1574,21 +1573,21 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1574
1573
|
configs.push(
|
|
1575
1574
|
typescript({
|
|
1576
1575
|
componentExts,
|
|
1577
|
-
overrides:
|
|
1576
|
+
overrides: getOverrides(options, "typescript")
|
|
1578
1577
|
})
|
|
1579
1578
|
);
|
|
1580
1579
|
}
|
|
1581
1580
|
if ((_a = options.test) != null ? _a : true) {
|
|
1582
1581
|
configs.push(
|
|
1583
1582
|
test({
|
|
1584
|
-
overrides:
|
|
1583
|
+
overrides: getOverrides(options, "test")
|
|
1585
1584
|
})
|
|
1586
1585
|
);
|
|
1587
1586
|
}
|
|
1588
1587
|
if (enableVue) {
|
|
1589
1588
|
configs.push(
|
|
1590
1589
|
vue({
|
|
1591
|
-
overrides:
|
|
1590
|
+
overrides: getOverrides(options, "vue"),
|
|
1592
1591
|
typescript: !!enableTypeScript
|
|
1593
1592
|
})
|
|
1594
1593
|
);
|
|
@@ -1596,7 +1595,7 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1596
1595
|
if (enableSolid) {
|
|
1597
1596
|
configs.push(
|
|
1598
1597
|
solid({
|
|
1599
|
-
overrides:
|
|
1598
|
+
overrides: getOverrides(options, "solid"),
|
|
1600
1599
|
typescript: !!enableTypeScript
|
|
1601
1600
|
})
|
|
1602
1601
|
);
|
|
@@ -1607,14 +1606,14 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1607
1606
|
if ((_c = options.toml) != null ? _c : true) {
|
|
1608
1607
|
configs.push(
|
|
1609
1608
|
toml({
|
|
1610
|
-
overrides:
|
|
1609
|
+
overrides: getOverrides(options, "toml")
|
|
1611
1610
|
})
|
|
1612
1611
|
);
|
|
1613
1612
|
}
|
|
1614
1613
|
if ((_d = options.yaml) != null ? _d : true) {
|
|
1615
1614
|
configs.push(
|
|
1616
1615
|
yaml({
|
|
1617
|
-
overrides:
|
|
1616
|
+
overrides: getOverrides(options, "yaml")
|
|
1618
1617
|
})
|
|
1619
1618
|
);
|
|
1620
1619
|
}
|
|
@@ -1622,7 +1621,7 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1622
1621
|
configs.push(
|
|
1623
1622
|
mdx({
|
|
1624
1623
|
componentExts,
|
|
1625
|
-
overrides:
|
|
1624
|
+
overrides: getOverrides(options, "mdx")
|
|
1626
1625
|
})
|
|
1627
1626
|
);
|
|
1628
1627
|
}
|
|
@@ -1641,6 +1640,16 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1641
1640
|
const merged = [...configs, ...userConfigs].flat();
|
|
1642
1641
|
return merged;
|
|
1643
1642
|
}
|
|
1643
|
+
const resolveSubOptions = (options, key) => typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
1644
|
+
function getOverrides(options, key) {
|
|
1645
|
+
var _a;
|
|
1646
|
+
const sub = resolveSubOptions(options, key);
|
|
1647
|
+
return {
|
|
1648
|
+
// eslint-disable-next-line etc/no-deprecated
|
|
1649
|
+
...(_a = options.overrides) == null ? void 0 : _a[key],
|
|
1650
|
+
..."overrides" in sub ? sub.overrides : {}
|
|
1651
|
+
};
|
|
1652
|
+
}
|
|
1644
1653
|
|
|
1645
1654
|
Object.defineProperty(exports, 'pluginComments', {
|
|
1646
1655
|
enumerable: true,
|
|
@@ -1799,6 +1808,7 @@ exports.GLOB_VUE = GLOB_VUE;
|
|
|
1799
1808
|
exports.GLOB_YAML = GLOB_YAML;
|
|
1800
1809
|
exports.comments = comments;
|
|
1801
1810
|
exports.formatting = formatting;
|
|
1811
|
+
exports.getOverrides = getOverrides;
|
|
1802
1812
|
exports.html = html;
|
|
1803
1813
|
exports.ignores = ignores;
|
|
1804
1814
|
exports.imports = imports;
|
|
@@ -1811,6 +1821,7 @@ exports.promise = promise;
|
|
|
1811
1821
|
exports.recordRulesState = recordRulesState;
|
|
1812
1822
|
exports.recordRulesStateConfigs = recordRulesStateConfigs;
|
|
1813
1823
|
exports.renameRules = renameRules;
|
|
1824
|
+
exports.resolveSubOptions = resolveSubOptions;
|
|
1814
1825
|
exports.so1ve = so1ve;
|
|
1815
1826
|
exports.solid = solid;
|
|
1816
1827
|
exports.sortImports = sortImports;
|
package/dist/index.d.ts
CHANGED
|
@@ -65,6 +65,10 @@ interface Options extends OptionsComponentExts {
|
|
|
65
65
|
* @see https://github.com/antfu/eslint-config-flat-gitignore
|
|
66
66
|
*/
|
|
67
67
|
gitignore?: boolean | FlatGitignoreOptions;
|
|
68
|
+
/**
|
|
69
|
+
* Core rules. Can't be disabled.
|
|
70
|
+
*/
|
|
71
|
+
javascript?: OptionsOverrides;
|
|
68
72
|
/**
|
|
69
73
|
* Enable TypeScript support.
|
|
70
74
|
*
|
|
@@ -72,57 +76,59 @@ interface Options extends OptionsComponentExts {
|
|
|
72
76
|
*
|
|
73
77
|
* @default auto-detect based on the dependencies
|
|
74
78
|
*/
|
|
75
|
-
typescript?: boolean;
|
|
79
|
+
typescript?: boolean | OptionsOverrides;
|
|
76
80
|
/**
|
|
77
81
|
* Enable test support.
|
|
78
82
|
*
|
|
79
83
|
* @default true
|
|
80
84
|
*/
|
|
81
|
-
test?: boolean;
|
|
85
|
+
test?: boolean | OptionsOverrides;
|
|
82
86
|
/**
|
|
83
87
|
* Enable Vue support.
|
|
84
88
|
*
|
|
85
89
|
* @default auto-detect based on the dependencies
|
|
86
90
|
*/
|
|
87
|
-
vue?: boolean;
|
|
91
|
+
vue?: boolean | OptionsOverrides;
|
|
88
92
|
/**
|
|
89
93
|
* Enable Solid.js support.
|
|
90
94
|
*
|
|
91
95
|
* @default auto-detect based on the dependencies
|
|
92
96
|
*/
|
|
93
|
-
solid?: boolean;
|
|
97
|
+
solid?: boolean | OptionsOverrides;
|
|
94
98
|
/**
|
|
95
99
|
* Enable JSONC support.
|
|
96
100
|
*
|
|
97
101
|
* @default true
|
|
98
102
|
*/
|
|
99
|
-
jsonc?: boolean;
|
|
103
|
+
jsonc?: boolean | OptionsOverrides;
|
|
100
104
|
/**
|
|
101
105
|
* Enable YAML support.
|
|
102
106
|
*
|
|
103
107
|
* @default true
|
|
104
108
|
*/
|
|
105
|
-
yaml?: boolean;
|
|
109
|
+
yaml?: boolean | OptionsOverrides;
|
|
106
110
|
/**
|
|
107
111
|
* Enable TOML support.
|
|
108
112
|
*
|
|
109
113
|
* @default true
|
|
110
114
|
*/
|
|
111
|
-
toml?: boolean;
|
|
115
|
+
toml?: boolean | OptionsOverrides;
|
|
112
116
|
/**
|
|
113
117
|
* Enable markdown and mdx support.
|
|
114
118
|
*
|
|
115
119
|
* @default true
|
|
116
120
|
*/
|
|
117
|
-
mdx?: boolean;
|
|
121
|
+
mdx?: boolean | OptionsOverrides;
|
|
118
122
|
/**
|
|
119
123
|
* Enable formatting rules.
|
|
120
124
|
*
|
|
121
125
|
* @default true
|
|
122
126
|
*/
|
|
123
|
-
formatting?: boolean;
|
|
127
|
+
formatting?: boolean | OptionsOverrides;
|
|
124
128
|
/**
|
|
125
129
|
* Provide overrides for rules for each integration.
|
|
130
|
+
*
|
|
131
|
+
* @deprecated Use `overrides` option in each integration key instead
|
|
126
132
|
*/
|
|
127
133
|
overrides?: {
|
|
128
134
|
javascript?: ConfigItem["rules"];
|
|
@@ -194,6 +200,9 @@ declare const yaml: ({ overrides }?: OptionsOverrides) => ConfigItem[];
|
|
|
194
200
|
* Construct an array of ESLint flat config items.
|
|
195
201
|
*/
|
|
196
202
|
declare function so1ve(options?: Options, ...userConfigs: (ConfigItem | ConfigItem[])[]): ConfigItem[];
|
|
203
|
+
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
204
|
+
declare const resolveSubOptions: <K extends keyof Options>(options: Options & ConfigItem, key: K) => ResolvedOptions<Options[K]>;
|
|
205
|
+
declare function getOverrides<K extends keyof Options>(options: Options, key: K): any;
|
|
197
206
|
|
|
198
207
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
199
208
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -229,4 +238,4 @@ declare function recordRulesStateConfigs(configs: ConfigItem[]): ConfigItem[];
|
|
|
229
238
|
declare function recordRulesState(rules: ConfigItem["rules"]): ConfigItem["rules"];
|
|
230
239
|
declare function warnUnnecessaryOffRules(): void;
|
|
231
240
|
|
|
232
|
-
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, Options, OptionsComponentExts, OptionsHasTypeScript, OptionsOverrides, OptionsTypeScriptParserOptions, RenamedRules, comments, formatting, html, ignores, imports, javascript, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
|
|
241
|
+
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, Options, OptionsComponentExts, OptionsHasTypeScript, OptionsOverrides, OptionsTypeScriptParserOptions, RenamedRules, ResolvedOptions, comments, formatting, getOverrides, html, ignores, imports, javascript, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, resolveSubOptions, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
|
package/dist/index.mjs
CHANGED
|
@@ -1511,7 +1511,6 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1511
1511
|
solid: enableSolid = isPackageExists("solid-js"),
|
|
1512
1512
|
typescript: enableTypeScript = isPackageExists("typescript"),
|
|
1513
1513
|
gitignore: enableGitignore = true,
|
|
1514
|
-
overrides = {},
|
|
1515
1514
|
componentExts = []
|
|
1516
1515
|
} = options;
|
|
1517
1516
|
const configs = [];
|
|
@@ -1527,7 +1526,7 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1527
1526
|
configs.push(
|
|
1528
1527
|
ignores(),
|
|
1529
1528
|
javascript({
|
|
1530
|
-
overrides:
|
|
1529
|
+
overrides: getOverrides(options, "javascript")
|
|
1531
1530
|
}),
|
|
1532
1531
|
comments(),
|
|
1533
1532
|
node(),
|
|
@@ -1545,21 +1544,21 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1545
1544
|
configs.push(
|
|
1546
1545
|
typescript({
|
|
1547
1546
|
componentExts,
|
|
1548
|
-
overrides:
|
|
1547
|
+
overrides: getOverrides(options, "typescript")
|
|
1549
1548
|
})
|
|
1550
1549
|
);
|
|
1551
1550
|
}
|
|
1552
1551
|
if ((_a = options.test) != null ? _a : true) {
|
|
1553
1552
|
configs.push(
|
|
1554
1553
|
test({
|
|
1555
|
-
overrides:
|
|
1554
|
+
overrides: getOverrides(options, "test")
|
|
1556
1555
|
})
|
|
1557
1556
|
);
|
|
1558
1557
|
}
|
|
1559
1558
|
if (enableVue) {
|
|
1560
1559
|
configs.push(
|
|
1561
1560
|
vue({
|
|
1562
|
-
overrides:
|
|
1561
|
+
overrides: getOverrides(options, "vue"),
|
|
1563
1562
|
typescript: !!enableTypeScript
|
|
1564
1563
|
})
|
|
1565
1564
|
);
|
|
@@ -1567,7 +1566,7 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1567
1566
|
if (enableSolid) {
|
|
1568
1567
|
configs.push(
|
|
1569
1568
|
solid({
|
|
1570
|
-
overrides:
|
|
1569
|
+
overrides: getOverrides(options, "solid"),
|
|
1571
1570
|
typescript: !!enableTypeScript
|
|
1572
1571
|
})
|
|
1573
1572
|
);
|
|
@@ -1578,14 +1577,14 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1578
1577
|
if ((_c = options.toml) != null ? _c : true) {
|
|
1579
1578
|
configs.push(
|
|
1580
1579
|
toml({
|
|
1581
|
-
overrides:
|
|
1580
|
+
overrides: getOverrides(options, "toml")
|
|
1582
1581
|
})
|
|
1583
1582
|
);
|
|
1584
1583
|
}
|
|
1585
1584
|
if ((_d = options.yaml) != null ? _d : true) {
|
|
1586
1585
|
configs.push(
|
|
1587
1586
|
yaml({
|
|
1588
|
-
overrides:
|
|
1587
|
+
overrides: getOverrides(options, "yaml")
|
|
1589
1588
|
})
|
|
1590
1589
|
);
|
|
1591
1590
|
}
|
|
@@ -1593,7 +1592,7 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1593
1592
|
configs.push(
|
|
1594
1593
|
mdx({
|
|
1595
1594
|
componentExts,
|
|
1596
|
-
overrides:
|
|
1595
|
+
overrides: getOverrides(options, "mdx")
|
|
1597
1596
|
})
|
|
1598
1597
|
);
|
|
1599
1598
|
}
|
|
@@ -1612,5 +1611,15 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1612
1611
|
const merged = [...configs, ...userConfigs].flat();
|
|
1613
1612
|
return merged;
|
|
1614
1613
|
}
|
|
1614
|
+
const resolveSubOptions = (options, key) => typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
1615
|
+
function getOverrides(options, key) {
|
|
1616
|
+
var _a;
|
|
1617
|
+
const sub = resolveSubOptions(options, key);
|
|
1618
|
+
return {
|
|
1619
|
+
// eslint-disable-next-line etc/no-deprecated
|
|
1620
|
+
...(_a = options.overrides) == null ? void 0 : _a[key],
|
|
1621
|
+
..."overrides" in sub ? sub.overrides : {}
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1615
1624
|
|
|
1616
|
-
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, comments, formatting, html, ignores, imports, javascript, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
|
|
1625
|
+
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, comments, formatting, getOverrides, html, ignores, imports, javascript, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, resolveSubOptions, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@so1ve/eslint-config",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
|
|
5
5
|
"description": "Ray's eslint config.",
|
|
6
6
|
"keywords": [
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"toml-eslint-parser": "^0.6.0",
|
|
72
72
|
"vue-eslint-parser": "^9.3.1",
|
|
73
73
|
"yaml-eslint-parser": "^1.2.2",
|
|
74
|
-
"@so1ve/eslint-plugin
|
|
75
|
-
"@so1ve/eslint-plugin": "1.0
|
|
74
|
+
"@so1ve/eslint-plugin": "1.1.0",
|
|
75
|
+
"@so1ve/eslint-plugin-sort-imports": "1.1.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"eslint": "^8.46.0"
|