@bfra.me/eslint-config 0.46.0 → 0.47.1
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/lib/chunk-EGRHWZRV.js +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +53 -24
- package/lib/{missing-module-for-config-TSYIJQQT.js → missing-module-for-config-XLDTAVYJ.js} +3 -1
- package/package.json +9 -8
- package/src/configs/react.ts +3 -4
- package/src/define-config.ts +1 -1
- package/src/options.ts +4 -2
- package/src/rules.d.ts +2 -0
- package/src/utils.ts +6 -59
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-EGRHWZRV.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -16120,6 +16120,8 @@ type ReactNoUnstableDefaultProps = []|[{
|
|
|
16120
16120
|
// ----- react/no-useless-fragment -----
|
|
16121
16121
|
type ReactNoUselessFragment = []|[{
|
|
16122
16122
|
|
|
16123
|
+
allowEmptyFragment?: boolean
|
|
16124
|
+
|
|
16123
16125
|
allowExpressions?: boolean
|
|
16124
16126
|
}]
|
|
16125
16127
|
// ----- regexp/hexadecimal-escape -----
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
|
+
import "./chunk-EGRHWZRV.js";
|
|
2
|
+
|
|
1
3
|
// src/define-config.ts
|
|
2
4
|
import { isPackageExists as isPackageExists4 } from "local-pkg";
|
|
3
5
|
|
|
6
|
+
// ../es/src/env/ci.ts
|
|
7
|
+
import isCI from "is-in-ci";
|
|
8
|
+
function isInCI() {
|
|
9
|
+
return isCI;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// ../es/src/env/git.ts
|
|
13
|
+
import process2 from "process";
|
|
14
|
+
|
|
15
|
+
// ../es/src/env/helpers.ts
|
|
16
|
+
import process from "process";
|
|
17
|
+
function hasNonEmptyEnv(key) {
|
|
18
|
+
const value = process.env[key];
|
|
19
|
+
return typeof value === "string" && value.length > 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ../es/src/env/git.ts
|
|
23
|
+
function isInGitLifecycle() {
|
|
24
|
+
const lifecycleScript = process2.env.npm_lifecycle_script;
|
|
25
|
+
const isLintStaged = typeof lifecycleScript === "string" && (lifecycleScript.startsWith("lint-staged") || lifecycleScript.startsWith("nano-staged"));
|
|
26
|
+
return hasNonEmptyEnv("GIT_PARAMS") || hasNonEmptyEnv("VSCODE_GIT_COMMAND") || isLintStaged;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ../es/src/env/editor.ts
|
|
30
|
+
function isInEditorEnv() {
|
|
31
|
+
if (isInCI()) return false;
|
|
32
|
+
if (isInGitLifecycle()) return false;
|
|
33
|
+
return hasNonEmptyEnv("VSCODE_PID") || hasNonEmptyEnv("VSCODE_CWD") || hasNonEmptyEnv("JETBRAINS_IDE") || hasNonEmptyEnv("VIM") || hasNonEmptyEnv("NVIM");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ../es/src/env/runtime.ts
|
|
37
|
+
import process3 from "process";
|
|
38
|
+
|
|
4
39
|
// src/compose-config.ts
|
|
5
40
|
import { composer } from "eslint-flat-config-utils";
|
|
6
41
|
var composeConfig = (...configs) => composer(...configs);
|
|
@@ -112,7 +147,7 @@ var GLOB_EXCLUDE = [
|
|
|
112
147
|
import { fileURLToPath } from "url";
|
|
113
148
|
|
|
114
149
|
// package.json
|
|
115
|
-
var version = "0.
|
|
150
|
+
var version = "0.47.1";
|
|
116
151
|
|
|
117
152
|
// src/parsers/any-parser.ts
|
|
118
153
|
var lineBreakPattern = /\r\n|[\n\r\u2028\u2029]/u;
|
|
@@ -146,33 +181,27 @@ function parseForESLint(text) {
|
|
|
146
181
|
var anyParser = { meta, parseForESLint };
|
|
147
182
|
|
|
148
183
|
// src/utils.ts
|
|
149
|
-
import
|
|
150
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
151
|
-
import isInCI from "is-in-ci";
|
|
184
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
152
185
|
import { isPackageExists } from "local-pkg";
|
|
153
|
-
|
|
154
|
-
//
|
|
186
|
+
|
|
187
|
+
// ../es/src/module/interop.ts
|
|
188
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
155
189
|
async function interopDefault(m) {
|
|
156
190
|
const resolved = await m;
|
|
157
|
-
return typeof resolved === "object" && resolved !== null && "default" in resolved ?
|
|
191
|
+
return typeof resolved === "object" && resolved !== null && "default" in resolved ? interopDefault(resolved.default) : resolved;
|
|
158
192
|
}
|
|
159
|
-
|
|
193
|
+
|
|
194
|
+
// src/utils.ts
|
|
195
|
+
var scopeUrl = fileURLToPath3(new URL(".", import.meta.url));
|
|
196
|
+
function isPackageInScope2(name) {
|
|
160
197
|
return isPackageExists(name, { paths: [scopeUrl] });
|
|
161
198
|
}
|
|
162
|
-
function isInGitLifecycle() {
|
|
163
|
-
return !!(typeof process.env.GIT_PARAMS === "string" && process.env.GIT_PARAMS.length > 0 || typeof process.env.VSCODE_GIT_COMMAND === "string" && process.env.VSCODE_GIT_COMMAND.length > 0 || process.env.npm_lifecycle_script?.startsWith("lint-staged") || process.env.npm_lifecycle_script?.startsWith("nano-staged"));
|
|
164
|
-
}
|
|
165
|
-
function isInEditorEnv() {
|
|
166
|
-
if (isInCI) return false;
|
|
167
|
-
if (isInGitLifecycle()) return false;
|
|
168
|
-
return !!(typeof process.env.VSCODE_PID === "string" && process.env.VSCODE_PID.length > 0 || typeof process.env.VSCODE_CWD === "string" && process.env.VSCODE_CWD.length > 0 || typeof process.env.JETBRAINS_IDE === "string" && process.env.JETBRAINS_IDE.length > 0 || typeof process.env.VIM === "string" && process.env.VIM.length > 0 || typeof process.env.NVIM === "string" && process.env.NVIM.length > 0);
|
|
169
|
-
}
|
|
170
199
|
|
|
171
200
|
// src/require-of.ts
|
|
172
201
|
var packageExistsCache = /* @__PURE__ */ new Map();
|
|
173
202
|
var has = (name) => {
|
|
174
203
|
if (!packageExistsCache.has(name)) {
|
|
175
|
-
packageExistsCache.set(name,
|
|
204
|
+
packageExistsCache.set(name, isPackageInScope2(name));
|
|
176
205
|
}
|
|
177
206
|
return packageExistsCache.get(name);
|
|
178
207
|
};
|
|
@@ -186,7 +215,7 @@ async function requireOf(names, getConfig, fallback2) {
|
|
|
186
215
|
|
|
187
216
|
// src/configs/fallback.ts
|
|
188
217
|
async function fallback(missingList = [], options) {
|
|
189
|
-
const rules = await interopDefault(import("./missing-module-for-config-
|
|
218
|
+
const rules = await interopDefault(import("./missing-module-for-config-XLDTAVYJ.js"));
|
|
190
219
|
const pluginName = `@bfra.me${missingList.length > 0 ? `/missing-modules-${missingList.map((m) => m.replaceAll(/[^a-z0-9]/gi, "-").toLowerCase()).join("-")}` : ""}`;
|
|
191
220
|
return [
|
|
192
221
|
{
|
|
@@ -797,10 +826,10 @@ async function jsx(options = {}) {
|
|
|
797
826
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
798
827
|
|
|
799
828
|
// src/parsers/plain-parser.ts
|
|
800
|
-
import { fileURLToPath as
|
|
829
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
801
830
|
var plainParser = {
|
|
802
831
|
meta: {
|
|
803
|
-
name:
|
|
832
|
+
name: fileURLToPath4(import.meta.url),
|
|
804
833
|
version
|
|
805
834
|
},
|
|
806
835
|
parseForESLint: (code) => ({
|
|
@@ -1233,14 +1262,14 @@ async function pnpm() {
|
|
|
1233
1262
|
}
|
|
1234
1263
|
|
|
1235
1264
|
// src/configs/prettier.ts
|
|
1236
|
-
import
|
|
1265
|
+
import process4 from "process";
|
|
1237
1266
|
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
1238
1267
|
async function prettier(options = {}) {
|
|
1239
1268
|
const { isInEditor, overrides } = options;
|
|
1240
1269
|
return requireOf(
|
|
1241
1270
|
["eslint-config-prettier", "eslint-plugin-prettier", "prettier"],
|
|
1242
1271
|
async () => {
|
|
1243
|
-
|
|
1272
|
+
process4.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED ??= "true";
|
|
1244
1273
|
const [configPrettier, pluginPrettier, pluginJsonc, pluginYaml] = await Promise.all([
|
|
1245
1274
|
interopDefault(import("eslint-config-prettier")),
|
|
1246
1275
|
interopDefault(import("eslint-plugin-prettier")),
|
|
@@ -1816,7 +1845,7 @@ async function toml(options = {}) {
|
|
|
1816
1845
|
}
|
|
1817
1846
|
|
|
1818
1847
|
// src/configs/typescript.ts
|
|
1819
|
-
import
|
|
1848
|
+
import process5 from "process";
|
|
1820
1849
|
var TypeAwareRules = {
|
|
1821
1850
|
"@typescript-eslint/await-thenable": "error",
|
|
1822
1851
|
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
|
|
@@ -1907,7 +1936,7 @@ async function typescript(options = {}) {
|
|
|
1907
1936
|
allowDefaultProject: ["./*.js"],
|
|
1908
1937
|
defaultProject: tsconfigPath
|
|
1909
1938
|
},
|
|
1910
|
-
tsconfigRootDir:
|
|
1939
|
+
tsconfigRootDir: process5.cwd()
|
|
1911
1940
|
} : {},
|
|
1912
1941
|
...parserOptions
|
|
1913
1942
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "./chunk-EGRHWZRV.js";
|
|
2
|
+
|
|
1
3
|
// src/rules/missing-module-for-config.ts
|
|
2
4
|
import { Linter } from "eslint";
|
|
3
5
|
|
|
@@ -186,4 +188,4 @@ export {
|
|
|
186
188
|
create,
|
|
187
189
|
meta
|
|
188
190
|
};
|
|
189
|
-
//# sourceMappingURL=missing-module-for-config-
|
|
191
|
+
//# sourceMappingURL=missing-module-for-config-XLDTAVYJ.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bfra.me/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.1",
|
|
4
4
|
"description": "Shared ESLint configuration for bfra.me",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bfra.me",
|
|
@@ -58,19 +58,20 @@
|
|
|
58
58
|
"globals": "16.5.0",
|
|
59
59
|
"is-in-ci": "2.0.0",
|
|
60
60
|
"local-pkg": "1.1.2",
|
|
61
|
-
"package-manager-detector": "1.
|
|
61
|
+
"package-manager-detector": "1.6.0",
|
|
62
62
|
"sort-package-json": "3.5.0",
|
|
63
|
-
"typescript-eslint": "8.48.
|
|
63
|
+
"typescript-eslint": "8.48.1",
|
|
64
|
+
"@bfra.me/es": "0.1.0"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
|
-
"@eslint-react/eslint-plugin": "2.3.
|
|
67
|
+
"@eslint-react/eslint-plugin": "2.3.12",
|
|
67
68
|
"@eslint/config-inspector": "1.4.2",
|
|
68
69
|
"@eslint/core": "1.0.0",
|
|
69
|
-
"@next/eslint-plugin-next": "16.0.
|
|
70
|
+
"@next/eslint-plugin-next": "16.0.6",
|
|
70
71
|
"@types/eslint-config-prettier": "6.11.3",
|
|
71
72
|
"@types/eslint-plugin-jsx-a11y": "6.10.1",
|
|
72
|
-
"@typescript-eslint/types": "8.48.
|
|
73
|
-
"@vitest/eslint-plugin": "1.5.
|
|
73
|
+
"@typescript-eslint/types": "8.48.1",
|
|
74
|
+
"@vitest/eslint-plugin": "1.5.1",
|
|
74
75
|
"astro-eslint-parser": "1.2.2",
|
|
75
76
|
"eslint": "9.39.1",
|
|
76
77
|
"eslint-config-prettier": "10.1.8",
|
|
@@ -83,7 +84,7 @@
|
|
|
83
84
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
84
85
|
"eslint-plugin-react-refresh": "0.4.24",
|
|
85
86
|
"eslint-typegen": "2.3.0",
|
|
86
|
-
"@bfra.me/prettier-config": "0.16.
|
|
87
|
+
"@bfra.me/prettier-config": "0.16.6",
|
|
87
88
|
"@bfra.me/works": "0.0.0-development"
|
|
88
89
|
},
|
|
89
90
|
"peerDependencies": {
|
package/src/configs/react.ts
CHANGED
|
@@ -35,10 +35,9 @@ const ReactTypeAwareRules: Config['rules'] = {
|
|
|
35
35
|
* options including file patterns, rule overrides, TypeScript parser options, and
|
|
36
36
|
* TypeScript type checking options.
|
|
37
37
|
*/
|
|
38
|
-
export interface ReactOptions
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
> {}
|
|
38
|
+
export interface ReactOptions extends Flatten<
|
|
39
|
+
OptionsFiles & OptionsOverrides & OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes
|
|
40
|
+
> {}
|
|
42
41
|
|
|
43
42
|
/**
|
|
44
43
|
* Creates ESLint configuration for React applications with comprehensive rule sets.
|
package/src/define-config.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {Config, ConfigNames, FlatConfigComposer, ResolvableFlatConfig} from './config'
|
|
2
2
|
import type {Options} from './options'
|
|
3
3
|
import {isPackageExists} from 'local-pkg'
|
|
4
|
+
import {isInEditorEnv} from '../../es/src/env'
|
|
4
5
|
import {composeConfig} from './compose-config'
|
|
5
6
|
import {
|
|
6
7
|
astro,
|
|
@@ -33,7 +34,6 @@ import {
|
|
|
33
34
|
yaml,
|
|
34
35
|
} from './configs'
|
|
35
36
|
import {jsx} from './configs/jsx'
|
|
36
|
-
import {isInEditorEnv} from './utils'
|
|
37
37
|
|
|
38
38
|
// These are merged into the Options interface
|
|
39
39
|
type AllowedConfigForOptions = Omit<Config, 'files'>
|
package/src/options.ts
CHANGED
|
@@ -169,8 +169,10 @@ export interface OptionsStylistic {
|
|
|
169
169
|
stylistic?: boolean | StylisticConfig
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
export interface StylisticConfig
|
|
173
|
-
|
|
172
|
+
export interface StylisticConfig extends Pick<
|
|
173
|
+
StylisticCustomizeOptions,
|
|
174
|
+
'indent' | 'quotes' | 'jsx' | 'semi'
|
|
175
|
+
> {}
|
|
174
176
|
|
|
175
177
|
/**
|
|
176
178
|
* Configuration options for the ESLint setup.
|
package/src/rules.d.ts
CHANGED
|
@@ -16111,6 +16111,8 @@ type ReactNoUnstableDefaultProps = []|[{
|
|
|
16111
16111
|
// ----- react/no-useless-fragment -----
|
|
16112
16112
|
type ReactNoUselessFragment = []|[{
|
|
16113
16113
|
|
|
16114
|
+
allowEmptyFragment?: boolean
|
|
16115
|
+
|
|
16114
16116
|
allowExpressions?: boolean
|
|
16115
16117
|
}]
|
|
16116
16118
|
// ----- regexp/hexadecimal-escape -----
|
package/src/utils.ts
CHANGED
|
@@ -1,69 +1,16 @@
|
|
|
1
|
-
import type {Awaitable} from 'eslint-flat-config-utils'
|
|
2
|
-
import process from 'node:process'
|
|
3
1
|
import {fileURLToPath} from 'node:url'
|
|
4
|
-
import isInCI from 'is-in-ci'
|
|
5
2
|
import {isPackageExists} from 'local-pkg'
|
|
6
3
|
|
|
7
4
|
const scopeUrl = fileURLToPath(new URL('.', import.meta.url))
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
export async function interopDefault<T>(
|
|
11
|
-
m: Awaitable<T>,
|
|
12
|
-
): Promise<T extends {default: infer U} ? U : T> {
|
|
13
|
-
const resolved = await m
|
|
14
|
-
return typeof resolved === 'object' && resolved !== null && 'default' in resolved
|
|
15
|
-
? interopDefault(resolved.default as Awaitable<T>)
|
|
16
|
-
: (resolved as T extends {default: infer U} ? U : T)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function isPackageInScope(name: string): boolean {
|
|
20
|
-
return isPackageExists(name, {paths: [scopeUrl]})
|
|
21
|
-
}
|
|
6
|
+
export {interopDefault} from '../../es/src/module'
|
|
22
7
|
|
|
23
8
|
/**
|
|
24
|
-
* Check if
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* import {isInGitLifecycle} from '@bfra.me/eslint-config'
|
|
9
|
+
* Check if a package exists within the eslint-config package scope.
|
|
29
10
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
11
|
+
* @param name - The package name to check
|
|
12
|
+
* @returns True if the package exists within this package's scope
|
|
34
13
|
*/
|
|
35
|
-
export function
|
|
36
|
-
return
|
|
37
|
-
false ||
|
|
38
|
-
(typeof process.env.GIT_PARAMS === 'string' && process.env.GIT_PARAMS.length > 0) ||
|
|
39
|
-
(typeof process.env.VSCODE_GIT_COMMAND === 'string' &&
|
|
40
|
-
process.env.VSCODE_GIT_COMMAND.length > 0) ||
|
|
41
|
-
process.env.npm_lifecycle_script?.startsWith('lint-staged') ||
|
|
42
|
-
process.env.npm_lifecycle_script?.startsWith('nano-staged')
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Check if the process is running in an editor.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```ts
|
|
51
|
-
* import {isInEditor} from '@bfra.me/eslint-config'
|
|
52
|
-
*
|
|
53
|
-
* if (isInEditor) {
|
|
54
|
-
* console.log('Running in an editor')
|
|
55
|
-
* }
|
|
56
|
-
*/
|
|
57
|
-
export function isInEditorEnv(): boolean {
|
|
58
|
-
if (isInCI) return false
|
|
59
|
-
if (isInGitLifecycle()) return false
|
|
60
|
-
|
|
61
|
-
return !!(
|
|
62
|
-
false ||
|
|
63
|
-
(typeof process.env.VSCODE_PID === 'string' && process.env.VSCODE_PID.length > 0) ||
|
|
64
|
-
(typeof process.env.VSCODE_CWD === 'string' && process.env.VSCODE_CWD.length > 0) ||
|
|
65
|
-
(typeof process.env.JETBRAINS_IDE === 'string' && process.env.JETBRAINS_IDE.length > 0) ||
|
|
66
|
-
(typeof process.env.VIM === 'string' && process.env.VIM.length > 0) ||
|
|
67
|
-
(typeof process.env.NVIM === 'string' && process.env.NVIM.length > 0)
|
|
68
|
-
)
|
|
14
|
+
export function isPackageInScope(name: string): boolean {
|
|
15
|
+
return isPackageExists(name, {paths: [scopeUrl]})
|
|
69
16
|
}
|