@coderwyd/eslint-config 2.3.1 → 2.3.2
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/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +25 -24
- package/dist/index.js +25 -24
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -46,7 +46,7 @@ var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
|
|
|
46
46
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
47
47
|
|
|
48
48
|
// package.json
|
|
49
|
-
var version = "2.3.
|
|
49
|
+
var version = "2.3.2";
|
|
50
50
|
var devDependencies = {
|
|
51
51
|
"@antfu/ni": "^0.21.12",
|
|
52
52
|
"@types/eslint": "^8.56.6",
|
package/dist/cli.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -933,7 +933,7 @@ function sortTsconfig() {
|
|
|
933
933
|
// src/configs/prettier.ts
|
|
934
934
|
var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
|
|
935
935
|
var { rules: eslintRules } = import_eslint_config_prettier.default;
|
|
936
|
-
async function prettier(rules) {
|
|
936
|
+
async function prettier(rules = {}) {
|
|
937
937
|
const pluginPrettier = await interopDefault(import("eslint-plugin-prettier"));
|
|
938
938
|
const pRules = {
|
|
939
939
|
...rules
|
|
@@ -1545,21 +1545,14 @@ async function unocss(options = {}) {
|
|
|
1545
1545
|
|
|
1546
1546
|
// src/configs/formatter.ts
|
|
1547
1547
|
async function formatter(options = {}, prettierRules2 = {}) {
|
|
1548
|
-
const {
|
|
1549
|
-
css = true,
|
|
1550
|
-
graphql = false,
|
|
1551
|
-
html = true,
|
|
1552
|
-
markdown = false,
|
|
1553
|
-
toml = false,
|
|
1554
|
-
yaml = false
|
|
1555
|
-
} = typeof options === "object" ? options : {
|
|
1548
|
+
const { css, graphql, html, markdown, toml, yaml } = options === true ? {
|
|
1556
1549
|
css: true,
|
|
1557
1550
|
graphql: true,
|
|
1558
1551
|
html: true,
|
|
1559
1552
|
markdown: true,
|
|
1560
1553
|
toml: true,
|
|
1561
1554
|
yaml: true
|
|
1562
|
-
};
|
|
1555
|
+
} : options;
|
|
1563
1556
|
const pluginPrettier = await interopDefault(import("eslint-plugin-prettier"));
|
|
1564
1557
|
function createPrettierFormatter(files, parser, plugins) {
|
|
1565
1558
|
const rules = {
|
|
@@ -1785,6 +1778,10 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
1785
1778
|
const {
|
|
1786
1779
|
autoRenamePlugins = true,
|
|
1787
1780
|
componentExts = [],
|
|
1781
|
+
formatter: formatterOptions = {
|
|
1782
|
+
css: true,
|
|
1783
|
+
html: true
|
|
1784
|
+
},
|
|
1788
1785
|
gitignore: enableGitignore = true,
|
|
1789
1786
|
isInEditor: isInEditor2 = isInEditor,
|
|
1790
1787
|
react: enableReact = false,
|
|
@@ -1895,21 +1892,25 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
1895
1892
|
sortTsconfig()
|
|
1896
1893
|
);
|
|
1897
1894
|
}
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1895
|
+
if (formatterOptions) {
|
|
1896
|
+
let prettierRules2 = {
|
|
1897
|
+
...DEFAULT_PRETTIER_RULES
|
|
1898
|
+
};
|
|
1899
|
+
if (options.prettierRules) {
|
|
1900
|
+
prettierRules2 = { ...prettierRules2, ...options.prettierRules };
|
|
1901
|
+
}
|
|
1902
|
+
if (usePrettierrc) {
|
|
1903
|
+
const prettierConfig = await loadPrettierConfig(
|
|
1904
|
+
options.cwd ?? import_node_process4.default.cwd()
|
|
1905
|
+
);
|
|
1906
|
+
Object.assign(prettierRules2, prettierConfig);
|
|
1907
|
+
}
|
|
1908
|
+
configs.push(
|
|
1909
|
+
prettier(prettierRules2),
|
|
1910
|
+
formatter(formatterOptions, prettierRules2)
|
|
1907
1911
|
);
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
configs.push(prettier(options.formatter ? prettierRules2 : {}));
|
|
1911
|
-
if (options.formatter) {
|
|
1912
|
-
configs.push(formatter(options.formatter, prettierRules2));
|
|
1912
|
+
} else {
|
|
1913
|
+
configs.push(prettier());
|
|
1913
1914
|
}
|
|
1914
1915
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
1915
1916
|
if (key in options)
|
package/dist/index.js
CHANGED
|
@@ -887,7 +887,7 @@ function sortTsconfig() {
|
|
|
887
887
|
// src/configs/prettier.ts
|
|
888
888
|
import prettierRules from "eslint-config-prettier";
|
|
889
889
|
var { rules: eslintRules } = prettierRules;
|
|
890
|
-
async function prettier(rules) {
|
|
890
|
+
async function prettier(rules = {}) {
|
|
891
891
|
const pluginPrettier = await interopDefault(import("eslint-plugin-prettier"));
|
|
892
892
|
const pRules = {
|
|
893
893
|
...rules
|
|
@@ -1499,21 +1499,14 @@ async function unocss(options = {}) {
|
|
|
1499
1499
|
|
|
1500
1500
|
// src/configs/formatter.ts
|
|
1501
1501
|
async function formatter(options = {}, prettierRules2 = {}) {
|
|
1502
|
-
const {
|
|
1503
|
-
css = true,
|
|
1504
|
-
graphql = false,
|
|
1505
|
-
html = true,
|
|
1506
|
-
markdown = false,
|
|
1507
|
-
toml = false,
|
|
1508
|
-
yaml = false
|
|
1509
|
-
} = typeof options === "object" ? options : {
|
|
1502
|
+
const { css, graphql, html, markdown, toml, yaml } = options === true ? {
|
|
1510
1503
|
css: true,
|
|
1511
1504
|
graphql: true,
|
|
1512
1505
|
html: true,
|
|
1513
1506
|
markdown: true,
|
|
1514
1507
|
toml: true,
|
|
1515
1508
|
yaml: true
|
|
1516
|
-
};
|
|
1509
|
+
} : options;
|
|
1517
1510
|
const pluginPrettier = await interopDefault(import("eslint-plugin-prettier"));
|
|
1518
1511
|
function createPrettierFormatter(files, parser, plugins) {
|
|
1519
1512
|
const rules = {
|
|
@@ -1739,6 +1732,10 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
1739
1732
|
const {
|
|
1740
1733
|
autoRenamePlugins = true,
|
|
1741
1734
|
componentExts = [],
|
|
1735
|
+
formatter: formatterOptions = {
|
|
1736
|
+
css: true,
|
|
1737
|
+
html: true
|
|
1738
|
+
},
|
|
1742
1739
|
gitignore: enableGitignore = true,
|
|
1743
1740
|
isInEditor: isInEditor2 = isInEditor,
|
|
1744
1741
|
react: enableReact = false,
|
|
@@ -1849,21 +1846,25 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
1849
1846
|
sortTsconfig()
|
|
1850
1847
|
);
|
|
1851
1848
|
}
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1849
|
+
if (formatterOptions) {
|
|
1850
|
+
let prettierRules2 = {
|
|
1851
|
+
...DEFAULT_PRETTIER_RULES
|
|
1852
|
+
};
|
|
1853
|
+
if (options.prettierRules) {
|
|
1854
|
+
prettierRules2 = { ...prettierRules2, ...options.prettierRules };
|
|
1855
|
+
}
|
|
1856
|
+
if (usePrettierrc) {
|
|
1857
|
+
const prettierConfig = await loadPrettierConfig(
|
|
1858
|
+
options.cwd ?? process4.cwd()
|
|
1859
|
+
);
|
|
1860
|
+
Object.assign(prettierRules2, prettierConfig);
|
|
1861
|
+
}
|
|
1862
|
+
configs.push(
|
|
1863
|
+
prettier(prettierRules2),
|
|
1864
|
+
formatter(formatterOptions, prettierRules2)
|
|
1861
1865
|
);
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
configs.push(prettier(options.formatter ? prettierRules2 : {}));
|
|
1865
|
-
if (options.formatter) {
|
|
1866
|
-
configs.push(formatter(options.formatter, prettierRules2));
|
|
1866
|
+
} else {
|
|
1867
|
+
configs.push(prettier());
|
|
1867
1868
|
}
|
|
1868
1869
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
1869
1870
|
if (key in options)
|
package/package.json
CHANGED