@jsse/eslint-config 0.9.5 → 0.9.7

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/fixable.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as FIXABLE_RULES_MAP } from "./fixable-rules-map-dNndx2ig.js";
1
+ import { t as FIXABLE_RULES_MAP } from "./fixable-rules-map-D78O3kqI.js";
2
2
  //#region src/fixable.ts
3
3
  const FIXABLE_RULES = Object.values(FIXABLE_RULES_MAP).flat();
4
4
  //#endregion
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-Ct5mIeIb.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.5";
3
+ declare const VERSION = "0.9.7";
4
4
  //#endregion
5
5
  //#region src/define-config.d.ts
6
6
  /**
@@ -9,8 +9,8 @@ declare const VERSION = "0.9.5";
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.5";
33
+ const VERSION = "0.9.7";
33
34
  //#endregion
34
35
  //#region src/globs.ts
35
36
  var globs_exports = /* @__PURE__ */ __exportAll({
@@ -5042,7 +5043,6 @@ function typescriptRulesTypeOblivious() {
5042
5043
  "no-bitwise": "off",
5043
5044
  "no-duplicate-imports": "off",
5044
5045
  "no-empty-function": "off",
5045
- "no-loop-func": "off",
5046
5046
  "no-loss-of-precision": "off",
5047
5047
  "no-restricted-imports": "off",
5048
5048
  "no-use-before-define": "off",
@@ -5065,6 +5065,7 @@ function typescriptRulesTypeOblivious() {
5065
5065
  "no-func-assign": "warn",
5066
5066
  "no-label-var": "error",
5067
5067
  "no-lone-blocks": "warn",
5068
+ "no-loop-func": "error",
5068
5069
  "no-multi-str": "error",
5069
5070
  "no-new": "warn",
5070
5071
  "no-new-func": "error",
@@ -5114,7 +5115,6 @@ function typescriptRulesTypeOblivious() {
5114
5115
  "@typescript-eslint/no-dupe-class-members": "error",
5115
5116
  "@typescript-eslint/no-empty-function": "error",
5116
5117
  "@typescript-eslint/no-inferrable-types": "off",
5117
- "@typescript-eslint/no-loop-func": "error",
5118
5118
  "@typescript-eslint/no-namespace": ["error", {
5119
5119
  allowDeclarations: false,
5120
5120
  allowDefinitionFiles: false
@@ -5744,18 +5744,18 @@ async function importReactPlugins() {
5744
5744
  return { pluginReact: await Promise.resolve(interopDefault(import("@eslint-react/eslint-plugin"))) };
5745
5745
  }
5746
5746
  const eslintReact = async (options) => {
5747
- const { preset } = options ?? {};
5747
+ const { eslintReactPreset: preset } = options ?? {};
5748
5748
  const { pluginReact } = await importReactPlugins();
5749
5749
  const coreReactPlugins = pluginReact.configs.all.plugins?.["@eslint-react"];
5750
5750
  if (!coreReactPlugins) throw new Error("coreReactPlugins is undefined");
5751
5751
  const presetRules = pluginReact.configs[normalizeReactPreset(preset)].rules;
5752
5752
  return [{
5753
5753
  files: [GLOB_SRC],
5754
- name: "jsse/react/setup",
5754
+ name: "jsse/eslint-react/setup",
5755
5755
  plugins: { "@eslint-react": coreReactPlugins }
5756
5756
  }, {
5757
5757
  files: [GLOB_SRC],
5758
- name: "jsse/react/rules",
5758
+ name: "jsse/eslint-react/rules",
5759
5759
  rules: { ...presetRules },
5760
5760
  settings: { react: { version: "detect" } }
5761
5761
  }];
@@ -5769,7 +5769,7 @@ async function importPluginReactHooks() {
5769
5769
  throw new Error("eslint-plugin-react-hooks is not installed", { cause: error });
5770
5770
  }
5771
5771
  }
5772
- const reactHooks = async ({ overrides = {}, preset = "recommended" } = {}) => {
5772
+ const reactHooks = async ({ overrides = {}, preset = "recommended-latest" } = {}) => {
5773
5773
  const pluginReactHooks = await importPluginReactHooks();
5774
5774
  const presetRules = pluginReactHooks.configs[preset].rules;
5775
5775
  return [{
@@ -5777,8 +5777,6 @@ const reactHooks = async ({ overrides = {}, preset = "recommended" } = {}) => {
5777
5777
  name: "jsse/react-hooks/rules",
5778
5778
  plugins: { "react-hooks": pluginReactHooks },
5779
5779
  rules: {
5780
- "react-hooks/exhaustive-deps": "error",
5781
- "react-hooks/rules-of-hooks": "error",
5782
5780
  ...presetRules,
5783
5781
  ...overrides
5784
5782
  },
@@ -5787,15 +5785,8 @@ const reactHooks = async ({ overrides = {}, preset = "recommended" } = {}) => {
5787
5785
  };
5788
5786
  //#endregion
5789
5787
  //#region src/configs/react/refresh.ts
5790
- async function importPluginReactRefresh() {
5791
- try {
5792
- return await interopDefault(import("eslint-plugin-react-refresh"));
5793
- } catch (error) {
5794
- throw new Error("eslint-plugin-react-refresh is not installed", { cause: error });
5795
- }
5796
- }
5797
- const reactRefresh = async () => {
5798
- const pluginReactRefresh = await importPluginReactRefresh();
5788
+ const reactRefresh = ({ overrides = {}, preset = "recommended" } = {}) => {
5789
+ const presetRules = pluginReactRefresh.configs[preset].rules;
5799
5790
  return [
5800
5791
  {
5801
5792
  files: [GLOB_SRC],
@@ -5805,7 +5796,10 @@ const reactRefresh = async () => {
5805
5796
  {
5806
5797
  files: [GLOB_SRC],
5807
5798
  name: "jsse/react/refresh",
5808
- rules: { "react-refresh/only-export-components": "error" }
5799
+ rules: {
5800
+ ...presetRules,
5801
+ ...overrides
5802
+ }
5809
5803
  },
5810
5804
  {
5811
5805
  files: ["**/*.stories.tsx"],
@@ -5835,7 +5829,10 @@ const react = async (options) => {
5835
5829
  rules: { "unicorn/no-null": "off" }
5836
5830
  }
5837
5831
  ];
5838
- if (refresh) config.push(...await reactRefresh());
5832
+ if (refresh) config.push(...await reactRefresh({
5833
+ overrides,
5834
+ preset: refresh === true ? void 0 : refresh
5835
+ }));
5839
5836
  if (options?.overrides) config.push({
5840
5837
  files: [GLOB_JSX, GLOB_TSX],
5841
5838
  name: "jsse/react/overrides",
@@ -6580,29 +6577,27 @@ const yml = async (options) => {
6580
6577
  };
6581
6578
  //#endregion
6582
6579
  //#region src/configs/sort-geojson.ts
6583
- const sortGeojson = () => {
6584
- return [{
6585
- files: [GLOB_GEOJSON, "!**/*.min.geojson"],
6586
- name: "jsse/sort/geojson",
6587
- rules: { "jsonc/sort-keys": ["error", {
6588
- order: [
6589
- "type",
6590
- "id",
6591
- "name",
6592
- "crs",
6593
- "bbox",
6594
- "features",
6595
- "geometry",
6596
- "properties",
6597
- {
6598
- keyPattern: ".*",
6599
- order: { type: "asc" }
6600
- }
6601
- ],
6602
- pathPattern: ".*"
6603
- }] }
6604
- }];
6605
- };
6580
+ const sortGeojson = () => [{
6581
+ files: [GLOB_GEOJSON, "!**/*.min.geojson"],
6582
+ name: "jsse/sort/geojson",
6583
+ rules: { "jsonc/sort-keys": ["error", {
6584
+ order: [
6585
+ "type",
6586
+ "id",
6587
+ "name",
6588
+ "crs",
6589
+ "bbox",
6590
+ "features",
6591
+ "geometry",
6592
+ "properties",
6593
+ {
6594
+ keyPattern: ".*",
6595
+ order: { type: "asc" }
6596
+ }
6597
+ ],
6598
+ pathPattern: ".*"
6599
+ }] }
6600
+ }];
6606
6601
  //#endregion
6607
6602
  //#region node_modules/.pnpm/acorn@8.17.0/node_modules/acorn/dist/acorn.mjs
6608
6603
  var astralIdentifierCodes = [
@@ -13143,23 +13138,21 @@ quansync(function* (name, cwd) {
13143
13138
  /**
13144
13139
  * CONSTANTS LISTS AND REFERENCES OH MY!
13145
13140
  */
13146
- const isEnvDebug = () => {
13141
+ const isEnvDebug = () => [
13142
+ "DEBUG",
13143
+ "JSSE_DEBUG",
13144
+ "JSSEDEBUG"
13145
+ ].some((env) => {
13146
+ const value = process$1.env[env];
13147
13147
  return [
13148
- "DEBUG",
13149
- "JSSE_DEBUG",
13150
- "JSSEDEBUG"
13151
- ].some((env) => {
13152
- const value = process$1.env[env];
13153
- return [
13154
- "1",
13155
- "true",
13156
- "t",
13157
- "on",
13158
- "yes",
13159
- "y"
13160
- ].includes(value ?? "");
13161
- });
13162
- };
13148
+ "1",
13149
+ "true",
13150
+ "t",
13151
+ "on",
13152
+ "yes",
13153
+ "y"
13154
+ ].includes(value ?? "");
13155
+ });
13163
13156
  const DEBUG = isEnvDebug();
13164
13157
  const SLOW_RULES = [
13165
13158
  "@typescript-eslint/no-misused-promises",
@@ -13195,11 +13188,14 @@ function defaultOptions() {
13195
13188
  demorgan: true,
13196
13189
  diagnostics: true,
13197
13190
  e18e: true,
13191
+ extendTsconfigLintGlobs: [],
13198
13192
  fast: false,
13199
13193
  gitignore: true,
13200
13194
  isInEditor: isInEditor(),
13195
+ javascript: {},
13201
13196
  jsdoc: true,
13202
13197
  jsonc: true,
13198
+ jsx: true,
13203
13199
  markdown: false,
13204
13200
  n: true,
13205
13201
  nodeTest: false,
@@ -13207,6 +13203,7 @@ function defaultOptions() {
13207
13203
  pnpm: false,
13208
13204
  prettier: true,
13209
13205
  react: false,
13206
+ reactRefresh: true,
13210
13207
  regexp: true,
13211
13208
  reportUnusedDisableDirectives: true,
13212
13209
  rootId: "jsse",
@@ -13217,6 +13214,7 @@ function defaultOptions() {
13217
13214
  stylistic: true,
13218
13215
  tailwind: false,
13219
13216
  tsPrefix: "@typescript-eslint",
13217
+ type: "lib",
13220
13218
  typeAware: false,
13221
13219
  typescript: typescriptExists,
13222
13220
  unicorn: true,
@@ -13309,7 +13307,7 @@ function getReactRefreshOption(options) {
13309
13307
  }
13310
13308
  async function gitignoreConfig(options) {
13311
13309
  if (options === false) return [];
13312
- const flatGitignore = await interopDefault(import("./dist-DS02OtwI.js"));
13310
+ const flatGitignore = await interopDefault(import("./dist-CO6gUJWD.js"));
13313
13311
  const config = options === true ? flatGitignore() : flatGitignore(options);
13314
13312
  dbg("Using eslint-config-flat-gitignore: %O", config);
13315
13313
  return [config];
@@ -13323,7 +13321,7 @@ async function gitignoreConfig(options) {
13323
13321
  async function jsse(options = {}, ...userConfigs) {
13324
13322
  const startTime = process$1.hrtime.bigint();
13325
13323
  const normalizedOptions = normalizeOptions(options);
13326
- 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;
13324
+ 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;
13327
13325
  if (debug || process$1.argv.includes("--debug")) enableDbg();
13328
13326
  dbg("@jsse/eslint-config debug=true");
13329
13327
  dbg("@jsse/eslint-config isInEditor: %O", isInEditor);
@@ -13345,7 +13343,11 @@ async function jsse(options = {}, ...userConfigs) {
13345
13343
  if (unicornOptions) configs.push(unicorn(typeof unicornOptions === "object" ? unicornOptions : {}));
13346
13344
  if (antfuOptions) configs.push(antfu(typeof antfuOptions === "object" ? antfuOptions : void 0));
13347
13345
  if (deMorganOptions) configs.push(deMorgan(typeof deMorganOptions === "object" ? deMorganOptions : void 0));
13348
- if (e18eOptions) configs.push(e18e(typeof e18eOptions === "object" ? e18eOptions : {}));
13346
+ if (e18eOptions) configs.push(e18e({
13347
+ isInEditor,
13348
+ type,
13349
+ ...typeof e18eOptions === "object" && e18eOptions
13350
+ }));
13349
13351
  if (enableSortImports) configs.push(perfectionist());
13350
13352
  /**
13351
13353
  * =========================================================================
@@ -13366,13 +13368,14 @@ async function jsse(options = {}, ...userConfigs) {
13366
13368
  */
13367
13369
  if (typescriptOptions) {
13368
13370
  const tsconfigProvided = typeof typescriptOptions === "object" && !!typescriptOptions.tsconfig;
13369
- const effectiveTypeAware = options.typeAware === void 0 ? tsconfigProvided : normalizedOptions.typeAware;
13371
+ const nestedTypeAware = typeof typescriptOptions === "object" ? typescriptOptions.typeAware : void 0;
13372
+ const effectiveTypeAware = options.typeAware === void 0 ? nestedTypeAware ?? tsconfigProvided : normalizedOptions.typeAware;
13370
13373
  const tscfg = typescript({
13371
13374
  ...typeof typescriptOptions !== "boolean" && typescriptOptions,
13372
13375
  componentExts,
13373
13376
  prefix: {
13374
13377
  from: "@typescript-eslint",
13375
- to: tsPrefix ?? "@typescript-eslint"
13378
+ to: tsPrefix
13376
13379
  },
13377
13380
  typeAware: effectiveTypeAware
13378
13381
  });
@@ -13391,7 +13394,7 @@ async function jsse(options = {}, ...userConfigs) {
13391
13394
  }
13392
13395
  if (enableReact) configs.push(react({
13393
13396
  ...typeof enableReact === "object" && enableReact,
13394
- refresh: typeof enableReact === "object" && getReactRefreshOption(enableReact) !== void 0 ? getReactRefreshOption(enableReact) : normalizedOptions.reactRefresh !== false
13397
+ refresh: typeof enableReact === "object" && getReactRefreshOption(enableReact) !== void 0 ? getReactRefreshOption(enableReact) : normalizedOptions.reactRefresh
13395
13398
  }));
13396
13399
  if (enablePrettier) configs.push(prettier());
13397
13400
  if (stylisticOptions) configs.push(stylistic(stylisticOptions === true ? {} : stylisticOptions));