@antfu/eslint-config 4.18.0 → 5.0.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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  - Designed to work with TypeScript, JSX, Vue, JSON, YAML, Toml, Markdown, etc. Out-of-box.
8
8
  - Opinionated, but [very customizable](#customization)
9
9
  - [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily!
10
- - Optional [React](#react), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro), [Solid](#solid) support
10
+ - Optional [React](#react), [Next.js](#nextjs), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro), [Solid](#solid) support
11
11
  - Optional [formatters](#formatters) support for formatting CSS, HTML, XML, etc.
12
12
  - **Style principle**: Minimal for reading, stable for diff, consistent
13
13
  - Sorted imports, dangling commas
@@ -382,15 +382,16 @@ Check out the [configs](https://github.com/antfu/eslint-config/blob/main/src/con
382
382
 
383
383
  Since flat config requires us to explicitly provide the plugin names (instead of the mandatory convention from npm package name), we renamed some plugins to make the overall scope more consistent and easier to write.
384
384
 
385
- | New Prefix | Original Prefix | Source Plugin |
386
- | ---------- | ---------------------- | ------------------------------------------------------------------------------------------ |
387
- | `import/*` | `import-lite/*` | [eslint-plugin-import-lite](https://github.com/9romise/eslint-plugin-import-lite) |
388
- | `node/*` | `n/*` | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) |
389
- | `yaml/*` | `yml/*` | [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) |
390
- | `ts/*` | `@typescript-eslint/*` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |
391
- | `style/*` | `@stylistic/*` | [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic) |
392
- | `test/*` | `vitest/*` | [@vitest/eslint-plugin](https://github.com/vitest-dev/eslint-plugin-vitest) |
393
- | `test/*` | `no-only-tests/*` | [eslint-plugin-no-only-tests](https://github.com/levibuzolic/eslint-plugin-no-only-tests) |
385
+ | New Prefix | Original Prefix | Source Plugin |
386
+ | ---------- | ---------------------- | ----------------------------------------------------------------------------------------------------- |
387
+ | `import/*` | `import-lite/*` | [eslint-plugin-import-lite](https://github.com/9romise/eslint-plugin-import-lite) |
388
+ | `node/*` | `n/*` | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) |
389
+ | `yaml/*` | `yml/*` | [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) |
390
+ | `ts/*` | `@typescript-eslint/*` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |
391
+ | `style/*` | `@stylistic/*` | [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic) |
392
+ | `test/*` | `vitest/*` | [@vitest/eslint-plugin](https://github.com/vitest-dev/eslint-plugin-vitest) |
393
+ | `test/*` | `no-only-tests/*` | [eslint-plugin-no-only-tests](https://github.com/levibuzolic/eslint-plugin-no-only-tests) |
394
+ | `next/*` | `@next/next` | [@next/eslint-plugin-next](https://github.com/vercel/next.js/tree/canary/packages/eslint-plugin-next) |
394
395
 
395
396
  When you want to override rules, or disable them inline, you need to update to the new prefix:
396
397
 
@@ -623,6 +624,25 @@ Running `npx eslint` should prompt you to install the required dependencies, oth
623
624
  npm i -D @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plugin-react-refresh
624
625
  ```
625
626
 
627
+ #### Next.js
628
+
629
+ To enable Next.js support, you need to explicitly turn it on:
630
+
631
+ ```js
632
+ // eslint.config.js
633
+ import antfu from '@antfu/eslint-config'
634
+
635
+ export default antfu({
636
+ nextjs: true,
637
+ })
638
+ ```
639
+
640
+ Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
641
+
642
+ ```bash
643
+ npm i -D @next/eslint-plugin-next
644
+ ```
645
+
626
646
  #### Svelte
627
647
 
628
648
  To enable svelte support, you need to explicitly turn it on:
package/dist/cli.js CHANGED
@@ -9,7 +9,7 @@ import parse from "parse-gitignore";
9
9
  import { execSync } from "node:child_process";
10
10
 
11
11
  //#region package.json
12
- var version = "4.18.0";
12
+ var version = "5.0.0";
13
13
 
14
14
  //#endregion
15
15
  //#region src/cli/constants.ts
@@ -104,6 +104,7 @@ const dependenciesMap = {
104
104
  astro: ["eslint-plugin-astro", "astro-eslint-parser"],
105
105
  formatter: ["eslint-plugin-format"],
106
106
  formatterAstro: ["prettier-plugin-astro"],
107
+ nextjs: ["@next/eslint-plugin-next"],
107
108
  react: [
108
109
  "@eslint-react/eslint-plugin",
109
110
  "eslint-plugin-react-hooks",
@@ -177,6 +178,7 @@ async function updateEslintFiles(result) {
177
178
  //#region src/cli/constants-generated.ts
178
179
  const versionsMap = {
179
180
  "@eslint-react/eslint-plugin": "^1.52.3",
181
+ "@next/eslint-plugin-next": "^15.4.4",
180
182
  "@unocss/eslint-plugin": "^66.3.3",
181
183
  "astro-eslint-parser": "^1.2.2",
182
184
  "eslint": "^9.31.0",
package/dist/index.d.ts CHANGED
@@ -1435,6 +1435,110 @@ interface RuleOptions {
1435
1435
  * @deprecated
1436
1436
  */
1437
1437
  'newline-per-chained-call'?: Linter.RuleEntry<NewlinePerChainedCall>;
1438
+ /**
1439
+ * Enforce font-display behavior with Google Fonts.
1440
+ * @see https://nextjs.org/docs/messages/google-font-display
1441
+ */
1442
+ 'next/google-font-display'?: Linter.RuleEntry<[]>;
1443
+ /**
1444
+ * Ensure `preconnect` is used with Google Fonts.
1445
+ * @see https://nextjs.org/docs/messages/google-font-preconnect
1446
+ */
1447
+ 'next/google-font-preconnect'?: Linter.RuleEntry<[]>;
1448
+ /**
1449
+ * Enforce `id` attribute on `next/script` components with inline content.
1450
+ * @see https://nextjs.org/docs/messages/inline-script-id
1451
+ */
1452
+ 'next/inline-script-id'?: Linter.RuleEntry<[]>;
1453
+ /**
1454
+ * Prefer `next/script` component when using the inline script for Google Analytics.
1455
+ * @see https://nextjs.org/docs/messages/next-script-for-ga
1456
+ */
1457
+ 'next/next-script-for-ga'?: Linter.RuleEntry<[]>;
1458
+ /**
1459
+ * Prevent assignment to the `module` variable.
1460
+ * @see https://nextjs.org/docs/messages/no-assign-module-variable
1461
+ */
1462
+ 'next/no-assign-module-variable'?: Linter.RuleEntry<[]>;
1463
+ /**
1464
+ * Prevent Client Components from being async functions.
1465
+ * @see https://nextjs.org/docs/messages/no-async-client-component
1466
+ */
1467
+ 'next/no-async-client-component'?: Linter.RuleEntry<[]>;
1468
+ /**
1469
+ * Prevent usage of `next/script`'s `beforeInteractive` strategy outside of `pages/_document.js`.
1470
+ * @see https://nextjs.org/docs/messages/no-before-interactive-script-outside-document
1471
+ */
1472
+ 'next/no-before-interactive-script-outside-document'?: Linter.RuleEntry<[]>;
1473
+ /**
1474
+ * Prevent manual stylesheet tags.
1475
+ * @see https://nextjs.org/docs/messages/no-css-tags
1476
+ */
1477
+ 'next/no-css-tags'?: Linter.RuleEntry<[]>;
1478
+ /**
1479
+ * Prevent importing `next/document` outside of `pages/_document.js`.
1480
+ * @see https://nextjs.org/docs/messages/no-document-import-in-page
1481
+ */
1482
+ 'next/no-document-import-in-page'?: Linter.RuleEntry<[]>;
1483
+ /**
1484
+ * Prevent duplicate usage of `<Head>` in `pages/_document.js`.
1485
+ * @see https://nextjs.org/docs/messages/no-duplicate-head
1486
+ */
1487
+ 'next/no-duplicate-head'?: Linter.RuleEntry<[]>;
1488
+ /**
1489
+ * Prevent usage of `<head>` element.
1490
+ * @see https://nextjs.org/docs/messages/no-head-element
1491
+ */
1492
+ 'next/no-head-element'?: Linter.RuleEntry<[]>;
1493
+ /**
1494
+ * Prevent usage of `next/head` in `pages/_document.js`.
1495
+ * @see https://nextjs.org/docs/messages/no-head-import-in-document
1496
+ */
1497
+ 'next/no-head-import-in-document'?: Linter.RuleEntry<[]>;
1498
+ /**
1499
+ * Prevent usage of `<a>` elements to navigate to internal Next.js pages.
1500
+ * @see https://nextjs.org/docs/messages/no-html-link-for-pages
1501
+ */
1502
+ 'next/no-html-link-for-pages'?: Linter.RuleEntry<NextNoHtmlLinkForPages>;
1503
+ /**
1504
+ * Prevent usage of `<img>` element due to slower LCP and higher bandwidth.
1505
+ * @see https://nextjs.org/docs/messages/no-img-element
1506
+ */
1507
+ 'next/no-img-element'?: Linter.RuleEntry<[]>;
1508
+ /**
1509
+ * Prevent page-only custom fonts.
1510
+ * @see https://nextjs.org/docs/messages/no-page-custom-font
1511
+ */
1512
+ 'next/no-page-custom-font'?: Linter.RuleEntry<[]>;
1513
+ /**
1514
+ * Prevent usage of `next/script` in `next/head` component.
1515
+ * @see https://nextjs.org/docs/messages/no-script-component-in-head
1516
+ */
1517
+ 'next/no-script-component-in-head'?: Linter.RuleEntry<[]>;
1518
+ /**
1519
+ * Prevent usage of `styled-jsx` in `pages/_document.js`.
1520
+ * @see https://nextjs.org/docs/messages/no-styled-jsx-in-document
1521
+ */
1522
+ 'next/no-styled-jsx-in-document'?: Linter.RuleEntry<[]>;
1523
+ /**
1524
+ * Prevent synchronous scripts.
1525
+ * @see https://nextjs.org/docs/messages/no-sync-scripts
1526
+ */
1527
+ 'next/no-sync-scripts'?: Linter.RuleEntry<[]>;
1528
+ /**
1529
+ * Prevent usage of `<title>` with `Head` component from `next/document`.
1530
+ * @see https://nextjs.org/docs/messages/no-title-in-document-head
1531
+ */
1532
+ 'next/no-title-in-document-head'?: Linter.RuleEntry<[]>;
1533
+ /**
1534
+ * Prevent common typos in Next.js data fetching functions.
1535
+ */
1536
+ 'next/no-typos'?: Linter.RuleEntry<[]>;
1537
+ /**
1538
+ * Prevent duplicate polyfills from Polyfill.io.
1539
+ * @see https://nextjs.org/docs/messages/no-unwanted-polyfillio
1540
+ */
1541
+ 'next/no-unwanted-polyfillio'?: Linter.RuleEntry<[]>;
1438
1542
  /**
1439
1543
  * Disallow the use of `alert`, `confirm`, and `prompt`
1440
1544
  * @see https://eslint.org/docs/latest/rules/no-alert
@@ -9645,6 +9749,8 @@ type NewlineAfterVar = [] | [("never" | "always")];
9645
9749
  type NewlinePerChainedCall = [] | [{
9646
9750
  ignoreChainWithDepth?: number;
9647
9751
  }];
9752
+ // ----- next/no-html-link-for-pages -----
9753
+ type NextNoHtmlLinkForPages = [] | [(string | string[])];
9648
9754
  // ----- no-bitwise -----
9649
9755
  type NoBitwise = [] | [{
9650
9756
  allow?: ("^" | "|" | "&" | "<<" | ">>" | ">>>" | "^=" | "|=" | "&=" | "<<=" | ">>=" | ">>>=" | "~")[];
@@ -16644,7 +16750,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
16644
16750
  onlyEquality?: boolean;
16645
16751
  }];
16646
16752
  // Names of all the configs
16647
- type ConfigNames = 'antfu/astro/setup' | 'antfu/astro/rules' | 'antfu/eslint-comments/rules' | 'antfu/formatter/setup' | 'antfu/imports/rules' | 'antfu/javascript/setup' | 'antfu/javascript/rules' | 'antfu/jsx/setup' | 'antfu/jsdoc/rules' | 'antfu/jsonc/setup' | 'antfu/jsonc/rules' | 'antfu/markdown/setup' | 'antfu/markdown/processor' | 'antfu/markdown/parser' | 'antfu/markdown/disables' | 'antfu/node/rules' | 'antfu/perfectionist/setup' | 'antfu/react/setup' | 'antfu/react/rules' | 'antfu/solid/setup' | 'antfu/solid/rules' | 'antfu/sort/package-json' | 'antfu/stylistic/rules' | 'antfu/svelte/setup' | 'antfu/svelte/rules' | 'antfu/test/setup' | 'antfu/test/rules' | 'antfu/toml/setup' | 'antfu/toml/rules' | 'antfu/regexp/rules' | 'antfu/typescript/setup' | 'antfu/typescript/parser' | 'antfu/typescript/rules' | 'antfu/unicorn/rules' | 'antfu/unocss' | 'antfu/vue/setup' | 'antfu/vue/rules' | 'antfu/yaml/setup' | 'antfu/yaml/rules' | 'antfu/yaml/pnpm-workspace';
16753
+ type ConfigNames = 'antfu/astro/setup' | 'antfu/astro/rules' | 'antfu/eslint-comments/rules' | 'antfu/formatter/setup' | 'antfu/imports/rules' | 'antfu/javascript/setup' | 'antfu/javascript/rules' | 'antfu/jsx/setup' | 'antfu/jsdoc/rules' | 'antfu/jsonc/setup' | 'antfu/jsonc/rules' | 'antfu/markdown/setup' | 'antfu/markdown/processor' | 'antfu/markdown/parser' | 'antfu/markdown/disables' | 'antfu/node/rules' | 'antfu/perfectionist/setup' | 'antfu/nextjs/setup' | 'antfu/nextjs/rules' | 'antfu/react/setup' | 'antfu/react/rules' | 'antfu/solid/setup' | 'antfu/solid/rules' | 'antfu/sort/package-json' | 'antfu/stylistic/rules' | 'antfu/svelte/setup' | 'antfu/svelte/rules' | 'antfu/test/setup' | 'antfu/test/rules' | 'antfu/toml/setup' | 'antfu/toml/rules' | 'antfu/regexp/rules' | 'antfu/typescript/setup' | 'antfu/typescript/parser' | 'antfu/typescript/rules' | 'antfu/unicorn/rules' | 'antfu/unocss' | 'antfu/vue/setup' | 'antfu/vue/rules' | 'antfu/yaml/setup' | 'antfu/yaml/rules' | 'antfu/yaml/pnpm-workspace';
16648
16754
  //#endregion
16649
16755
  //#region src/vender/prettier-types.d.ts
16650
16756
  /**
@@ -16768,14 +16874,25 @@ interface VendoredPrettierOptionsRequired {
16768
16874
  //#endregion
16769
16875
  //#region src/types.d.ts
16770
16876
  type Awaitable<T> = T | Promise<T>;
16771
- interface Rules extends RuleOptions {}
16772
- type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins'> & {
16877
+ type Rules = Record<string, Linter.RuleEntry<any> | undefined> & RuleOptions;
16878
+ /**
16879
+ * An updated version of ESLint's `Linter.Config`, which provides autocompletion
16880
+ * for `rules` and relaxes type limitations for `plugins` and `rules`, because
16881
+ * many plugins still lack proper type definitions.
16882
+ */
16883
+ type TypedFlatConfigItem = Omit<Linter.Config, 'plugins' | 'rules'> & {
16773
16884
  /**
16774
- * An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
16885
+ * An object containing a name-value mapping of plugin names to plugin objects.
16886
+ * When `files` is specified, these plugins are only available to the matching files.
16775
16887
  *
16776
16888
  * @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
16777
16889
  */
16778
16890
  plugins?: Record<string, any>;
16891
+ /**
16892
+ * An object containing the configured rules. When `files` or `ignores` are
16893
+ * specified, these rule configurations are only available to the matching files.
16894
+ */
16895
+ rules?: Rules;
16779
16896
  };
16780
16897
  interface OptionsFiles {
16781
16898
  /**
@@ -17080,6 +17197,15 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
17080
17197
  * @default false
17081
17198
  */
17082
17199
  react?: boolean | OptionsOverrides;
17200
+ /**
17201
+ * Enable nextjs rules.
17202
+ *
17203
+ * Requires installing:
17204
+ * - `@next/eslint-plugin-next`
17205
+ *
17206
+ * @default false
17207
+ */
17208
+ nextjs?: boolean | OptionsOverrides;
17083
17209
  /**
17084
17210
  * Enable solid rules.
17085
17211
  *
@@ -17166,6 +17292,7 @@ declare const defaultPluginRenaming: {
17166
17292
  '@eslint-react/dom': string;
17167
17293
  '@eslint-react/hooks-extra': string;
17168
17294
  '@eslint-react/naming-convention': string;
17295
+ '@next/next': string;
17169
17296
  '@stylistic': string;
17170
17297
  '@typescript-eslint': string;
17171
17298
  'import-lite': string;
@@ -17224,6 +17351,9 @@ declare function jsx(): Promise<TypedFlatConfigItem[]>;
17224
17351
  //#region src/configs/markdown.d.ts
17225
17352
  declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
17226
17353
  //#endregion
17354
+ //#region src/configs/nextjs.d.ts
17355
+ declare function nextjs(options?: OptionsOverrides & OptionsFiles): Promise<TypedFlatConfigItem[]>;
17356
+ //#endregion
17227
17357
  //#region src/configs/node.d.ts
17228
17358
  declare function node(): Promise<TypedFlatConfigItem[]>;
17229
17359
  //#endregion
@@ -17397,4 +17527,4 @@ declare function ensurePackages(packages: (string | undefined)[]): Promise<void>
17397
17527
  declare function isInEditorEnv(): boolean;
17398
17528
  declare function isInGitHooksOrLintStaged(): boolean;
17399
17529
  //#endregion
17400
- export { Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsProjectType, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, ResolvedOptions, Rules, StylisticConfig, StylisticConfigDefaults, StylisticOptions, TypedFlatConfigItem, antfu, astro, combine, command, comments, antfu as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
17530
+ export { Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsProjectType, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, ResolvedOptions, Rules, StylisticConfig, StylisticConfigDefaults, StylisticOptions, TypedFlatConfigItem, antfu, astro, combine, command, comments, antfu as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
package/dist/index.js CHANGED
@@ -966,6 +966,34 @@ async function markdown(options = {}) {
966
966
  ];
967
967
  }
968
968
 
969
+ //#endregion
970
+ //#region src/configs/nextjs.ts
971
+ function normalizeRules(rules) {
972
+ return Object.fromEntries(Object.entries(rules).map(([key, value]) => [key, typeof value === "string" ? [value] : value]));
973
+ }
974
+ async function nextjs(options = {}) {
975
+ const { files = [GLOB_SRC], overrides = {} } = options;
976
+ await ensurePackages(["@next/eslint-plugin-next"]);
977
+ const pluginNextJS = await interopDefault(import("@next/eslint-plugin-next"));
978
+ return [{
979
+ name: "antfu/nextjs/setup",
980
+ plugins: { next: pluginNextJS }
981
+ }, {
982
+ files,
983
+ languageOptions: {
984
+ parserOptions: { ecmaFeatures: { jsx: true } },
985
+ sourceType: "module"
986
+ },
987
+ name: "antfu/nextjs/rules",
988
+ rules: {
989
+ ...normalizeRules(pluginNextJS.configs.recommended.rules),
990
+ ...normalizeRules(pluginNextJS.configs["core-web-vitals"].rules),
991
+ ...overrides
992
+ },
993
+ settings: { react: { version: "detect" } }
994
+ }];
995
+ }
996
+
969
997
  //#endregion
970
998
  //#region src/configs/node.ts
971
999
  async function node() {
@@ -1557,7 +1585,6 @@ async function svelte(options = {}) {
1557
1585
  "svelte/no-dupe-else-if-blocks": "error",
1558
1586
  "svelte/no-dupe-style-properties": "error",
1559
1587
  "svelte/no-dupe-use-directives": "error",
1560
- "svelte/no-dynamic-slot-name": "error",
1561
1588
  "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
1562
1589
  "svelte/no-inner-declarations": "error",
1563
1590
  "svelte/no-not-function-handler": "error",
@@ -2164,6 +2191,7 @@ const defaultPluginRenaming = {
2164
2191
  "@eslint-react/dom": "react-dom",
2165
2192
  "@eslint-react/hooks-extra": "react-hooks-extra",
2166
2193
  "@eslint-react/naming-convention": "react-naming-convention",
2194
+ "@next/next": "next",
2167
2195
  "@stylistic": "style",
2168
2196
  "@typescript-eslint": "ts",
2169
2197
  "import-lite": "import",
@@ -2182,7 +2210,7 @@ const defaultPluginRenaming = {
2182
2210
  * The merged ESLint configurations.
2183
2211
  */
2184
2212
  function antfu(options = {}, ...userConfigs) {
2185
- const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, imports: enableImports = true, jsx: enableJsx = true, pnpm: enableCatalogs = false, react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
2213
+ const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, imports: enableImports = true, jsx: enableJsx = true, nextjs: enableNextjs = false, pnpm: enableCatalogs = false, react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
2186
2214
  let isInEditor = options.isInEditor;
2187
2215
  if (isInEditor == null) {
2188
2216
  isInEditor = isInEditorEnv();
@@ -2239,6 +2267,7 @@ function antfu(options = {}, ...userConfigs) {
2239
2267
  overrides: getOverrides(options, "react"),
2240
2268
  tsconfigPath
2241
2269
  }));
2270
+ if (enableNextjs) configs$1.push(nextjs({ overrides: getOverrides(options, "nextjs") }));
2242
2271
  if (enableSolid) configs$1.push(solid({
2243
2272
  overrides: getOverrides(options, "solid"),
2244
2273
  tsconfigPath,
@@ -2308,4 +2337,4 @@ function getOverrides(options, key) {
2308
2337
  var src_default = antfu;
2309
2338
 
2310
2339
  //#endregion
2311
- export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, antfu, astro, combine, command, comments, src_default as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
2340
+ export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, antfu, astro, combine, command, comments, src_default as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antfu/eslint-config",
3
3
  "type": "module",
4
- "version": "4.18.0",
4
+ "version": "5.0.0",
5
5
  "description": "Anthony's ESLint config",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
7
7
  "license": "MIT",
@@ -29,6 +29,7 @@
29
29
  ],
30
30
  "peerDependencies": {
31
31
  "@eslint-react/eslint-plugin": "^1.38.4",
32
+ "@next/eslint-plugin-next": "^15.4.0-canary.115",
32
33
  "@prettier/plugin-xml": "^3.4.1",
33
34
  "@unocss/eslint-plugin": ">=0.50.0",
34
35
  "astro-eslint-parser": "^1.0.2",
@@ -48,6 +49,9 @@
48
49
  "@eslint-react/eslint-plugin": {
49
50
  "optional": true
50
51
  },
52
+ "@next/eslint-plugin-next": {
53
+ "optional": true
54
+ },
51
55
  "@prettier/plugin-xml": {
52
56
  "optional": true
53
57
  },
@@ -130,6 +134,7 @@
130
134
  "@antfu/ni": "^25.0.0",
131
135
  "@eslint-react/eslint-plugin": "^1.52.3",
132
136
  "@eslint/config-inspector": "^1.1.0",
137
+ "@next/eslint-plugin-next": "^15.4.4",
133
138
  "@prettier/plugin-xml": "^3.4.2",
134
139
  "@types/node": "^24.1.0",
135
140
  "@unocss/eslint-plugin": "^66.3.3",
@@ -143,23 +148,23 @@
143
148
  "eslint-plugin-solid": "^0.14.5",
144
149
  "eslint-plugin-svelte": "^3.11.0",
145
150
  "eslint-plugin-vuejs-accessibility": "^2.4.1",
146
- "eslint-typegen": "^2.2.1",
151
+ "eslint-typegen": "^2.3.0",
147
152
  "execa": "^9.6.0",
148
- "jiti": "^2.4.2",
153
+ "jiti": "^2.5.1",
149
154
  "lint-staged": "^16.1.2",
150
155
  "pnpm-workspace-yaml": "^1.1.0",
151
156
  "prettier-plugin-astro": "^0.14.1",
152
157
  "prettier-plugin-slidev": "^1.0.5",
153
158
  "simple-git-hooks": "^2.13.0",
154
- "svelte": "^5.36.13",
159
+ "svelte": "^5.36.16",
155
160
  "svelte-eslint-parser": "^1.3.0",
156
161
  "tinyglobby": "^0.2.14",
157
162
  "tsdown": "^0.13.0",
158
163
  "tsx": "^4.20.3",
159
164
  "typescript": "^5.8.3",
160
165
  "vitest": "^3.2.4",
161
- "vue": "^3.5.17",
162
- "@antfu/eslint-config": "4.18.0"
166
+ "vue": "^3.5.18",
167
+ "@antfu/eslint-config": "5.0.0"
163
168
  },
164
169
  "resolutions": {
165
170
  "eslint": "catalog:peer"