@jsse/eslint-config 0.9.6 → 0.9.8

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as OptionsConfig, c as RuleName, d as TypescriptPreset, i as EslintConfigFn, l as RulesRecord, n as Awaitable, o as ReactHooksPreset, r as Config, s as ReactPreset, t as FIXABLE_RULES_MAP, u as TypedFlatConfigItemWithId } from "./fixable-rules-map-rvCKnp8b.js";
1
+ import { a as OptionsConfig, c as RulesRecord, d as TypescriptPreset, i as NormalizedOptionsConfig, l as TypedConfig, n as EslintConfigFn, o as ReactHooksPreset, r as EslintReactPreset, s as RuleName, t as FIXABLE_RULES_MAP, u as TypedConfigWithId } from "./fixable-rules-map-B6PZdB33.js";
2
2
  //#region src/_generated/version.d.ts
3
- declare const VERSION = "0.9.6";
3
+ declare const VERSION = "0.9.8";
4
4
  //#endregion
5
5
  //#region src/define-config.d.ts
6
6
  /**
@@ -9,8 +9,8 @@ declare const VERSION = "0.9.6";
9
9
  * @param userConfigs Additional user ESLint configs to merge in
10
10
  * @returns Array of ESLint flat config items
11
11
  */
12
- declare function jsse(options?: OptionsConfig & Config, ...userConfigs: (Config | Config[])[]): Promise<Config[]>;
13
- declare function defineConfig(options?: OptionsConfig & Config, ...userConfigs: (Config | Config[])[]): Promise<Config[]>;
12
+ declare function jsse(options?: OptionsConfig & TypedConfig, ...userConfigs: (TypedConfig | TypedConfig[])[]): Promise<TypedConfig[]>;
13
+ declare function defineConfig(options?: OptionsConfig & TypedConfig, ...userConfigs: (TypedConfig | TypedConfig[])[]): Promise<TypedConfig[]>;
14
14
  type DefineConfig = typeof defineConfig;
15
15
  declare namespace globs_d_exports {
16
16
  export { GLOB_ALL_SRC, GLOB_CODE, GLOB_CSS, GLOB_EXCLUDE, GLOB_GEOJSON, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_JS_SRC_EXT, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_TS_SRC_EXT, GLOB_YAML };
@@ -45,6 +45,6 @@ declare const GLOB_ALL_SRC: string[];
45
45
  declare const GLOB_EXCLUDE: string[];
46
46
  //#endregion
47
47
  //#region src/options.d.ts
48
- declare function defaultOptions(): OptionsConfig;
48
+ declare function defaultOptions(): NormalizedOptionsConfig;
49
49
  //#endregion
50
- export { type Awaitable, type Config, type DefineConfig, type EslintConfigFn, FIXABLE_RULES_MAP, type OptionsConfig, type ReactHooksPreset, type ReactPreset, type RuleName, type RulesRecord, type TypedFlatConfigItemWithId, type TypescriptPreset, VERSION, jsse as default, jsse, defaultOptions, defineConfig, globs_d_exports as globs };
50
+ export { type DefineConfig, type EslintConfigFn, type EslintReactPreset, FIXABLE_RULES_MAP, type OptionsConfig, type ReactHooksPreset, type RuleName, type RulesRecord, type TypedConfig, type TypedConfigWithId as TypedFlatConfigItemWithId, type TypescriptPreset, VERSION, jsse as default, jsse, defaultOptions, defineConfig, globs_d_exports as globs };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as __exportAll, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-DJK8HYOj.js";
2
- import { t as FIXABLE_RULES_MAP } from "./fixable-rules-map-dNndx2ig.js";
2
+ import { t as FIXABLE_RULES_MAP } from "./fixable-rules-map-D78O3kqI.js";
3
3
  import { builtinModules, createRequire } from "node:module";
4
4
  import process$1 from "node:process";
5
5
  import pluginE18e from "@e18e/eslint-plugin";
@@ -13,6 +13,7 @@ import pluginJsdoc from "eslint-plugin-jsdoc";
13
13
  import pluginN from "eslint-plugin-n";
14
14
  import pluginPerfectionist from "eslint-plugin-perfectionist";
15
15
  import pluginPnpm from "eslint-plugin-pnpm";
16
+ import pluginReactRefresh from "eslint-plugin-react-refresh";
16
17
  import { configs } from "eslint-plugin-regexp";
17
18
  import pluginUnicorn from "eslint-plugin-unicorn";
18
19
  import pluginUnusedImports from "eslint-plugin-unused-imports";
@@ -29,7 +30,7 @@ import assert from "node:assert";
29
30
  import v8 from "node:v8";
30
31
  import { format, inspect } from "node:util";
31
32
  //#region src/_generated/version.ts
32
- const VERSION = "0.9.6";
33
+ const VERSION = "0.9.8";
33
34
  //#endregion
34
35
  //#region src/globs.ts
35
36
  var globs_exports = /* @__PURE__ */ __exportAll({
@@ -207,6 +208,10 @@ function e18e(options = {}) {
207
208
  "e18e/prefer-spread-syntax": "off",
208
209
  ...overrides
209
210
  }
211
+ }, {
212
+ files: GLOB_TESTS,
213
+ name: "jsse/e18e/tests",
214
+ rules: { "e18e/prefer-static-regex": "off" }
210
215
  }];
211
216
  }
