@bfra.me/eslint-config 0.44.0 → 0.44.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/index.d.ts +7 -1
- package/lib/index.js +13 -15
- package/package.json +1 -1
- package/src/configs/stylistic.ts +2 -2
- package/src/define-config.ts +3 -3
- package/src/require-of.ts +1 -7
- package/src/utils.ts +8 -0
package/lib/index.d.ts
CHANGED
|
@@ -16993,6 +16993,12 @@ declare function sortRenovateConfig(): Promise<Config[]>;
|
|
|
16993
16993
|
*/
|
|
16994
16994
|
declare function sortTsconfig(): Promise<Config[]>;
|
|
16995
16995
|
|
|
16996
|
+
declare const StylisticConfigDefaults: {
|
|
16997
|
+
readonly indent: 2;
|
|
16998
|
+
readonly jsx: true;
|
|
16999
|
+
readonly quotes: "single";
|
|
17000
|
+
readonly semi: false;
|
|
17001
|
+
};
|
|
16996
17002
|
/**
|
|
16997
17003
|
* Configuration options for stylistic ESLint rules.
|
|
16998
17004
|
*
|
|
@@ -17466,4 +17472,4 @@ declare const GLOB_EXCLUDE: string[];
|
|
|
17466
17472
|
|
|
17467
17473
|
declare const config: eslint_flat_config_utils.FlatConfigComposer<Config, ConfigNames>;
|
|
17468
17474
|
|
|
17469
|
-
export { type AstroOptions, type Config, type ConfigNames, type FallbackOptions, type Flatten, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CODE_IN_MARKDOWN_FILES, GLOB_EXCLUDE, GLOB_EXT_IN_MARKDOWN_FILES, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSON_FILES, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_FILES, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_PACKAGE_JSON_FILES, GLOB_RENOVATE_CONFIG, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TOML, GLOB_TOML_FILES, GLOB_TS, GLOB_TSX, GLOB_TS_CONFIG, GLOB_YAML, GLOB_YAML_FILES, type ImportsOptions, type JSDocOptions, type JavaScriptOptions, type JsoncOptions, type MarkdownCodeBlockOptions, type MarkdownFrontmatterOptions, type MarkdownLanguage, type MarkdownOptions, type NextjsOptions, type Options, type OptionsFiles, type OptionsIsInEditor, type OptionsOverrides, type OptionsPerfectionist, type OptionsStylistic, type OptionsTypeScript, type OptionsTypeScriptErasableSyntaxOnly, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PackageJsonOptions, type PerfectionistOptions, type PrettierOptions, type ReactOptions, type RegexpOptions, type Rules, type StylisticConfig, type StylisticOptions, type TomlOptions, type TypeScriptOptions, type UnicornOptions, type VitestOptions, type YamlOptions, astro, command, composeConfig, config, config as default, defineConfig, epilogue, eslintComments, fallback, gitignore, ignores, imports, isInEditor, isInGitLifecycle, javascript, jsdoc, jsonc, markdown, nextjs, node, packageJson, perfectionist, pnpm, prettier, react, regexp, sortPackageJson, sortRenovateConfig, sortTsconfig, stylistic, toml, typescript, unicorn, vitest, yaml };
|
|
17475
|
+
export { type AstroOptions, type Config, type ConfigNames, type FallbackOptions, type Flatten, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CODE_IN_MARKDOWN_FILES, GLOB_EXCLUDE, GLOB_EXT_IN_MARKDOWN_FILES, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSON_FILES, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_FILES, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_PACKAGE_JSON_FILES, GLOB_RENOVATE_CONFIG, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TOML, GLOB_TOML_FILES, GLOB_TS, GLOB_TSX, GLOB_TS_CONFIG, GLOB_YAML, GLOB_YAML_FILES, type ImportsOptions, type JSDocOptions, type JavaScriptOptions, type JsoncOptions, type MarkdownCodeBlockOptions, type MarkdownFrontmatterOptions, type MarkdownLanguage, type MarkdownOptions, type NextjsOptions, type Options, type OptionsFiles, type OptionsIsInEditor, type OptionsOverrides, type OptionsPerfectionist, type OptionsStylistic, type OptionsTypeScript, type OptionsTypeScriptErasableSyntaxOnly, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PackageJsonOptions, type PerfectionistOptions, type PrettierOptions, type ReactOptions, type RegexpOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TomlOptions, type TypeScriptOptions, type UnicornOptions, type VitestOptions, type YamlOptions, astro, command, composeConfig, config, config as default, defineConfig, epilogue, eslintComments, fallback, gitignore, ignores, imports, isInEditor, isInGitLifecycle, javascript, jsdoc, jsonc, markdown, nextjs, node, packageJson, perfectionist, pnpm, prettier, react, regexp, sortPackageJson, sortRenovateConfig, sortTsconfig, stylistic, toml, typescript, unicorn, vitest, yaml };
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// src/define-config.ts
|
|
2
|
-
import { isPackageExists as isPackageExists4 } from "local-pkg";
|
|
3
|
-
|
|
4
1
|
// src/compose-config.ts
|
|
5
2
|
import { composer } from "eslint-flat-config-utils";
|
|
6
3
|
var composeConfig = (...configs) => composer(...configs);
|
|
@@ -112,7 +109,7 @@ var GLOB_EXCLUDE = [
|
|
|
112
109
|
import { fileURLToPath } from "url";
|
|
113
110
|
|
|
114
111
|
// package.json
|
|
115
|
-
var version = "0.44.
|
|
112
|
+
var version = "0.44.1";
|
|
116
113
|
|
|
117
114
|
// src/parsers/any-parser.ts
|
|
118
115
|
var lineBreakPattern = /\r\n|[\n\r\u2028\u2029]/u;
|
|
@@ -145,14 +142,21 @@ function parseForESLint(text) {
|
|
|
145
142
|
}
|
|
146
143
|
var anyParser = { meta, parseForESLint };
|
|
147
144
|
|
|
148
|
-
// src/
|
|
145
|
+
// src/utils.ts
|
|
149
146
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
150
147
|
import { isPackageExists } from "local-pkg";
|
|
151
148
|
var scopeUrl = fileURLToPath2(new URL(".", import.meta.url));
|
|
152
|
-
|
|
149
|
+
// @__NO_SIDE_EFFECTS__
|
|
150
|
+
async function interopDefault(m) {
|
|
151
|
+
const resolved = await m;
|
|
152
|
+
return typeof resolved === "object" && resolved !== null && "default" in resolved ? /* @__PURE__ */ interopDefault(resolved.default) : resolved;
|
|
153
|
+
}
|
|
153
154
|
function isPackageInScope(name) {
|
|
154
155
|
return isPackageExists(name, { paths: [scopeUrl] });
|
|
155
156
|
}
|
|
157
|
+
|
|
158
|
+
// src/require-of.ts
|
|
159
|
+
var packageExistsCache = /* @__PURE__ */ new Map();
|
|
156
160
|
var has = (name) => {
|
|
157
161
|
if (!packageExistsCache.has(name)) {
|
|
158
162
|
packageExistsCache.set(name, isPackageInScope(name));
|
|
@@ -167,13 +171,6 @@ async function requireOf(names, getConfig, fallback2) {
|
|
|
167
171
|
return getConfig();
|
|
168
172
|
}
|
|
169
173
|
|
|
170
|
-
// src/utils.ts
|
|
171
|
-
// @__NO_SIDE_EFFECTS__
|
|
172
|
-
async function interopDefault(m) {
|
|
173
|
-
const resolved = await m;
|
|
174
|
-
return typeof resolved === "object" && resolved !== null && "default" in resolved ? /* @__PURE__ */ interopDefault(resolved.default) : resolved;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
174
|
// src/configs/fallback.ts
|
|
178
175
|
async function fallback(missingList = [], options) {
|
|
179
176
|
const rules = await interopDefault(import("./missing-module-for-config-TSYIJQQT.js"));
|
|
@@ -2168,10 +2165,10 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
2168
2165
|
packageJson: enablePackageJson = false,
|
|
2169
2166
|
perfectionist: enablePerfectionist = true,
|
|
2170
2167
|
pnpm: enableCatalogs = false,
|
|
2171
|
-
prettier: enablePrettier =
|
|
2168
|
+
prettier: enablePrettier = isPackageInScope("prettier"),
|
|
2172
2169
|
react: enableReact = false,
|
|
2173
2170
|
regexp: enableRegexp = true,
|
|
2174
|
-
typescript: enableTypeScript =
|
|
2171
|
+
typescript: enableTypeScript = isPackageInScope("typescript"),
|
|
2175
2172
|
unicorn: enableUnicorn = true
|
|
2176
2173
|
} = options;
|
|
2177
2174
|
const isInEditor2 = options.isInEditor ?? isInEditor;
|
|
@@ -2369,6 +2366,7 @@ export {
|
|
|
2369
2366
|
GLOB_TS_CONFIG,
|
|
2370
2367
|
GLOB_YAML,
|
|
2371
2368
|
GLOB_YAML_FILES,
|
|
2369
|
+
StylisticConfigDefaults,
|
|
2372
2370
|
astro,
|
|
2373
2371
|
command,
|
|
2374
2372
|
composeConfig,
|
package/package.json
CHANGED
package/src/configs/stylistic.ts
CHANGED
|
@@ -2,12 +2,12 @@ import type {Config} from '../config'
|
|
|
2
2
|
import type {Flatten, OptionsOverrides, StylisticConfig} from '../options'
|
|
3
3
|
import {interopDefault} from '../utils'
|
|
4
4
|
|
|
5
|
-
const StylisticConfigDefaults
|
|
5
|
+
export const StylisticConfigDefaults = {
|
|
6
6
|
indent: 2,
|
|
7
7
|
jsx: true,
|
|
8
8
|
quotes: 'single',
|
|
9
9
|
semi: false,
|
|
10
|
-
}
|
|
10
|
+
} as const
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Configuration options for stylistic ESLint rules.
|
package/src/define-config.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type {Config, ConfigNames, FlatConfigComposer, ResolvableFlatConfig} from './config'
|
|
2
2
|
import type {Options} from './options'
|
|
3
|
-
import {isPackageExists} from 'local-pkg'
|
|
4
3
|
import {composeConfig} from './compose-config'
|
|
5
4
|
import {
|
|
6
5
|
astro,
|
|
@@ -33,6 +32,7 @@ import {
|
|
|
33
32
|
yaml,
|
|
34
33
|
} from './configs'
|
|
35
34
|
import * as Env from './env'
|
|
35
|
+
import {isPackageInScope} from './utils'
|
|
36
36
|
|
|
37
37
|
// These are merged into the Options interface
|
|
38
38
|
type AllowedConfigForOptions = Omit<Config, 'files'>
|
|
@@ -71,10 +71,10 @@ export async function defineConfig<C extends Config = Config, CN extends ConfigN
|
|
|
71
71
|
packageJson: enablePackageJson = false,
|
|
72
72
|
perfectionist: enablePerfectionist = true,
|
|
73
73
|
pnpm: enableCatalogs = false,
|
|
74
|
-
prettier: enablePrettier =
|
|
74
|
+
prettier: enablePrettier = isPackageInScope('prettier'),
|
|
75
75
|
react: enableReact = false,
|
|
76
76
|
regexp: enableRegexp = true,
|
|
77
|
-
typescript: enableTypeScript =
|
|
77
|
+
typescript: enableTypeScript = isPackageInScope('typescript'),
|
|
78
78
|
unicorn: enableUnicorn = true,
|
|
79
79
|
} = options
|
|
80
80
|
|
package/src/require-of.ts
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type {Config} from './config'
|
|
2
|
-
import {
|
|
3
|
-
import {isPackageExists} from 'local-pkg'
|
|
2
|
+
import {isPackageInScope} from './utils'
|
|
4
3
|
|
|
5
|
-
const scopeUrl = fileURLToPath(new URL('.', import.meta.url))
|
|
6
4
|
const packageExistsCache = new Map<string, boolean>()
|
|
7
5
|
|
|
8
|
-
function isPackageInScope(name: string): boolean {
|
|
9
|
-
return isPackageExists(name, {paths: [scopeUrl]})
|
|
10
|
-
}
|
|
11
|
-
|
|
12
6
|
const has = (name: string) => {
|
|
13
7
|
if (!packageExistsCache.has(name)) {
|
|
14
8
|
packageExistsCache.set(name, isPackageInScope(name))
|
package/src/utils.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type {Awaitable} from 'eslint-flat-config-utils'
|
|
2
|
+
import {fileURLToPath} from 'node:url'
|
|
3
|
+
import {isPackageExists} from 'local-pkg'
|
|
4
|
+
|
|
5
|
+
const scopeUrl = fileURLToPath(new URL('.', import.meta.url))
|
|
2
6
|
|
|
3
7
|
/* #__NO_SIDE_EFFECTS__ */
|
|
4
8
|
export async function interopDefault<T>(
|
|
@@ -9,3 +13,7 @@ export async function interopDefault<T>(
|
|
|
9
13
|
? interopDefault(resolved.default as Awaitable<T>)
|
|
10
14
|
: (resolved as T extends {default: infer U} ? U : T)
|
|
11
15
|
}
|
|
16
|
+
|
|
17
|
+
export function isPackageInScope(name: string): boolean {
|
|
18
|
+
return isPackageExists(name, {paths: [scopeUrl]})
|
|
19
|
+
}
|