eslint-config-un 0.1.4 → 0.1.6
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 +2 -0
- package/dist/index.cjs +63 -17
- package/dist/index.d.cts +245 -100
- package/dist/index.d.ts +245 -100
- package/dist/index.js +65 -19
- package/package.json +56 -55
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ Includes the rules from the following configs & plugins:
|
|
|
32
32
|
- [toml](https://www.npmjs.com/package/eslint-plugin-toml) (since v0.1.3)
|
|
33
33
|
- [prefer-arrow-functions](https://www.npmjs.com/package/eslint-plugin-prefer-arrow-functions) (since v0.1.0)
|
|
34
34
|
- [eslint-comments](https://www.npmjs.com/package/@eslint-community/eslint-plugin-eslint-comments) (since v0.1.3)
|
|
35
|
+
- [package-json](https://www.npmjs.com/package/eslint-plugin-package-json) (since v0.1.5)
|
|
35
36
|
|
|
36
37
|
## Features
|
|
37
38
|
|
|
@@ -66,6 +67,7 @@ export default eslintConfig({
|
|
|
66
67
|
- `json`
|
|
67
68
|
- `yaml`
|
|
68
69
|
- `toml`
|
|
70
|
+
- `package-json`
|
|
69
71
|
- Some rules are set to warn by default. You can change some or even all such rule's reporting level using `errorsInsteadOfWarnings` option. You can find all such rules by inspecting the source code of this package.
|
|
70
72
|
|
|
71
73
|
## Troubleshooting
|
package/dist/index.cjs
CHANGED
|
@@ -33,16 +33,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// node_modules/.pnpm/tsup@8.3.
|
|
36
|
+
// node_modules/.pnpm/tsup@8.3.5_jiti@2.0.0_postcss@8.4.39_tsx@4.16.2_typescript@5.6.3_yaml@2.4.5/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var init_cjs_shims = __esm({
|
|
38
|
-
"node_modules/.pnpm/tsup@8.3.
|
|
38
|
+
"node_modules/.pnpm/tsup@8.3.5_jiti@2.0.0_postcss@8.4.39_tsx@4.16.2_typescript@5.6.3_yaml@2.4.5/node_modules/tsup/assets/cjs_shims.js"() {
|
|
39
39
|
"use strict";
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
// node_modules/.pnpm/@eslint+js@9.
|
|
43
|
+
// node_modules/.pnpm/@eslint+js@9.14.0/node_modules/@eslint/js/src/configs/eslint-all.js
|
|
44
44
|
var require_eslint_all = __commonJS({
|
|
45
|
-
"node_modules/.pnpm/@eslint+js@9.
|
|
45
|
+
"node_modules/.pnpm/@eslint+js@9.14.0/node_modules/@eslint/js/src/configs/eslint-all.js"(exports2, module2) {
|
|
46
46
|
"use strict";
|
|
47
47
|
init_cjs_shims();
|
|
48
48
|
module2.exports = Object.freeze({
|
|
@@ -249,9 +249,9 @@ var require_eslint_all = __commonJS({
|
|
|
249
249
|
}
|
|
250
250
|
});
|
|
251
251
|
|
|
252
|
-
// node_modules/.pnpm/@eslint+js@9.
|
|
252
|
+
// node_modules/.pnpm/@eslint+js@9.14.0/node_modules/@eslint/js/src/configs/eslint-recommended.js
|
|
253
253
|
var require_eslint_recommended = __commonJS({
|
|
254
|
-
"node_modules/.pnpm/@eslint+js@9.
|
|
254
|
+
"node_modules/.pnpm/@eslint+js@9.14.0/node_modules/@eslint/js/src/configs/eslint-recommended.js"(exports2, module2) {
|
|
255
255
|
"use strict";
|
|
256
256
|
init_cjs_shims();
|
|
257
257
|
module2.exports = Object.freeze({
|
|
@@ -322,9 +322,9 @@ var require_eslint_recommended = __commonJS({
|
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
324
|
|
|
325
|
-
// node_modules/.pnpm/@eslint+js@9.
|
|
325
|
+
// node_modules/.pnpm/@eslint+js@9.14.0/node_modules/@eslint/js/src/index.js
|
|
326
326
|
var require_src = __commonJS({
|
|
327
|
-
"node_modules/.pnpm/@eslint+js@9.
|
|
327
|
+
"node_modules/.pnpm/@eslint+js@9.14.0/node_modules/@eslint/js/src/index.js"(exports2, module2) {
|
|
328
328
|
"use strict";
|
|
329
329
|
init_cjs_shims();
|
|
330
330
|
module2.exports = {
|
|
@@ -375,6 +375,7 @@ var GLOB_JSONC = "**/*.jsonc";
|
|
|
375
375
|
var GLOB_JSON5 = "**/*.json5";
|
|
376
376
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
377
377
|
var GLOB_TOML = "**/*.toml";
|
|
378
|
+
var GLOB_PACKAGE_JSON = "**/package.json";
|
|
378
379
|
|
|
379
380
|
// src/utils.ts
|
|
380
381
|
init_cjs_shims();
|
|
@@ -519,6 +520,7 @@ var importEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
519
520
|
).addRule("import/extensions", options.requireModuleExtensions ? ERROR : OFF, [
|
|
520
521
|
typeof options.requireModuleExtensions === "object" && options.requireModuleExtensions["*"] || "ignorePackages",
|
|
521
522
|
{
|
|
523
|
+
checkTypeImports: true,
|
|
522
524
|
...options.requireModuleExtensions === true && Object.fromEntries(
|
|
523
525
|
["js", "cjs", "mjs", "ts", "cts", "mts", "jsx", "tsx"].map((ext) => [ext, "always"])
|
|
524
526
|
),
|
|
@@ -698,6 +700,44 @@ var nodeEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
698
700
|
return builder.getAllConfigs();
|
|
699
701
|
};
|
|
700
702
|
|
|
703
|
+
// src/configs/package-json.ts
|
|
704
|
+
init_cjs_shims();
|
|
705
|
+
var import_recommended = __toESM(require("eslint-plugin-package-json/configs/recommended"), 1);
|
|
706
|
+
var import_jsonc_eslint_parser2 = __toESM(require("jsonc-eslint-parser"), 1);
|
|
707
|
+
var DEFAULT_FILES2 = [GLOB_PACKAGE_JSON];
|
|
708
|
+
var DEFAULT_COLLECTIONS_TO_SORT = {
|
|
709
|
+
devDependencies: true,
|
|
710
|
+
dependencies: true,
|
|
711
|
+
peerDependencies: true,
|
|
712
|
+
peerDependenciesMeta: true,
|
|
713
|
+
optionalDependencies: true
|
|
714
|
+
};
|
|
715
|
+
var packageJsonEslintConfig = (options = {}, internalOptions = {}) => {
|
|
716
|
+
const builder = new ConfigEntryBuilder(options, internalOptions);
|
|
717
|
+
builder.addConfig(
|
|
718
|
+
["package-json", { includeDefaultFilesAndIgnores: true, filesFallback: DEFAULT_FILES2 }],
|
|
719
|
+
{
|
|
720
|
+
plugins: {
|
|
721
|
+
// @ts-expect-error types mismatch
|
|
722
|
+
"package-json": import_recommended.default.plugins["package-json"]
|
|
723
|
+
},
|
|
724
|
+
languageOptions: {
|
|
725
|
+
parser: import_jsonc_eslint_parser2.default
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
).addBulkRules(import_recommended.default.rules).addRule("package-json/order-properties", ERROR, [
|
|
729
|
+
{ order: options.order ?? "sort-package-json" }
|
|
730
|
+
]).addRule("package-json/repository-shorthand", ERROR, [
|
|
731
|
+
{ form: options.repositoryShorthand ?? "object" }
|
|
732
|
+
]).addRule("package-json/sort-collections", ERROR, [
|
|
733
|
+
Object.entries({
|
|
734
|
+
...DEFAULT_COLLECTIONS_TO_SORT,
|
|
735
|
+
...options.collectionsToSort
|
|
736
|
+
}).filter(([, v]) => v).map(([k]) => k)
|
|
737
|
+
]).addOverrides();
|
|
738
|
+
return builder.getAllConfigs();
|
|
739
|
+
};
|
|
740
|
+
|
|
701
741
|
// src/configs/prefer-arrow-functions.ts
|
|
702
742
|
init_cjs_shims();
|
|
703
743
|
var import_eslint_plugin_prefer_arrow_functions = __toESM(require("eslint-plugin-prefer-arrow-functions"), 1);
|
|
@@ -788,7 +828,7 @@ var tailwindEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
788
828
|
init_cjs_shims();
|
|
789
829
|
var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
|
|
790
830
|
var import_toml_eslint_parser = __toESM(require("toml-eslint-parser"), 1);
|
|
791
|
-
var
|
|
831
|
+
var DEFAULT_FILES3 = [GLOB_TOML];
|
|
792
832
|
var DEFAULT_FILES_TO_IGNORE = ["Cargo.lock"];
|
|
793
833
|
var tomlEslintConfig = (options = {}, internalOptions = {}) => {
|
|
794
834
|
const builder = new ConfigEntryBuilder(options, internalOptions);
|
|
@@ -797,7 +837,7 @@ var tomlEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
797
837
|
"toml",
|
|
798
838
|
{
|
|
799
839
|
includeDefaultFilesAndIgnores: true,
|
|
800
|
-
filesFallback:
|
|
840
|
+
filesFallback: DEFAULT_FILES3,
|
|
801
841
|
mergeUserFilesWithFallback: !options.doNotMergeFilesWithDefault
|
|
802
842
|
}
|
|
803
843
|
],
|
|
@@ -1030,9 +1070,10 @@ var vueEslintConfig = (options, internalOptions = {}) => {
|
|
|
1030
1070
|
const isLess2_6 = isVue2 && vueMajorAndMinorVersion < 2.6;
|
|
1031
1071
|
const isLess3_1 = vueMajorAndMinorVersion < 3.1;
|
|
1032
1072
|
const isNuxtEnabled = Boolean(options.nuxtMajorVersion);
|
|
1033
|
-
const recommendedRules = import_eslint_plugin_vue.default.configs[isVue3 ? "flat/recommended" : "flat/vue2-recommended"].
|
|
1034
|
-
(
|
|
1035
|
-
|
|
1073
|
+
const recommendedRules = import_eslint_plugin_vue.default.configs[isVue3 ? "flat/recommended" : "flat/vue2-recommended"].reduce(
|
|
1074
|
+
(result, config) => Object.assign(result, config.rules),
|
|
1075
|
+
{}
|
|
1076
|
+
);
|
|
1036
1077
|
const nuxtLayoutsFilesGlob = joinPaths([options.nuxtOrVueProjectDir, "layouts/**/*.vue"]);
|
|
1037
1078
|
const builder = new ConfigEntryBuilder(options, internalOptions);
|
|
1038
1079
|
builder.addConfig("vue/setup", {
|
|
@@ -1215,7 +1256,7 @@ var vueEslintConfig = (options, internalOptions = {}) => {
|
|
|
1215
1256
|
init_cjs_shims();
|
|
1216
1257
|
var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
|
|
1217
1258
|
var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
|
|
1218
|
-
var
|
|
1259
|
+
var DEFAULT_FILES4 = [GLOB_YAML];
|
|
1219
1260
|
var DEFAULT_FILES_TO_IGNORE2 = ["yarn.lock", "pnpm-lock.yaml"];
|
|
1220
1261
|
var yamlEslintConfig = (options = {}, internalOptions = {}) => {
|
|
1221
1262
|
const builder = new ConfigEntryBuilder(options, internalOptions);
|
|
@@ -1224,7 +1265,7 @@ var yamlEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1224
1265
|
"yaml",
|
|
1225
1266
|
{
|
|
1226
1267
|
includeDefaultFilesAndIgnores: true,
|
|
1227
|
-
filesFallback:
|
|
1268
|
+
filesFallback: DEFAULT_FILES4,
|
|
1228
1269
|
mergeUserFilesWithFallback: !options.doNotMergeFilesWithDefault
|
|
1229
1270
|
}
|
|
1230
1271
|
],
|
|
@@ -1248,8 +1289,8 @@ var yamlEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1248
1289
|
(result, config) => Object.assign(result, config.rules),
|
|
1249
1290
|
{}
|
|
1250
1291
|
)
|
|
1251
|
-
).addRule("yml/block-mapping-colon-indicator-newline", ERROR).addRule("yml/file-extension", ERROR, [{ extension: options.enforceExtension ?? "yml" }]).addRule("yml/indent", ERROR).addRule("yml/key-name-casing", ERROR, [
|
|
1252
|
-
{
|
|
1292
|
+
).addRule("yml/block-mapping-colon-indicator-newline", ERROR).addRule("yml/file-extension", ERROR, [{ extension: options.enforceExtension ?? "yml" }]).addRule("yml/indent", ERROR).addRule("yml/key-name-casing", options.casing == null ? OFF : ERROR, [
|
|
1293
|
+
{ ...options.casing, ignores: ["<<", ...options.casing?.ignores || []] }
|
|
1253
1294
|
]).addRule("yml/quotes", options.quotes === false ? OFF : ERROR, [
|
|
1254
1295
|
{ prefer: options.quotes || "single" }
|
|
1255
1296
|
]).addRule("yml/no-multiple-empty-lines", ERROR).addRule("yml/spaced-comment", ERROR).addOverrides();
|
|
@@ -1338,6 +1379,10 @@ var eslintConfig = (options = {}) => {
|
|
|
1338
1379
|
const jsoncOptions = {
|
|
1339
1380
|
...assignOptions(configsOptions, "json")
|
|
1340
1381
|
};
|
|
1382
|
+
const isPackageJsonEnabled = Boolean(configsOptions.packageJson ?? false);
|
|
1383
|
+
const packageJsonOptions = {
|
|
1384
|
+
...assignOptions(configsOptions, "packageJson")
|
|
1385
|
+
};
|
|
1341
1386
|
const internalOptions = {
|
|
1342
1387
|
globalOptions: options,
|
|
1343
1388
|
isTypescriptEnabled,
|
|
@@ -1391,6 +1436,7 @@ var eslintConfig = (options = {}) => {
|
|
|
1391
1436
|
isYamlEnabled && yamlEslintConfig(yamlOptions, internalOptions),
|
|
1392
1437
|
isTomlEnabled && tomlEslintConfig(tomlOptions, internalOptions),
|
|
1393
1438
|
isJsoncEnabled && jsoncEslintConfig(jsoncOptions, internalOptions),
|
|
1439
|
+
isPackageJsonEnabled && packageJsonEslintConfig(packageJsonOptions, internalOptions),
|
|
1394
1440
|
isTypescriptEnabled && tsEslintConfig(tsOptions, internalOptions),
|
|
1395
1441
|
// Must come after all rulesets for vanilla JS
|
|
1396
1442
|
isVueEnabled && vueEslintConfig(vueOptions, internalOptions),
|