@vinicunca/eslint-config 2.7.0 → 2.7.2
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.cjs +21 -19
- package/dist/index.d.cts +600 -1111
- package/dist/index.d.ts +600 -1111
- package/dist/index.js +20 -18
- package/package.json +16 -16
package/dist/index.cjs
CHANGED
|
@@ -61,6 +61,7 @@ __export(src_exports, {
|
|
|
61
61
|
ignores: () => ignores,
|
|
62
62
|
imports: () => imports,
|
|
63
63
|
interopDefault: () => interopDefault,
|
|
64
|
+
isInEditorEnv: () => isInEditorEnv,
|
|
64
65
|
javascript: () => javascript,
|
|
65
66
|
jsdoc: () => jsdoc,
|
|
66
67
|
jsonc: () => jsonc,
|
|
@@ -86,7 +87,6 @@ __export(src_exports, {
|
|
|
86
87
|
sortTsconfig: () => sortTsconfig,
|
|
87
88
|
stylistic: () => stylistic,
|
|
88
89
|
test: () => test,
|
|
89
|
-
toArray: () => toArray,
|
|
90
90
|
typescript: () => typescript,
|
|
91
91
|
unicorn: () => unicorn,
|
|
92
92
|
unocss: () => unocss,
|
|
@@ -111,8 +111,6 @@ function e(o) {
|
|
|
111
111
|
// src/base.ts
|
|
112
112
|
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
113
113
|
var import_local_pkg = require("local-pkg");
|
|
114
|
-
var import_node_fs = __toESM(require("fs"), 1);
|
|
115
|
-
var import_node_process2 = __toESM(require("process"), 1);
|
|
116
114
|
|
|
117
115
|
// src/flags.ts
|
|
118
116
|
var ERROR = "error";
|
|
@@ -222,6 +220,7 @@ var GLOB_EXCLUDE = [
|
|
|
222
220
|
];
|
|
223
221
|
|
|
224
222
|
// src/utils.ts
|
|
223
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
225
224
|
async function combineConfigs(...configs2) {
|
|
226
225
|
const resolved = await Promise.all(configs2);
|
|
227
226
|
return resolved.flat();
|
|
@@ -281,8 +280,8 @@ var parserPlain = {
|
|
|
281
280
|
}
|
|
282
281
|
})
|
|
283
282
|
};
|
|
284
|
-
function
|
|
285
|
-
return
|
|
283
|
+
function isInEditorEnv() {
|
|
284
|
+
return !!((import_node_process.default.env.VSCODE_PID || import_node_process.default.env.VSCODE_CWD || import_node_process.default.env.JETBRAINS_IDE || import_node_process.default.env.VIM || import_node_process.default.env.NVIM) && !import_node_process.default.env.CI);
|
|
286
285
|
}
|
|
287
286
|
|
|
288
287
|
// src/configs/stylistic.ts
|
|
@@ -1133,18 +1132,21 @@ async function react(options = {}) {
|
|
|
1133
1132
|
} = options;
|
|
1134
1133
|
const [
|
|
1135
1134
|
pluginReact,
|
|
1136
|
-
pluginReactHooks
|
|
1135
|
+
pluginReactHooks,
|
|
1136
|
+
parserTs
|
|
1137
1137
|
] = await Promise.all([
|
|
1138
|
+
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1138
1139
|
// @ts-expect-error missing types
|
|
1139
|
-
interopDefault(import("eslint-plugin-react")),
|
|
1140
|
-
|
|
1141
|
-
interopDefault(import("eslint-plugin-react-hooks"))
|
|
1140
|
+
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1141
|
+
interopDefault(import("@typescript-eslint/parser"))
|
|
1142
1142
|
]);
|
|
1143
|
+
const plugins = pluginReact.configs.all.plugins;
|
|
1143
1144
|
return [
|
|
1144
1145
|
{
|
|
1145
1146
|
name: "vinicunca/react/setup",
|
|
1146
1147
|
plugins: {
|
|
1147
|
-
"react":
|
|
1148
|
+
"react": plugins["@eslint-react"],
|
|
1149
|
+
"react-dom": plugins["@eslint-react/dom"],
|
|
1148
1150
|
"react-hooks": pluginReactHooks
|
|
1149
1151
|
},
|
|
1150
1152
|
settings: {
|
|
@@ -1156,11 +1158,13 @@ async function react(options = {}) {
|
|
|
1156
1158
|
{
|
|
1157
1159
|
files,
|
|
1158
1160
|
languageOptions: {
|
|
1161
|
+
parser: parserTs,
|
|
1159
1162
|
parserOptions: {
|
|
1160
1163
|
ecmaFeatures: {
|
|
1161
1164
|
jsx: true
|
|
1162
1165
|
}
|
|
1163
|
-
}
|
|
1166
|
+
},
|
|
1167
|
+
sourceType: "module"
|
|
1164
1168
|
},
|
|
1165
1169
|
name: "vinicunca/react/rules",
|
|
1166
1170
|
rules: {
|
|
@@ -1518,7 +1522,7 @@ async function test(options = {}) {
|
|
|
1518
1522
|
}
|
|
1519
1523
|
|
|
1520
1524
|
// src/configs/typescript.ts
|
|
1521
|
-
var
|
|
1525
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
1522
1526
|
async function typescript(options = {}) {
|
|
1523
1527
|
const {
|
|
1524
1528
|
componentExts = [],
|
|
@@ -1533,7 +1537,7 @@ async function typescript(options = {}) {
|
|
|
1533
1537
|
const ignoresTypeAware = options.ignoresTypeAware ?? [
|
|
1534
1538
|
`${GLOB_MARKDOWN}/**`
|
|
1535
1539
|
];
|
|
1536
|
-
const tsconfigPath = options?.tsconfigPath ?
|
|
1540
|
+
const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
|
|
1537
1541
|
const isTypeAware = !!tsconfigPath;
|
|
1538
1542
|
const typeAwareRules = {
|
|
1539
1543
|
"dot-notation": OFF,
|
|
@@ -1580,7 +1584,7 @@ async function typescript(options = {}) {
|
|
|
1580
1584
|
allowDefaultProject: ["./*.js"],
|
|
1581
1585
|
defaultProject: tsconfigPath
|
|
1582
1586
|
},
|
|
1583
|
-
tsconfigRootDir:
|
|
1587
|
+
tsconfigRootDir: import_node_process2.default.cwd()
|
|
1584
1588
|
} : {},
|
|
1585
1589
|
...parserOptions
|
|
1586
1590
|
}
|
|
@@ -2000,7 +2004,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2000
2004
|
autoRenamePlugins = true,
|
|
2001
2005
|
componentExts = [],
|
|
2002
2006
|
gitignore: enableGitignore = true,
|
|
2003
|
-
isInEditor =
|
|
2007
|
+
isInEditor = isInEditorEnv(),
|
|
2004
2008
|
jsx: enableJsx = true,
|
|
2005
2009
|
react: enableReact = false,
|
|
2006
2010
|
regexp: enableRegexp = true,
|
|
@@ -2025,9 +2029,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2025
2029
|
if (typeof enableGitignore !== "boolean") {
|
|
2026
2030
|
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r2) => [r2(enableGitignore)]));
|
|
2027
2031
|
} else {
|
|
2028
|
-
|
|
2029
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r2) => [r2()]));
|
|
2030
|
-
}
|
|
2032
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r2) => [r2()]));
|
|
2031
2033
|
}
|
|
2032
2034
|
}
|
|
2033
2035
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
@@ -2191,6 +2193,7 @@ function resolveSubOptions(options, key) {
|
|
|
2191
2193
|
ignores,
|
|
2192
2194
|
imports,
|
|
2193
2195
|
interopDefault,
|
|
2196
|
+
isInEditorEnv,
|
|
2194
2197
|
javascript,
|
|
2195
2198
|
jsdoc,
|
|
2196
2199
|
jsonc,
|
|
@@ -2216,7 +2219,6 @@ function resolveSubOptions(options, key) {
|
|
|
2216
2219
|
sortTsconfig,
|
|
2217
2220
|
stylistic,
|
|
2218
2221
|
test,
|
|
2219
|
-
toArray,
|
|
2220
2222
|
typescript,
|
|
2221
2223
|
unicorn,
|
|
2222
2224
|
unocss,
|