212
217
  //#endregion
@@ -5743,18 +5748,18 @@ async function importReactPlugins() {
5743
5748
  return { pluginReact: await Promise.resolve(interopDefault(import("@eslint-react/eslint-plugin"))) };
5744
5749
  }
5745
5750
  const eslintReact = async (options) => {
5746
- const { preset } = options ?? {};
5751
+ const { eslintReactPreset: preset } = options ?? {};
5747
5752
  const { pluginReact } = await importReactPlugins();
5748
5753
  const coreReactPlugins = pluginReact.configs.all.plugins?.["@eslint-react"];
5749
5754
  if (!coreReactPlugins) throw new Error("coreReactPlugins is undefined");
5750
5755
  const presetRules = pluginReact.configs[normalizeReactPreset(preset)].rules;
5751
5756
  return [{
5752
5757
  files: [GLOB_SRC],
5753
- name: "jsse/react/setup",
5758
+ name: "jsse/eslint-react/setup",
5754
5759
  plugins: { "@eslint-react": coreReactPlugins }
5755
5760
  }, {
5756
5761
  files: [GLOB_SRC],
5757
- name: "jsse/react/rules",
5762
+ name: "jsse/eslint-react/rules",
5758
5763
  rules: { ...presetRules },
5759
5764
  settings: { react: { version: "detect" } }
5760
5765
  }];
@@ -5768,7 +5773,7 @@ async function importPluginReactHooks() {
5768
5773
  throw new Error("eslint-plugin-react-hooks is not installed", { cause: error });
5769
5774
  }
5770
5775
  }
