@jsse/eslint-config 0.9.6 → 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/CHANGELOG.md +5 -0
- package/README.md +35 -11
- package/dist/cli.js +8 -8
- package/dist/{fixable-rules-map-rvCKnp8b.d.ts → fixable-rules-map-B6PZdB33.d.ts} +70 -45
- package/dist/{fixable-rules-map-dNndx2ig.js → fixable-rules-map-D78O3kqI.js} +7 -1
- package/dist/fixable.d.ts +2 -2
- package/dist/fixable.js +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +67 -63
- package/dist/{rule-types-muUsP1iz.d.ts → rule-types-Ipu1JCu5.d.ts} +541 -420
- package/dist/rule-types.d.ts +2 -2
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as OptionsConfig, c as
|
|
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.
|
|
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.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 &
|
|
13
|
-
declare function defineConfig(options?: OptionsConfig &
|
|
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():
|
|
48
|
+
declare function defaultOptions(): NormalizedOptionsConfig;
|
|
49
49
|
//#endregion
|
|
50
|
-
export { type
|
|
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-
|
|
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.
|
|
33
|
+
const VERSION = "0.9.7";
|
|
33
34
|
//#endregion
|
|
34
35
|
//#region src/globs.ts
|
|
35
36
|
var globs_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -5743,18 +5744,18 @@ async function importReactPlugins() {
|
|
|
5743
5744
|
return { pluginReact: await Promise.resolve(interopDefault(import("@eslint-react/eslint-plugin"))) };
|
|
5744
5745
|
}
|
|
5745
5746
|
const eslintReact = async (options) => {
|
|
5746
|
-
const { preset } = options ?? {};
|
|
5747
|
+
const { eslintReactPreset: preset } = options ?? {};
|
|
5747
5748
|
const { pluginReact } = await importReactPlugins();
|
|
5748
5749
|
const coreReactPlugins = pluginReact.configs.all.plugins?.["@eslint-react"];
|
|
5749
5750
|
if (!coreReactPlugins) throw new Error("coreReactPlugins is undefined");
|
|
5750
5751
|
const presetRules = pluginReact.configs[normalizeReactPreset(preset)].rules;
|
|
5751
5752
|
return [{
|
|
5752
5753
|
files: [GLOB_SRC],
|
|
5753
|
-
name: "jsse/react/setup",
|
|
5754
|
+
name: "jsse/eslint-react/setup",
|
|
5754
5755
|
plugins: { "@eslint-react": coreReactPlugins }
|
|
5755
5756
|
}, {
|
|
5756
5757
|
files: [GLOB_SRC],
|
|
5757
|
-
name: "jsse/react/rules",
|
|
5758
|
+
name: "jsse/eslint-react/rules",
|
|
5758
5759
|
rules: { ...presetRules },
|
|
5759
5760
|
settings: { react: { version: "detect" } }
|
|
5760
5761
|
}];
|
|
@@ -5768,7 +5769,7 @@ async function importPluginReactHooks() {
|
|
|
5768
5769
|
throw new Error("eslint-plugin-react-hooks is not installed", { cause: error });
|
|
5769
5770
|
}
|
|
5770
5771
|
}
|
|
5771
|
-
const reactHooks = async ({ overrides = {}, preset = "recommended" } = {}) => {
|
|
5772
|
+
const reactHooks = async ({ overrides = {}, preset = "recommended-latest" } = {}) => {
|
|
5772
5773
|
const pluginReactHooks = await importPluginReactHooks();
|
|
5773
5774
|
const presetRules = pluginReactHooks.configs[preset].rules;
|
|
5774
5775
|
return [{
|
|
@@ -5776,8 +5777,6 @@ const reactHooks = async ({ overrides = {}, preset = "recommended" } = {}) => {
|
|
|
5776
5777
|
name: "jsse/react-hooks/rules",
|
|
5777
5778
|
plugins: { "react-hooks": pluginReactHooks },
|
|
5778
5779
|
rules: {
|
|
5779
|
-
"react-hooks/exhaustive-deps": "error",
|
|
5780
|
-
"react-hooks/rules-of-hooks": "error",
|
|
5781
5780
|
...presetRules,
|
|
5782
5781
|
...overrides
|
|
5783
5782
|
},
|
|
@@ -5786,15 +5785,8 @@ const reactHooks = async ({ overrides = {}, preset = "recommended" } = {}) => {
|
|
|
5786
5785
|
};
|
|
5787
5786
|
//#endregion
|
|
5788
5787
|
//#region src/configs/react/refresh.ts
|
|
5789
|
-
|
|
5790
|
-
|
|
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();
|
|
5788
|
+
const reactRefresh = ({ overrides = {}, preset = "recommended" } = {}) => {
|
|
5789
|
+
const presetRules = pluginReactRefresh.configs[preset].rules;
|
|
5798
5790
|
return [
|
|
5799
5791
|
{
|
|
5800
5792
|
files: [GLOB_SRC],
|
|
@@ -5804,7 +5796,10 @@ const reactRefresh = async () => {
|
|
|
5804
5796
|
{
|
|
5805
5797
|
files: [GLOB_SRC],
|
|
5806
5798
|
name: "jsse/react/refresh",
|
|
5807
|
-
rules: {
|
|
5799
|
+
rules: {
|
|
5800
|
+
...presetRules,
|
|
5801
|
+
...overrides
|
|
5802
|
+
}
|
|
5808
5803
|
},
|
|
5809
5804
|
{
|
|
5810
5805
|
files: ["**/*.stories.tsx"],
|
|
@@ -5834,7 +5829,10 @@ const react = async (options) => {
|
|
|
5834
5829
|
rules: { "unicorn/no-null": "off" }
|
|
5835
5830
|
}
|
|
5836
5831
|
];
|
|
5837
|
-
if (refresh) config.push(...await reactRefresh(
|
|
5832
|
+
if (refresh) config.push(...await reactRefresh({
|
|
5833
|
+
overrides,
|
|
5834
|
+
preset: refresh === true ? void 0 : refresh
|
|
5835
|
+
}));
|
|
5838
5836
|
if (options?.overrides) config.push({
|
|
5839
5837
|
files: [GLOB_JSX, GLOB_TSX],
|
|
5840
5838
|
name: "jsse/react/overrides",
|
|
@@ -6579,29 +6577,27 @@ const yml = async (options) => {
|
|
|
6579
6577
|
};
|
|
6580
6578
|
//#endregion
|
|
6581
6579
|
//#region src/configs/sort-geojson.ts
|
|
6582
|
-
const sortGeojson = () => {
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
}];
|
|
6604
|
-
};
|
|
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
|
+
}];
|
|
6605
6601
|
//#endregion
|
|
6606
6602
|
//#region node_modules/.pnpm/acorn@8.17.0/node_modules/acorn/dist/acorn.mjs
|
|
6607
6603
|
var astralIdentifierCodes = [
|
|
@@ -13142,23 +13138,21 @@ quansync(function* (name, cwd) {
|
|
|
13142
13138
|
/**
|
|
13143
13139
|
* CONSTANTS LISTS AND REFERENCES OH MY!
|
|
13144
13140
|
*/
|
|
13145
|
-
const isEnvDebug = () =>
|
|
13141
|
+
const isEnvDebug = () => [
|
|
13142
|
+
"DEBUG",
|
|
13143
|
+
"JSSE_DEBUG",
|
|
13144
|
+
"JSSEDEBUG"
|
|
13145
|
+
].some((env) => {
|
|
13146
|
+
const value = process$1.env[env];
|
|
13146
13147
|
return [
|
|
13147
|
-
"
|
|
13148
|
-
"
|
|
13149
|
-
"
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
"t",
|
|
13156
|
-
"on",
|
|
13157
|
-
"yes",
|
|
13158
|
-
"y"
|
|
13159
|
-
].includes(value ?? "");
|
|
13160
|
-
});
|
|
13161
|
-
};
|
|
13148
|
+
"1",
|
|
13149
|
+
"true",
|
|
13150
|
+
"t",
|
|
13151
|
+
"on",
|
|
13152
|
+
"yes",
|
|
13153
|
+
"y"
|
|
13154
|
+
].includes(value ?? "");
|
|
13155
|
+
});
|
|
13162
13156
|
const DEBUG = isEnvDebug();
|
|
13163
13157
|
const SLOW_RULES = [
|
|
13164
13158
|
"@typescript-eslint/no-misused-promises",
|
|
@@ -13194,11 +13188,14 @@ function defaultOptions() {
|
|
|
13194
13188
|
demorgan: true,
|
|
13195
13189
|
diagnostics: true,
|
|
13196
13190
|
e18e: true,
|
|
13191
|
+
extendTsconfigLintGlobs: [],
|
|
13197
13192
|
fast: false,
|
|
13198
13193
|
gitignore: true,
|
|
13199
13194
|
isInEditor: isInEditor(),
|
|
13195
|
+
javascript: {},
|
|
13200
13196
|
jsdoc: true,
|
|
13201
13197
|
jsonc: true,
|
|
13198
|
+
jsx: true,
|
|
13202
13199
|
markdown: false,
|
|
13203
13200
|
n: true,
|
|
13204
13201
|
nodeTest: false,
|
|
@@ -13206,6 +13203,7 @@ function defaultOptions() {
|
|
|
13206
13203
|
pnpm: false,
|
|
13207
13204
|
prettier: true,
|
|
13208
13205
|
react: false,
|
|
13206
|
+
reactRefresh: true,
|
|
13209
13207
|
regexp: true,
|
|
13210
13208
|
reportUnusedDisableDirectives: true,
|
|
13211
13209
|
rootId: "jsse",
|
|
@@ -13216,6 +13214,7 @@ function defaultOptions() {
|
|
|
13216
13214
|
stylistic: true,
|
|
13217
13215
|
tailwind: false,
|
|
13218
13216
|
tsPrefix: "@typescript-eslint",
|
|
13217
|
+
type: "lib",
|
|
13219
13218
|
typeAware: false,
|
|
13220
13219
|
typescript: typescriptExists,
|
|
13221
13220
|
unicorn: true,
|
|
@@ -13322,7 +13321,7 @@ async function gitignoreConfig(options) {
|
|
|
13322
13321
|
async function jsse(options = {}, ...userConfigs) {
|
|
13323
13322
|
const startTime = process$1.hrtime.bigint();
|
|
13324
13323
|
const normalizedOptions = normalizeOptions(options);
|
|
13325
|
-
const { antfu: antfuOptions, command: commandOptions, componentExts, debug
|
|
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;
|
|
13326
13325
|
if (debug || process$1.argv.includes("--debug")) enableDbg();
|
|
13327
13326
|
dbg("@jsse/eslint-config debug=true");
|
|
13328
13327
|
dbg("@jsse/eslint-config isInEditor: %O", isInEditor);
|
|
@@ -13344,7 +13343,11 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
13344
13343
|
if (unicornOptions) configs.push(unicorn(typeof unicornOptions === "object" ? unicornOptions : {}));
|
|
13345
13344
|
if (antfuOptions) configs.push(antfu(typeof antfuOptions === "object" ? antfuOptions : void 0));
|
|
13346
13345
|
if (deMorganOptions) configs.push(deMorgan(typeof deMorganOptions === "object" ? deMorganOptions : void 0));
|
|
13347
|
-
if (e18eOptions) configs.push(e18e(
|
|
13346
|
+
if (e18eOptions) configs.push(e18e({
|
|
13347
|
+
isInEditor,
|
|
13348
|
+
type,
|
|
13349
|
+
...typeof e18eOptions === "object" && e18eOptions
|
|
13350
|
+
}));
|
|
13348
13351
|
if (enableSortImports) configs.push(perfectionist());
|
|
13349
13352
|
/**
|
|
13350
13353
|
* =========================================================================
|
|
@@ -13365,13 +13368,14 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
13365
13368
|
*/
|
|
13366
13369
|
if (typescriptOptions) {
|
|
13367
13370
|
const tsconfigProvided = typeof typescriptOptions === "object" && !!typescriptOptions.tsconfig;
|
|
13368
|
-
const
|
|
13371
|
+
const nestedTypeAware = typeof typescriptOptions === "object" ? typescriptOptions.typeAware : void 0;
|
|
13372
|
+
const effectiveTypeAware = options.typeAware === void 0 ? nestedTypeAware ?? tsconfigProvided : normalizedOptions.typeAware;
|
|
13369
13373
|
const tscfg = typescript({
|
|
13370
13374
|
...typeof typescriptOptions !== "boolean" && typescriptOptions,
|
|
13371
13375
|
componentExts,
|
|
13372
13376
|
prefix: {
|
|
13373
13377
|
from: "@typescript-eslint",
|
|
13374
|
-
to: tsPrefix
|
|
13378
|
+
to: tsPrefix
|
|
13375
13379
|
},
|
|
13376
13380
|
typeAware: effectiveTypeAware
|
|
13377
13381
|
});
|
|
@@ -13390,7 +13394,7 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
13390
13394
|
}
|
|
13391
13395
|
if (enableReact) configs.push(react({
|
|
13392
13396
|
...typeof enableReact === "object" && enableReact,
|
|
13393
|
-
refresh: typeof enableReact === "object" && getReactRefreshOption(enableReact) !== void 0 ? getReactRefreshOption(enableReact) : normalizedOptions.reactRefresh
|
|
13397
|
+
refresh: typeof enableReact === "object" && getReactRefreshOption(enableReact) !== void 0 ? getReactRefreshOption(enableReact) : normalizedOptions.reactRefresh
|
|
13394
13398
|
}));
|
|
13395
13399
|
if (enablePrettier) configs.push(prettier());
|
|
13396
13400
|
if (stylisticOptions) configs.push(stylistic(stylisticOptions === true ? {} : stylisticOptions));
|