@vinicunca/eslint-config 4.6.0 → 4.7.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.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { FlatConfigComposer } from "eslint-flat-config-utils";
2
2
  import process from "node:process";
3
- import fsPromises from "node:fs/promises";
3
+ import fs from "node:fs/promises";
4
4
  import { fileURLToPath } from "node:url";
5
- import fs from "node:fs";
5
+ import fs$1 from "node:fs";
6
6
  import path from "node:path";
7
7
  import { isPackageExists } from "local-pkg";
8
8
  import createCommand from "eslint-plugin-command/config";
@@ -46,7 +46,7 @@ async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {})
46
46
  while (directory) {
47
47
  const filePath = isAbsoluteName ? name : path.join(directory, name);
48
48
  try {
49
- const stats = await fsPromises.stat(filePath);
49
+ const stats = await fs.stat(filePath);
50
50
  if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
51
51
  } catch {}
52
52
  if (directory === stopAt || directory === root) break;
@@ -61,7 +61,7 @@ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
61
61
  while (directory) {
62
62
  const filePath = isAbsoluteName ? name : path.join(directory, name);
63
63
  try {
64
- const stats = fs.statSync(filePath, { throwIfNoEntry: false });
64
+ const stats = fs$1.statSync(filePath, { throwIfNoEntry: false });
65
65
  if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
66
66
  } catch {}
67
67
  if (directory === stopAt || directory === root) break;
@@ -911,8 +911,11 @@ async function javascript(options = {}) {
911
911
  async function jsdoc(options = {}) {
912
912
  const { stylistic: stylistic$1 = true } = options;
913
913
  return [{
914
+ name: "vinicunca/jsdoc/setup",
915
+ plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) }
916
+ }, {
917
+ files: [GLOB_SRC],
914
918
  name: "vinicunca/jsdoc/rules",
915
- plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) },
916
919
  rules: {
917
920
  "jsdoc/check-access": WARN,
918
921
  "jsdoc/check-alignment": WARN,
@@ -950,13 +953,12 @@ async function jsonc(options = {}) {
950
953
  GLOB_JSONC
951
954
  ], overrides = {}, stylistic: stylistic$1 = true } = options;
952
955
  const { indent = 2 } = e$2(stylistic$1) ? {} : stylistic$1;
953
- const [pluginJsonc, parserJsonc] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
954
956
  return [{
955
957
  name: "vinicunca/jsonc/setup",
956
- plugins: { jsonc: pluginJsonc }
958
+ plugins: { jsonc: await interopDefault(import("eslint-plugin-jsonc")) }
957
959
  }, {
958
960
  files,
959
- languageOptions: { parser: parserJsonc },
961
+ language: "jsonc/x",
960
962
  name: "vinicunca/jsonc/rules",
961
963
  rules: {
962
964
  "jsonc/no-bigint-literals": ERROR,
@@ -1050,7 +1052,7 @@ async function jsx(options = {}) {
1050
1052
  //#endregion
1051
1053
  //#region src/configs/markdown.ts
1052
1054
  async function markdown(options = {}) {
1053
- const { componentExts = [], files = [GLOB_MARKDOWN], overrides = {} } = options;
1055
+ const { componentExts = [], files = [GLOB_MARKDOWN], gfm = true, overrides = {}, overridesMarkdown = {} } = options;
1054
1056
  const markdown$1 = await interopDefault(import("@eslint/markdown"));
1055
1057
  return [
1056
1058
  {
@@ -1065,9 +1067,33 @@ async function markdown(options = {}) {
1065
1067
  },
1066
1068
  {
1067
1069
  files,
1068
- languageOptions: { parser: parserPlain },
1070
+ language: gfm ? "markdown/gfm" : "markdown/commonmark",
1069
1071
  name: "vinicunca/markdown/parser"
1070
1072
  },
1073
+ {
1074
+ files,
1075
+ name: "vinicunca/markdown/rules",
1076
+ rules: {
1077
+ ...markdown$1.configs.recommended.at(0)?.rules,
1078
+ "markdown/no-missing-label-refs": OFF,
1079
+ ...overridesMarkdown
1080
+ }
1081
+ },
1082
+ {
1083
+ files,
1084
+ name: "vinicunca/markdown/disables/markdown",
1085
+ rules: {
1086
+ "command/command": OFF,
1087
+ "no-irregular-whitespace": OFF,
1088
+ "perfectionist/sort-exports": OFF,
1089
+ "perfectionist/sort-imports": OFF,
1090
+ "regexp/no-legacy-features": OFF,
1091
+ "regexp/no-missing-g-flag": OFF,
1092
+ "regexp/no-useless-dollar-replacements": OFF,
1093
+ "regexp/no-useless-flag": OFF,
1094
+ "style/indent": OFF
1095
+ }
1096
+ },
1071
1097
  {
1072
1098
  files: [GLOB_MARKDOWN_CODE, ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
1073
1099
  languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
@@ -1208,21 +1234,20 @@ async function perfectionist() {
1208
1234
  async function detectCatalogUsage() {
1209
1235
  const workspaceFile = await findUp("pnpm-workspace.yaml");
1210
1236
  if (!workspaceFile) return false;
1211
- const yaml$1 = await fsPromises.readFile(workspaceFile, "utf-8");
1237
+ const yaml$1 = await fs.readFile(workspaceFile, "utf-8");
1212
1238
  return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
1213
1239
  }
1214
1240
  async function pnpm(options) {
1215
- const [pluginPnpm, pluginYaml, yamlParser, jsoncParser] = await Promise.all([
1241
+ const [pluginPnpm, pluginYaml, yamlParser] = await Promise.all([
1216
1242
  interopDefault(import("eslint-plugin-pnpm")),
1217
1243
  interopDefault(import("eslint-plugin-yml")),
1218
- interopDefault(import("yaml-eslint-parser")),
1219
- interopDefault(import("jsonc-eslint-parser"))
1244
+ interopDefault(import("yaml-eslint-parser"))
1220
1245
  ]);
1221
1246
  const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml: yaml$1 = true } = options;
1222
1247
  const configs$1 = [];
1223
1248
  if (json) configs$1.push({
1224
1249
  files: ["package.json", "**/package.json"],
1225
- languageOptions: { parser: jsoncParser },
1250
+ language: "jsonc/x",
1226
1251
  name: "vinicunca/pnpm/package-json",
1227
1252
  plugins: { pnpm: pluginPnpm },
1228
1253
  rules: {
@@ -2153,7 +2178,7 @@ async function typescript(options = {}) {
2153
2178
  }] : [],
2154
2179
  ...erasableOnly ? [{
2155
2180
  name: "antfu/typescript/erasable-syntax-only",
2156
- plugins: { "erasable-syntax-only": await interopDefault(import("./lib-AAJyPj3x.mjs")) },
2181
+ plugins: { "erasable-syntax-only": await interopDefault(import("./lib-ok3LDcYL.mjs")) },
2157
2182
  rules: {
2158
2183
  "erasable-syntax-only/enums": ERROR,
2159
2184
  "erasable-syntax-only/import-aliases": ERROR,