@bfra.me/eslint-config 0.33.0 → 0.34.0

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 CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as eslint_flat_config_utils from 'eslint-flat-config-utils';
2
2
  import { ResolvableFlatConfig, FlatConfigComposer } from 'eslint-flat-config-utils';
3
3
  export { FlatConfigComposer, ResolvableFlatConfig } from 'eslint-flat-config-utils';
4
+ import { RulesConfig } from '@eslint/core';
4
5
  import { Linter } from 'eslint';
5
6
  import { StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
6
7
  import { ParserOptions } from '@typescript-eslint/types';
@@ -16002,7 +16003,7 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
16002
16003
  *
16003
16004
  * @see https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects
16004
16005
  */
16005
- type Config<R extends Linter.RulesRecord | Rules = Linter.RulesRecord & Rules> = Linter.Config<R>
16006
+ type Config<R extends RulesConfig = Rules> = Linter.Config<R>
16006
16007
 
16007
16008
  /**
16008
16009
  * Defines the names of the available ESLint configurations.
package/lib/index.js CHANGED
@@ -107,7 +107,7 @@ var GLOB_EXCLUDE = [
107
107
  import { fileURLToPath } from "url";
108
108
 
109
109
  // package.json
110
- var version = "0.33.0";
110
+ var version = "0.34.0";
111
111
 
112
112
  // src/parsers/any-parser.ts
113
113
  var lineBreakPattern = /\r\n|[\n\r\u2028\u2029]/u;
@@ -166,7 +166,7 @@ async function interopDefault(m) {
166
166
 
167
167
  // src/configs/fallback.ts
168
168
  async function fallback(missingList = [], options) {
169
- const rules = await interopDefault(import("./missing-module-for-config-YSY2AGPQ.js"));
169
+ const rules = await interopDefault(import("./missing-module-for-config-YQFEGW2J.js"));
170
170
  const pluginName = `@bfra.me${missingList.length > 0 ? `/missing-modules-${missingList.map((m) => m.replaceAll(/[^a-z0-9]/gi, "-").toLowerCase()).join("-")}` : ""}`;
171
171
  return [
172
172
  {
@@ -910,6 +910,10 @@ async function nextjs(options = {}) {
910
910
  ["@next/eslint-plugin-next"],
911
911
  async () => {
912
912
  const pluginNextJs = await interopDefault(import("@next/eslint-plugin-next"));
913
+ function getRules(name) {
914
+ const rules = pluginNextJs.configs?.[name]?.rules;
915
+ return normalizeRules(rules);
916
+ }
913
917
  return [
914
918
  {
915
919
  name: "@bfra.me/nextjs/setup",
@@ -925,8 +929,8 @@ async function nextjs(options = {}) {
925
929
  sourceType: "module"
926
930
  },
927
931
  rules: {
928
- ...normalizeRules(pluginNextJs.configs.recommended.rules),
929
- ...normalizeRules(pluginNextJs.configs["core-web-vitals"].rules),
932
+ ...getRules("recommended"),
933
+ ...getRules("core-web-vitals"),
930
934
  ...overrides
931
935
  },
932
936
  settings: {
@@ -144,4 +144,4 @@ export {
144
144
  create,
145
145
  meta
146
146
  };
147
- //# sourceMappingURL=missing-module-for-config-YSY2AGPQ.js.map
147
+ //# sourceMappingURL=missing-module-for-config-YQFEGW2J.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bfra.me/eslint-config",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "description": "Shared ESLint configuration for bfra.me",
5
5
  "keywords": [
6
6
  "bfra.me",
@@ -66,11 +66,11 @@
66
66
  "devDependencies": {
67
67
  "@eslint-react/eslint-plugin": "2.0.1",
68
68
  "@eslint/config-inspector": "1.3.0",
69
- "@eslint/js": "9.38.0",
69
+ "@eslint/core": "0.17.0",
70
70
  "@next/eslint-plugin-next": "15.5.6",
71
71
  "@types/eslint-config-prettier": "6.11.3",
72
72
  "@typescript-eslint/types": "8.46.2",
73
- "@vitest/eslint-plugin": "1.3.23",
73
+ "@vitest/eslint-plugin": "1.3.25",
74
74
  "astro-eslint-parser": "1.2.2",
75
75
  "eslint": "9.38.0",
76
76
  "eslint-config-prettier": "10.1.8",
@@ -83,9 +83,9 @@
83
83
  "eslint-typegen": "2.3.0",
84
84
  "tsup": "8.5.0",
85
85
  "tsx": "4.20.6",
86
- "@bfra.me/eslint-config": "0.33.0",
87
- "@bfra.me/tsconfig": "0.12.0",
88
- "@bfra.me/prettier-config": "0.16.1"
86
+ "@bfra.me/eslint-config": "0.34.0",
87
+ "@bfra.me/prettier-config": "0.16.1",
88
+ "@bfra.me/tsconfig": "0.12.0"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "@eslint-react/eslint-plugin": "^2.0.1",
package/src/config.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // This file is generated by scripts/generate-types.ts
2
2
  // Do not edit this file directly.
3
3
 
4
+ import type {RulesConfig} from '@eslint/core'
4
5
  import type {Linter} from 'eslint'
5
6
  import type {FlatConfigComposer, ResolvableFlatConfig} from 'eslint-flat-config-utils'
6
7
  import type {Rules} from './rules'
@@ -13,7 +14,7 @@ export type {FlatConfigComposer, ResolvableFlatConfig}
13
14
  *
14
15
  * @see https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects
15
16
  */
16
- export type Config<R extends Linter.RulesRecord | Rules = Linter.RulesRecord & Rules> = Linter.Config<R>
17
+ export type Config<R extends RulesConfig = Rules> = Linter.Config<R>
17
18
 
18
19
  /**
19
20
  * Defines the names of the available ESLint configurations.
@@ -1,3 +1,4 @@
1
+ import type {Plugin} from '@eslint/core'
1
2
  import type {Config} from '../config'
2
3
  import type {Flatten, OptionsFiles, OptionsOverrides} from '../options'
3
4
  import {GLOB_SRC} from '../globs'
@@ -37,10 +38,16 @@ export async function nextjs(options: NextjsOptions = {}): Promise<Config[]> {
37
38
  ['@next/eslint-plugin-next'],
38
39
  async (): Promise<Config[]> => {
39
40
  const pluginNextJs = await interopDefault(import('@next/eslint-plugin-next'))
41
+
42
+ function getRules(name: keyof typeof pluginNextJs.configs) {
43
+ const rules = pluginNextJs.configs?.[name]?.rules
44
+ return normalizeRules(rules)
45
+ }
46
+
40
47
  return [
41
48
  {
42
49
  name: '@bfra.me/nextjs/setup',
43
- plugins: {'@next/next': pluginNextJs},
50
+ plugins: {'@next/next': pluginNextJs as Record<string, Plugin>},
44
51
  },
45
52
  {
46
53
  name: '@bfra.me/nextjs/rules',
@@ -52,8 +59,8 @@ export async function nextjs(options: NextjsOptions = {}): Promise<Config[]> {
52
59
  sourceType: 'module',
53
60
  },
54
61
  rules: {
55
- ...normalizeRules(pluginNextJs.configs.recommended.rules),
56
- ...normalizeRules(pluginNextJs.configs['core-web-vitals'].rules),
62
+ ...getRules('recommended'),
63
+ ...getRules('core-web-vitals'),
57
64
 
58
65
  ...overrides,
59
66
  },
package/src/plugins.d.ts CHANGED
@@ -1,27 +1,10 @@
1
1
  declare module '@eslint-community/eslint-plugin-eslint-comments' {
2
- import type {ESLint, Linter} from 'eslint'
2
+ import type {ConfigObject, Plugin, RulesConfig} from '@eslint/core'
3
3
 
4
- const plugin: ESLint.Plugin & {
4
+ const plugin: Plugin & {
5
5
  configs: {
6
- recommended: ESLint.ConfigData & {
7
- rules: Linter.RulesRecord
8
- }
9
- }
10
- }
11
-
12
- export default plugin
13
- }
14
-
15
- declare module '@next/eslint-plugin-next' {
16
- import type {ESLint, Linter} from 'eslint'
17
-
18
- const plugin: ESLint.Plugin & {
19
- configs: {
20
- recommended: ESLint.ConfigData & {
21
- rules: Linter.RulesRecord
22
- }
23
- 'core-web-vitals': ESLint.ConfigData & {
24
- rules: Linter.RulesRecord
6
+ recommended: ConfigObject & {
7
+ rules: RulesConfig
25
8
  }
26
9
  }
27
10
  }
@@ -30,17 +13,17 @@ declare module '@next/eslint-plugin-next' {
30
13
  }
31
14
 
32
15
  declare module 'eslint-plugin-import-x' {
33
- import type {ESLint} from 'eslint'
16
+ import type {Plugin} from '@eslint/core'
34
17
 
35
- const plugin: ESLint.Plugin
18
+ const plugin: Plugin
36
19
 
37
20
  export default plugin
38
21
  }
39
22
 
40
23
  declare module 'eslint-plugin-perfectionist' {
41
- import type {ESLint} from 'eslint'
24
+ import type {Plugin} from '@eslint/core'
42
25
 
43
- const plugin: ESLint.Plugin
26
+ const plugin: Plugin
44
27
 
45
28
  export default plugin
46
29
  }
@@ -1,4 +1,5 @@
1
- import {Linter, type Rule} from 'eslint'
1
+ import type {RuleContext, RulesMeta} from '@eslint/core'
2
+ import {Linter} from 'eslint'
2
3
  import {getPackageInstallCommand, tryInstall} from '../package-utils'
3
4
 
4
5
  // Whether to install the missing module(s) for the config
@@ -19,7 +20,7 @@ let shouldFix = false
19
20
  })
20
21
  })()
21
22
 
22
- export const meta: Rule.RuleMetaData = {
23
+ export const meta: RulesMeta = {
23
24
  docs: {
24
25
  description: 'Missing module for config',
25
26
  url: 'https://github.com/bfra-me/works',
@@ -34,7 +35,7 @@ export const meta: Rule.RuleMetaData = {
34
35
  type: 'problem',
35
36
  }
36
37
 
37
- export function create(context: Rule.RuleContext) {
38
+ export function create(context: RuleContext) {
38
39
  const [modules] = context.options as [string[]]
39
40
  for (const module of modules) {
40
41
  let output = ''