5771
- const reactHooks = async ({ overrides = {}, preset = "recommended" } = {}) => {
5776
+ const reactHooks = async ({ overrides = {}, preset = "recommended-latest" } = {}) => {
5772
5777
  const pluginReactHooks = await importPluginReactHooks();
5773
5778
  const presetRules = pluginReactHooks.configs[preset].rules;
5774
5779
  return [{
@@ -5776,8 +5781,6 @@ const reactHooks = async ({ overrides = {}, preset = "recommended" } = {}) => {
5776
5781
  name: "jsse/react-hooks/rules",
5777
5782
  plugins: { "react-hooks": pluginReactHooks },
5778
5783
  rules: {
5779
- "react-hooks/exhaustive-deps": "error",
5780
- "react-hooks/rules-of-hooks": "error",
5781
5784
  ...presetRules,
5782
5785
  ...overrides
5783
5786
  },
@@ -5786,15 +5789,8 @@ const reactHooks = async ({ overrides = {}, preset = "recommended" } = {}) => {
5786
5789
  };
5787
5790
  //#endregion
5788
5791
  //#region src/configs/react/refresh.ts
5789
- async function importPluginReactRefresh() {
5790
- try {
5791
- return await interopDefault(import("eslint-plugin-react-refresh"));
5792
- } catch (error) {
5793
- throw new Error("eslint-plugin-react-refresh is not installed", { cause: error });
5794
- }
5795
- }
5796
- const reactRefresh = async () => {
5797
- const pluginReactRefresh = await importPluginReactRefresh();
5792
+ const reactRefresh = ({ overrides = {}, preset = "recommended" } = {}) => {
5793
+ const presetRules = pluginReactRefresh.configs[preset].rules;
5798
5794
  return [
5799
5795
  {
5800
5796
  files: [GLOB_SRC],
@@ -5804,7 +5800,10 @@ const reactRefresh = async () => {
5804
5800
  {
5805
5801
  files: [GLOB_SRC],
5806
5802
  name: "jsse/react/refresh",
5807
- rules: { "react-refresh/only-export-components": "error" }
5803
+ rules: {
5804
+ ...presetRules,
5805
+ ...overrides
5806
+ }
5808
5807
  },
5809
5808
  {
5810
5809
  files: ["**/*.stories.tsx"],
@@ -5834,7 +5833,10 @@ const react = async (options) => {
5834
5833
  rules: { "unicorn/no-null": "off" }
5835
5834
  }
5836
5835
  ];
5837
- if (refresh) config.push(...await reactRefresh());
5836
+ if (refresh) config.push(...await reactRefresh({
5837
+ overrides,
5838
+ preset: refresh === true ? void 0 : refresh
5839
+ }));
5838
5840
  if (options?.overrides) config.push({
5839
5841
  files: [GLOB_JSX, GLOB_TSX],
5840
5842
  name: "jsse/react/overrides",
@@ -6417,11 +6419,17 @@ const typescript = (options) => {
6417
6419
  "unused-imports/no-unused-vars": "off"
6418
6420
  }
6419
6421
  }, {
6420
- files: ["**/*.{test,spec}.ts?(x)"],
6422
+ files: GLOB_TESTS,
6421
6423
  name: "jsse/typescript/disables/test",
6422
6424
  rules: {
6423
6425
  "@typescript-eslint/no-unused-expressions": "off",
6424
- "no-unused-expressions": "off"
6426
+ "no-unused-expressions": "off",
6427
+ "@typescript-eslint/no-unsafe-argument": "off",
6428
+ "@typescript-eslint/no-unsafe-assignment": "off",
6429
+ "@typescript-eslint/no-unsafe-call": "off",
6430
+ "@typescript-eslint/no-unsafe-member-access": "off",
6431
+ "@typescript-eslint/no-unsafe-return": "off",
6432
+ "@typescript-eslint/unbound-method": "off"
6425
6433
  }
6426
6434
  }, {
6427
6435
  files: ["**/*.js", "**/*.cjs"],
@@ -6579,29 +6587,27 @@ const yml = async (options) => {
6579
6587
  };
6580
6588
  //#endregion
6581
6589
  //#region src/configs/sort-geojson.ts
6582
- const sortGeojson = () => {
6583
- return [{
6584
- files: [GLOB_GEOJSON, "!**/*.min.geojson"],
6585
- name: "jsse/sort/geojson",
6586
- rules: { "jsonc/sort-keys": ["error", {
6587
- order: [
6588
- "type",
6589
- "id",
6590
- "name",
6591
- "crs",
6592
- "bbox",
6593
- "features",
6594
- "geometry",
6595
- "properties",
6596
- {
6597
- keyPattern: ".*",
6598
- order: { type: "asc" }
6599
- }
6600
- ],
6601
- pathPattern: ".*"
6602
- }] }
6603
- }];
6604
- };
6590
+ const sortGeojson = () => [{
6591
+ files: [GLOB_GEOJSON, "!**/*.min.geojson"],
6592
+ name: "jsse/sort/geojson",
6593
+ rules: { "jsonc/sort-keys": ["error", {
6594
+ order: [
6595
+ "type",
6596
+ "id",
6597
+ "name",
6598
+ "crs",
6599
+ "bbox",
6600
+ "features",
6601
+ "geometry",
6602
+ "properties",
6603
+ {
6604
+ keyPattern: ".*",
6605
+ order: { type: "asc" }
6606
+ }
6607
+ ],
6608
+ pathPattern: ".*"
6609
+ }] }
6610
+ }];
6605
6611
  //#endregion
6606
6612
  //#region node_modules/.pnpm/acorn@8.17.0/node_modules/acorn/dist/acorn.mjs
6607
6613
  var astralIdentifierCodes = [
@@ -13142,23 +13148,21 @@ quansync(function* (name, cwd) {
13142
13148
  /**
13143
13149
  * CONSTANTS LISTS AND REFERENCES OH MY!
13144
13150
  */
13145
- const isEnvDebug = () => {
13151
+ const isEnvDebug = () => [
13152
+ "DEBUG",
13153
+ "JSSE_DEBUG",
13154
+ "JSSEDEBUG"
13155
+ ].some((env) => {
13156
+ const value = process$1.env[env];
13146
13157
  return [
13147
- "DEBUG",
13148
- "JSSE_DEBUG",
13149
- "JSSEDEBUG"
13150
- ].some((env) => {
13151
- const value = process$1.env[env];
13152
- return [
13153
- "1",
13154
- "true",
13155
- "t",
13156
- "on",
13157
- "yes",
13158
- "y"
13159
- ].includes(value ?? "");
13160
- });
13161
- };
13158
+ "1",
13159
+ "true",
13160
+ "t",
13161
+ "on",
13162
+ "yes",
13163
+ "y"
13164
+ ].includes(value ?? "");
13165
+ });
13162
13166
  const DEBUG = isEnvDebug();
13163
13167
  const SLOW_RULES = [
13164
13168
  "@typescript-eslint/no-misused-promises",
@@ -13194,11 +13198,14 @@ function defaultOptions() {
13194
13198
  demorgan: true,
13195
13199
  diagnostics: true,
13196
13200
  e18e: true,
13201
+ extendTsconfigLintGlobs: [],
13197
13202
  fast: false,
13198
13203
  gitignore: true,
13199
13204
  isInEditor: isInEditor(),
13205
+ javascript: {},
13200
13206
  jsdoc: true,
13201
13207
  jsonc: true,
13208
+ jsx: true,
13202
13209
  markdown: false,
13203
13210
  n: true,
13204
13211
  nodeTest: false,
@@ -13206,6 +13213,7 @@ function defaultOptions() {
13206
13213
  pnpm: false,
13207
13214
  prettier: true,
13208
13215
  react: false,
13216
+ reactRefresh: true,
13209
13217
  regexp: true,
13210
13218
  reportUnusedDisableDirectives: true,
13211
13219
  rootId: "jsse",
@@ -13216,6 +13224,7 @@ function defaultOptions() {
13216
13224
  stylistic: true,
13217
13225
  tailwind: false,
13218
13226
  tsPrefix: "@typescript-eslint",
13227
+ type: "lib",
13219
13228
  typeAware: false,
13220
13229
  typescript: typescriptExists,
13221
13230
  unicorn: true,
@@ -13322,7 +13331,7 @@ async function gitignoreConfig(options) {
13322
13331
  async function jsse(options = {}, ...userConfigs) {
13323
13332
  const startTime = process$1.hrtime.bigint();
13324
13333
  const normalizedOptions = normalizeOptions(options);
13325
- const { antfu: antfuOptions, command: commandOptions, componentExts, debug = false, demorgan: deMorganOptions, e18e: e18eOptions, gitignore: enableGitignore, isInEditor, javascript: javascriptOptions, jsdoc: jsdocOptions, jsonc: enableJsonc, markdown: enableMarkdown, n: nOptions, nodeTest: nodeTestOptions, off, pnpm: pnpmOptions, prettier: enablePrettier, react: enableReact, regexp: enableRegexp, reportUnusedDisableDirectives, rootId, sortGeojson: enableSortGeojson, sortImports: enableSortImports, sortPackageJson: enableSortPackageJson, sortTsconfig: enableSortTsconfig, stylistic: stylisticOptions, tailwind: tailwindOptions, tsPrefix, typescript: typescriptOptions, unicorn: unicornOptions, unusedImports: unusedImportsOptions, vitest: enableVitest, yaml: enableYaml } = normalizedOptions;
13334
+ const { antfu: antfuOptions, command: commandOptions, componentExts, debug, demorgan: deMorganOptions, e18e: e18eOptions, gitignore: enableGitignore, isInEditor, javascript: javascriptOptions, jsdoc: jsdocOptions, jsonc: enableJsonc, markdown: enableMarkdown, n: nOptions, nodeTest: nodeTestOptions, off, pnpm: pnpmOptions, prettier: enablePrettier, react: enableReact, regexp: enableRegexp, reportUnusedDisableDirectives, rootId, sortGeojson: enableSortGeojson, sortImports: enableSortImports, sortPackageJson: enableSortPackageJson, sortTsconfig: enableSortTsconfig, stylistic: stylisticOptions, tailwind: tailwindOptions, tsPrefix, type, typescript: typescriptOptions, unicorn: unicornOptions, unusedImports: unusedImportsOptions, vitest: enableVitest, yaml: enableYaml } = normalizedOptions;
13326
13335
  if (debug || process$1.argv.includes("--debug")) enableDbg();
13327
13336
  dbg("@jsse/eslint-config debug=true");
13328
13337
  dbg("@jsse/eslint-config isInEditor: %O", isInEditor);
@@ -13344,7 +13353,11 @@ async function jsse(options = {}, ...userConfigs) {
13344
13353
  if (unicornOptions) configs.push(unicorn(typeof unicornOptions === "object" ? unicornOptions : {}));
13345
13354
  if (antfuOptions) configs.push(antfu(typeof antfuOptions === "object" ? antfuOptions : void 0));
13346
13355
  if (deMorganOptions) configs.push(deMorgan(typeof deMorganOptions === "object" ? deMorganOptions : void 0));
13347
- if (e18eOptions) configs.push(e18e(typeof e18eOptions === "object" ? e18eOptions : {}));
13356
+ if (e18eOptions) configs.push(e18e({
13357
+ isInEditor,
13358
+ type,
13359
+ ...typeof e18eOptions === "object" && e18eOptions
13360
+ }));
13348
13361
  if (enableSortImports) configs.push(perfectionist());
13349
13362
  /**
13350
13363
  * =========================================================================
@@ -13365,13 +13378,14 @@ async function jsse(options = {}, ...userConfigs) {
13365
13378
  */
13366
13379
  if (typescriptOptions) {
13367
13380
  const tsconfigProvided = typeof typescriptOptions === "object" && !!typescriptOptions.tsconfig;
13368
- const effectiveTypeAware = options.typeAware === void 0 ? tsconfigProvided : normalizedOptions.typeAware;
13381
+ const nestedTypeAware = typeof typescriptOptions === "object" ? typescriptOptions.typeAware : void 0;
13382
+ const effectiveTypeAware = options.typeAware === void 0 ? nestedTypeAware ?? tsconfigProvided : normalizedOptions.typeAware;
13369
13383
  const tscfg = typescript({
13370
13384
  ...typeof typescriptOptions !== "boolean" && typescriptOptions,
13371
13385
  componentExts,
13372
13386
  prefix: {
13373
13387
  from: "@typescript-eslint",
13374
- to: tsPrefix ?? "@typescript-eslint"
13388
+ to: tsPrefix
13375
13389
  },
13376
13390
  typeAware: effectiveTypeAware
13377
13391
  });
@@ -13390,7 +13404,7 @@ async function jsse(options = {}, ...userConfigs) {
13390
13404
  }
13391
13405
  if (enableReact) configs.push(react({
13392
13406
  ...typeof enableReact === "object" && enableReact,
13393
- refresh: typeof enableReact === "object" && getReactRefreshOption(enableReact) !== void 0 ? getReactRefreshOption(enableReact) : normalizedOptions.reactRefresh !== false
13407
+ refresh: typeof enableReact === "object" && getReactRefreshOption(enableReact) !== void 0 ? getReactRefreshOption(enableReact) : normalizedOptions.reactRefresh
13394
13408
  }));
13395
13409
  if (enablePrettier) configs.push(prettier());
13396
13410
  if (stylisticOptions) configs.push(stylistic(stylisticOptions === true ? {} : stylisticOptions));