@coderwyd/eslint-config 4.1.1 → 4.2.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/cli.js +11 -11
- package/dist/index.d.ts +456 -240
- package/dist/index.js +79 -1
- package/package.json +27 -25
package/dist/index.js
CHANGED
|
@@ -66,6 +66,7 @@ var GLOB_JSON = "**/*.json";
|
|
|
66
66
|
var GLOB_JSON5 = "**/*.json5";
|
|
67
67
|
var GLOB_JSONC = "**/*.jsonc";
|
|
68
68
|
var GLOB_MARKDOWN = "**/*.md";
|
|
69
|
+
var GLOB_YAML = "**/*.y?(a)ml";
|
|
69
70
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
70
71
|
var GLOB_TESTS = [
|
|
71
72
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
@@ -913,6 +914,7 @@ function sortPackageJson() {
|
|
|
913
914
|
"husky",
|
|
914
915
|
"simple-git-hooks",
|
|
915
916
|
"lint-staged",
|
|
917
|
+
"nano-staged",
|
|
916
918
|
"eslintConfig"
|
|
917
919
|
],
|
|
918
920
|
pathPattern: "^$"
|
|
@@ -1565,7 +1567,7 @@ async function vue(options = {}) {
|
|
|
1565
1567
|
interopDefault(import("vue-eslint-parser"))
|
|
1566
1568
|
]);
|
|
1567
1569
|
const isVue3 = getVueVersion() === 3;
|
|
1568
|
-
const configKeys = isVue3 ? ["
|
|
1570
|
+
const configKeys = isVue3 ? ["essential", "strongly-recommended", "recommended"] : ["vue2-essential", "vue2-strongly-recommended", "vue2-recommended"];
|
|
1569
1571
|
const vueRules = configKeys.reduce((preRules, key) => {
|
|
1570
1572
|
const config = pluginVue.configs[key];
|
|
1571
1573
|
return {
|
|
@@ -1700,6 +1702,75 @@ async function vue(options = {}) {
|
|
|
1700
1702
|
];
|
|
1701
1703
|
}
|
|
1702
1704
|
|
|
1705
|
+
// src/configs/yaml.ts
|
|
1706
|
+
async function yaml(options = {}) {
|
|
1707
|
+
const { files = [GLOB_YAML], overrides = {} } = options;
|
|
1708
|
+
const [pluginYaml, parserYaml] = await Promise.all([
|
|
1709
|
+
interopDefault(import("eslint-plugin-yml")),
|
|
1710
|
+
interopDefault(import("yaml-eslint-parser"))
|
|
1711
|
+
]);
|
|
1712
|
+
return [
|
|
1713
|
+
{
|
|
1714
|
+
name: "coderwyd/yaml/setup",
|
|
1715
|
+
plugins: {
|
|
1716
|
+
yaml: pluginYaml
|
|
1717
|
+
}
|
|
1718
|
+
},
|
|
1719
|
+
{
|
|
1720
|
+
files,
|
|
1721
|
+
languageOptions: {
|
|
1722
|
+
parser: parserYaml
|
|
1723
|
+
},
|
|
1724
|
+
name: "coderwyd/yaml/rules",
|
|
1725
|
+
rules: {
|
|
1726
|
+
"yaml/block-mapping": "error",
|
|
1727
|
+
"yaml/block-sequence": "error",
|
|
1728
|
+
"yaml/no-empty-key": "error",
|
|
1729
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
1730
|
+
"yaml/no-irregular-whitespace": "error",
|
|
1731
|
+
"yaml/plain-scalar": "error",
|
|
1732
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
1733
|
+
...overrides
|
|
1734
|
+
}
|
|
1735
|
+
},
|
|
1736
|
+
{
|
|
1737
|
+
files: ["pnpm-workspace.yaml"],
|
|
1738
|
+
name: "coderwyd/yaml/pnpm-workspace",
|
|
1739
|
+
rules: {
|
|
1740
|
+
"yaml/sort-keys": [
|
|
1741
|
+
"error",
|
|
1742
|
+
{
|
|
1743
|
+
order: [
|
|
1744
|
+
"packages",
|
|
1745
|
+
"overrides",
|
|
1746
|
+
"patchedDependencies",
|
|
1747
|
+
"hoistPattern",
|
|
1748
|
+
"catalog",
|
|
1749
|
+
"catalogs",
|
|
1750
|
+
"allowedDeprecatedVersions",
|
|
1751
|
+
"allowNonAppliedPatches",
|
|
1752
|
+
"configDependencies",
|
|
1753
|
+
"ignoredBuiltDependencies",
|
|
1754
|
+
"ignoredOptionalDependencies",
|
|
1755
|
+
"neverBuiltDependencies",
|
|
1756
|
+
"onlyBuiltDependencies",
|
|
1757
|
+
"onlyBuiltDependenciesFile",
|
|
1758
|
+
"packageExtensions",
|
|
1759
|
+
"peerDependencyRules",
|
|
1760
|
+
"supportedArchitectures"
|
|
1761
|
+
],
|
|
1762
|
+
pathPattern: "^$"
|
|
1763
|
+
},
|
|
1764
|
+
{
|
|
1765
|
+
order: { type: "asc" },
|
|
1766
|
+
pathPattern: ".*"
|
|
1767
|
+
}
|
|
1768
|
+
]
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
];
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1703
1774
|
// src/index.ts
|
|
1704
1775
|
var flatConfigProps = [
|
|
1705
1776
|
"name",
|
|
@@ -1849,6 +1920,13 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
1849
1920
|
sortTsconfig()
|
|
1850
1921
|
);
|
|
1851
1922
|
}
|
|
1923
|
+
if (options.yaml ?? true) {
|
|
1924
|
+
configs2.push(
|
|
1925
|
+
yaml({
|
|
1926
|
+
overrides: getOverrides(options, "yaml")
|
|
1927
|
+
})
|
|
1928
|
+
);
|
|
1929
|
+
}
|
|
1852
1930
|
configs2.push(specials(), prettier());
|
|
1853
1931
|
if ("files" in options) {
|
|
1854
1932
|
throw new Error(
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coderwyd/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.2.0",
|
|
5
5
|
"description": "Donny's ESLint config",
|
|
6
6
|
"author": "Donny Wang <donny526@outlook.com> (https://github.com/coderwyd/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -69,57 +69,59 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@antfu/install-pkg": "^1.0.0",
|
|
71
71
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
73
|
-
"@typescript-eslint/parser": "^8.
|
|
74
|
-
"@vitest/eslint-plugin": "^1.1.
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
|
73
|
+
"@typescript-eslint/parser": "^8.26.1",
|
|
74
|
+
"@vitest/eslint-plugin": "^1.1.38",
|
|
75
75
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
76
|
-
"eslint-config-prettier": "^10.
|
|
77
|
-
"eslint-plugin-antfu": "^3.1.
|
|
76
|
+
"eslint-config-prettier": "^10.1.1",
|
|
77
|
+
"eslint-plugin-antfu": "^3.1.1",
|
|
78
78
|
"eslint-plugin-command": "^3.1.0",
|
|
79
|
-
"eslint-plugin-de-morgan": "^1.2.
|
|
79
|
+
"eslint-plugin-de-morgan": "^1.2.1",
|
|
80
80
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
81
|
-
"eslint-plugin-import-x": "^4.
|
|
82
|
-
"eslint-plugin-jsdoc": "^50.6.
|
|
81
|
+
"eslint-plugin-import-x": "^4.8.0",
|
|
82
|
+
"eslint-plugin-jsdoc": "^50.6.8",
|
|
83
83
|
"eslint-plugin-jsonc": "^2.19.1",
|
|
84
|
-
"eslint-plugin-n": "^17.16.
|
|
84
|
+
"eslint-plugin-n": "^17.16.2",
|
|
85
85
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
86
|
-
"eslint-plugin-perfectionist": "^4.
|
|
86
|
+
"eslint-plugin-perfectionist": "^4.10.1",
|
|
87
87
|
"eslint-plugin-regexp": "^2.7.0",
|
|
88
88
|
"eslint-plugin-unicorn": "^57.0.0",
|
|
89
89
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
90
|
-
"eslint-plugin-vue": "^
|
|
91
|
-
"eslint-
|
|
90
|
+
"eslint-plugin-vue": "^10.0.0",
|
|
91
|
+
"eslint-plugin-yml": "^1.17.0",
|
|
92
|
+
"eslint-typegen": "^2.1.0",
|
|
92
93
|
"globals": "^16.0.0",
|
|
93
94
|
"jsonc-eslint-parser": "^2.4.0",
|
|
94
|
-
"local-pkg": "^1.1.
|
|
95
|
+
"local-pkg": "^1.1.1",
|
|
95
96
|
"parse-gitignore": "^2.0.0",
|
|
96
97
|
"picocolors": "^1.1.1",
|
|
97
98
|
"prettier": "^3.5.3",
|
|
98
99
|
"prompts": "^2.4.2",
|
|
99
|
-
"vue-eslint-parser": "^
|
|
100
|
+
"vue-eslint-parser": "^10.1.1",
|
|
101
|
+
"yaml-eslint-parser": "^1.3.0",
|
|
100
102
|
"yargs": "^17.7.2"
|
|
101
103
|
},
|
|
102
104
|
"devDependencies": {
|
|
103
|
-
"@antfu/ni": "^
|
|
104
|
-
"@eslint-react/eslint-plugin": "^1.
|
|
105
|
-
"@eslint/config-inspector": "^1.0.
|
|
105
|
+
"@antfu/ni": "^24.2.0",
|
|
106
|
+
"@eslint-react/eslint-plugin": "^1.35.0",
|
|
107
|
+
"@eslint/config-inspector": "^1.0.2",
|
|
106
108
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
107
|
-
"@types/node": "^22.13.
|
|
109
|
+
"@types/node": "^22.13.10",
|
|
108
110
|
"@types/prompts": "^2.4.9",
|
|
109
111
|
"@types/yargs": "^17.0.33",
|
|
110
|
-
"@unocss/eslint-plugin": "^66.1.0-beta.
|
|
111
|
-
"bumpp": "^10.0
|
|
112
|
-
"eslint": "^9.
|
|
112
|
+
"@unocss/eslint-plugin": "^66.1.0-beta.5",
|
|
113
|
+
"bumpp": "^10.1.0",
|
|
114
|
+
"eslint": "^9.22.0",
|
|
113
115
|
"eslint-plugin-react-compiler": "19.0.0-beta-e552027-20250112",
|
|
114
116
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
115
117
|
"eslint-plugin-react-refresh": "^0.4.19",
|
|
116
|
-
"eslint-plugin-svelte": "^3.0
|
|
118
|
+
"eslint-plugin-svelte": "^3.3.0",
|
|
117
119
|
"eslint-plugin-tailwindcss": "^3.18.0",
|
|
118
120
|
"jiti": "^2.4.2",
|
|
119
121
|
"nano-staged": "^0.8.0",
|
|
120
122
|
"simple-git-hooks": "^2.11.1",
|
|
121
|
-
"svelte": "^5.
|
|
122
|
-
"svelte-eslint-parser": "^1.
|
|
123
|
+
"svelte": "^5.23.1",
|
|
124
|
+
"svelte-eslint-parser": "^1.1.0",
|
|
123
125
|
"tsup": "^8.4.0",
|
|
124
126
|
"typescript": "^5.8.2"
|
|
125
127
|
},
|