Unverified Commit 4bee3817 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

[Breaking] Flat config as default in `@next/eslint-plugin-next` (#83763)

> [!NOTE]
> This is not a breaking change for `eslint-config-next` as they are
modified to use the legacy. Therefore, CNA templates or current users
that use `eslint-config-next` won't be affected.

### Why?

This PR uses v16 as an opportunity to make the Flat config the default
for `@next/eslint-plugin-next`. Since ESLint v10 will drop the Legacy
config, it is recommended for the plugins to migrate the default config
to Flat. This follows the recommended [plugin migration guide to flat
config](https://eslint.org/docs/latest/extend/plugin-migration-flat-config)
from ESLint.

Along with the migration, it uses the types from ESLint to let users
have correct type safety when using the plugin.

Fixes https://github.com/vercel/next.js/issues/81695
Fixes https://github.com/vercel/next.js/issues/81083
Fixes https://github.com/vercel/next.js/issues/82967
Closes NEXT-4663
parent 721def6b
module.exports = {
extends: [require.resolve('.'), 'plugin:@next/next/core-web-vitals'],
extends: [require.resolve('.'), 'plugin:@next/next/core-web-vitals-legacy'],
}
......@@ -56,7 +56,7 @@ module.exports = {
extends: [
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@next/next/recommended',
'plugin:@next/next/recommended-legacy',
],
plugins: ['import', 'react', 'jsx-a11y'],
rules: {
......
......@@ -16,12 +16,13 @@
"fast-glob": "3.3.1"
},
"devDependencies": {
"eslint": "8.56.0"
"eslint": "9.12.0",
"@types/eslint": "9.6.1"
},
"scripts": {
"dev": "pnpm build",
"build": "swc -d dist src && pnpm types",
"types": "tsc src/index.ts --skipLibCheck --declaration --emitDeclarationOnly --declarationDir dist",
"types": "tsc src/index.ts --skipLibCheck --declaration --emitDeclarationOnly --esModuleInterop --declarationDir dist",
"prepublishOnly": "cd ../../ && turbo run build"
}
}
import type { Linter, Rule } from 'eslint'
import googleFontDisplay from './rules/google-font-display'
import googleFontPreconnect from './rules/google-font-preconnect'
import inlineScriptId from './rules/inline-script-id'
import nextScriptForGa from './rules/next-script-for-ga'
import noAssignModuleVariable from './rules/no-assign-module-variable'
import noAsyncClientComponent from './rules/no-async-client-component'
import noBeforeInteractiveScriptOutsideDocument from './rules/no-before-interactive-script-outside-document'
import noCssTags from './rules/no-css-tags'
import noDocumentImportInPage from './rules/no-document-import-in-page'
import noDuplicateHead from './rules/no-duplicate-head'
import noHeadElement from './rules/no-head-element'
import noHeadImportInDocument from './rules/no-head-import-in-document'
import noHtmlLinkForPages from './rules/no-html-link-for-pages'
import noImgElement from './rules/no-img-element'
import noPageCustomFont from './rules/no-page-custom-font'
import noScriptComponentInHead from './rules/no-script-component-in-head'
import noStyledJsxInDocument from './rules/no-styled-jsx-in-document'
import noSyncScripts from './rules/no-sync-scripts'
import noTitleInDocumentHead from './rules/no-title-in-document-head'
import noTypos from './rules/no-typos'
import noUnwantedPolyfillio from './rules/no-unwanted-polyfillio'
const recommendedRules = {
// warnings
'@next/next/google-font-display': 'warn',
......@@ -22,72 +46,61 @@ const recommendedRules = {
'@next/next/no-duplicate-head': 'error',
'@next/next/no-head-import-in-document': 'error',
'@next/next/no-script-component-in-head': 'error',
}
} satisfies Linter.RulesRecord
const coreWebVitalsRules = {
'@next/next/no-html-link-for-pages': 'error',
'@next/next/no-sync-scripts': 'error',
}
} satisfies Linter.RulesRecord
const plugin = {
meta: {
name: '@next/eslint-plugin-next',
},
rules: {
'google-font-display':
require('./rules/google-font-display') as typeof import('./rules/google-font-display'),
'google-font-preconnect':
require('./rules/google-font-preconnect') as typeof import('./rules/google-font-preconnect'),
'inline-script-id':
require('./rules/inline-script-id') as typeof import('./rules/inline-script-id'),
'next-script-for-ga':
require('./rules/next-script-for-ga') as typeof import('./rules/next-script-for-ga'),
'no-assign-module-variable':
require('./rules/no-assign-module-variable') as typeof import('./rules/no-assign-module-variable'),
'no-async-client-component':
require('./rules/no-async-client-component') as typeof import('./rules/no-async-client-component'),
'google-font-display': googleFontDisplay,
'google-font-preconnect': googleFontPreconnect,
'inline-script-id': inlineScriptId,
'next-script-for-ga': nextScriptForGa,
'no-assign-module-variable': noAssignModuleVariable,
'no-async-client-component': noAsyncClientComponent,
'no-before-interactive-script-outside-document':
require('./rules/no-before-interactive-script-outside-document') as typeof import('./rules/no-before-interactive-script-outside-document'),
'no-css-tags':
require('./rules/no-css-tags') as typeof import('./rules/no-css-tags'),
'no-document-import-in-page':
require('./rules/no-document-import-in-page') as typeof import('./rules/no-document-import-in-page'),
'no-duplicate-head':
require('./rules/no-duplicate-head') as typeof import('./rules/no-duplicate-head'),
'no-head-element':
require('./rules/no-head-element') as typeof import('./rules/no-head-element'),
'no-head-import-in-document':
require('./rules/no-head-import-in-document') as typeof import('./rules/no-head-import-in-document'),
'no-html-link-for-pages':
require('./rules/no-html-link-for-pages') as typeof import('./rules/no-html-link-for-pages'),
'no-img-element':
require('./rules/no-img-element') as typeof import('./rules/no-img-element'),
'no-page-custom-font':
require('./rules/no-page-custom-font') as typeof import('./rules/no-page-custom-font'),
'no-script-component-in-head':
require('./rules/no-script-component-in-head') as typeof import('./rules/no-script-component-in-head'),
'no-styled-jsx-in-document':
require('./rules/no-styled-jsx-in-document') as typeof import('./rules/no-styled-jsx-in-document'),
'no-sync-scripts':
require('./rules/no-sync-scripts') as typeof import('./rules/no-sync-scripts'),
'no-title-in-document-head':
require('./rules/no-title-in-document-head') as typeof import('./rules/no-title-in-document-head'),
'no-typos':
require('./rules/no-typos') as typeof import('./rules/no-typos'),
'no-unwanted-polyfillio':
require('./rules/no-unwanted-polyfillio') as typeof import('./rules/no-unwanted-polyfillio'),
},
configs: {
recommended: {
plugins: ['@next/next'],
rules: recommendedRules,
},
'core-web-vitals': {
plugins: ['@next/next'],
extends: ['plugin:@next/next/recommended'],
rules: coreWebVitalsRules,
},
},
noBeforeInteractiveScriptOutsideDocument,
'no-css-tags': noCssTags,
'no-document-import-in-page': noDocumentImportInPage,
'no-duplicate-head': noDuplicateHead,
'no-head-element': noHeadElement,
'no-head-import-in-document': noHeadImportInDocument,
'no-html-link-for-pages': noHtmlLinkForPages,
'no-img-element': noImgElement,
'no-page-custom-font': noPageCustomFont,
'no-script-component-in-head': noScriptComponentInHead,
'no-styled-jsx-in-document': noStyledJsxInDocument,
'no-sync-scripts': noSyncScripts,
'no-title-in-document-head': noTitleInDocumentHead,
'no-typos': noTypos,
'no-unwanted-polyfillio': noUnwantedPolyfillio,
} satisfies Record<string, Rule.RuleModule>,
configs: {} as ESLintPluginConfigs,
}
type ESLintPluginConfigs = {
'recommended-legacy': Linter.LegacyConfig
'core-web-vitals-legacy': Linter.LegacyConfig
recommended: Linter.Config
'core-web-vitals': Linter.Config
}
const flatConfig = {
Object.assign(plugin.configs, {
'recommended-legacy': {
plugins: ['@next/next'],
rules: recommendedRules,
},
'core-web-vitals-legacy': {
plugins: ['@next/next'],
extends: ['plugin:@next/next/recommended-legacy'],
rules: coreWebVitalsRules,
},
recommended: {
name: 'next/recommended',
plugins: {
......@@ -95,7 +108,7 @@ const flatConfig = {
},
rules: recommendedRules,
},
coreWebVitals: {
'core-web-vitals': {
name: 'next/core-web-vitals',
plugins: {
'@next/next': plugin,
......@@ -105,8 +118,7 @@ const flatConfig = {
...coreWebVitalsRules,
},
},
}
} satisfies ESLintPluginConfigs)
export default plugin
export const { rules, configs } = plugin
export { flatConfig }
......@@ -3,7 +3,7 @@ import NodeAttributes from '../utils/node-attributes'
const url = 'https://nextjs.org/docs/messages/google-font-display'
export = defineRule({
export default defineRule({
meta: {
docs: {
description: 'Enforce font-display behavior with Google Fonts.',
......
......@@ -3,7 +3,7 @@ import NodeAttributes from '../utils/node-attributes'
const url = 'https://nextjs.org/docs/messages/google-font-preconnect'
export = defineRule({
export default defineRule({
meta: {
docs: {
description: 'Ensure `preconnect` is used with Google Fonts.',
......
......@@ -2,7 +2,7 @@ import { defineRule } from '../utils/define-rule'
const url = 'https://nextjs.org/docs/messages/inline-script-id'
export = defineRule({
export default defineRule({
meta: {
docs: {
description:
......
......@@ -19,7 +19,7 @@ const containsStr = (str, strList) => {
return strList.some((s) => str.includes(s))
}
export = defineRule({
export default defineRule({
meta: {
docs: {
description,
......
import { defineRule } from '../utils/define-rule'
const url = 'https://nextjs.org/docs/messages/no-assign-module-variable'
export = defineRule({
export default defineRule({
meta: {
docs: {
description: 'Prevent assignment to the `module` variable.',
......
......@@ -8,7 +8,7 @@ function isCapitalized(str: string): boolean {
return /[A-Z]/.test(str?.[0])
}
export = defineRule({
export default defineRule({
meta: {
docs: {
description,
......
......@@ -7,7 +7,7 @@ const url =
const convertToCorrectSeparator = (str: string) =>
str.replace(/[\\/]/g, path.sep)
export = defineRule({
export default defineRule({
meta: {
docs: {
description:
......
import { defineRule } from '../utils/define-rule'
const url = 'https://nextjs.org/docs/messages/no-css-tags'
export = defineRule({
export default defineRule({
meta: {
docs: {
description: 'Prevent manual stylesheet tags.',
......
......@@ -3,7 +3,7 @@ import * as path from 'path'
const url = 'https://nextjs.org/docs/messages/no-document-import-in-page'
export = defineRule({
export default defineRule({
meta: {
docs: {
description:
......
import { defineRule } from '../utils/define-rule'
const url = 'https://nextjs.org/docs/messages/no-duplicate-head'
export = defineRule({
export default defineRule({
meta: {
docs: {
description:
......
import path = require('path')
import path from 'path'
import { defineRule } from '../utils/define-rule'
const url = 'https://nextjs.org/docs/messages/no-head-element'
export = defineRule({
export default defineRule({
meta: {
docs: {
description: 'Prevent usage of `<head>` element.',
......
......@@ -3,7 +3,7 @@ import * as path from 'path'
const url = 'https://nextjs.org/docs/messages/no-head-import-in-document'
export = defineRule({
export default defineRule({
meta: {
docs: {
description: 'Prevent usage of `next/head` in `pages/_document.js`.',
......
......@@ -37,7 +37,7 @@ const cachedGetUrlFromAppDirectory = memoize(getUrlFromAppDirectory)
const url = 'https://nextjs.org/docs/messages/no-html-link-for-pages'
export = defineRule({
export default defineRule({
meta: {
docs: {
description:
......
import path = require('path')
import path from 'path'
import { defineRule } from '../utils/define-rule'
const url = 'https://nextjs.org/docs/messages/no-img-element'
export = defineRule({
export default defineRule({
meta: {
docs: {
description:
......
......@@ -9,7 +9,7 @@ function isIdentifierMatch(id1, id2) {
return (id1 === null && id2 === null) || (id1 && id2 && id1.name === id2.name)
}
export = defineRule({
export default defineRule({
meta: {
docs: {
description: 'Prevent page-only custom fonts.',
......
import { defineRule } from '../utils/define-rule'
const url = 'https://nextjs.org/docs/messages/no-script-component-in-head'
export = defineRule({
export default defineRule({
meta: {
docs: {
description: 'Prevent usage of `next/script` in `next/head` component.',
......
......@@ -3,7 +3,7 @@ import * as path from 'path'
const url = 'https://nextjs.org/docs/messages/no-styled-jsx-in-document'
export = defineRule({
export default defineRule({
meta: {
docs: {
description: 'Prevent usage of `styled-jsx` in `pages/_document.js`.',
......
......@@ -2,7 +2,7 @@ import { defineRule } from '../utils/define-rule'
const url = 'https://nextjs.org/docs/messages/no-sync-scripts'
export = defineRule({
export default defineRule({
meta: {
docs: {
description: 'Prevent synchronous scripts.',
......
import { defineRule } from '../utils/define-rule'
const url = 'https://nextjs.org/docs/messages/no-title-in-document-head'
export = defineRule({
export default defineRule({
meta: {
docs: {
description:
......
......@@ -41,7 +41,7 @@ function minDistance(a, b) {
}
/* eslint-disable eslint-plugin/require-meta-docs-url */
export = defineRule({
export default defineRule({
meta: {
docs: {
description: 'Prevent common typos in Next.js data fetching functions.',
......
......@@ -73,7 +73,7 @@ const url = 'https://nextjs.org/docs/messages/no-unwanted-polyfillio'
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
export = defineRule({
export default defineRule({
meta: {
docs: {
description: 'Prevent duplicate polyfills from Polyfill.io.',
......
{
"compilerOptions": {
"module": "commonjs",
"target": "es2019"
"target": "es2019",
"esModuleInterop": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -904,9 +904,12 @@ importers:
specifier: 3.3.1
version: 3.3.1
devDependencies:
'@types/eslint':
specifier: 9.6.1
version: 9.6.1
eslint:
specifier: 8.56.0
version: 8.56.0
specifier: 9.12.0
version: 9.12.0
packages/font:
devDependencies:
......@@ -965,7 +968,7 @@ importers:
version: 7.26.10
'@babel/eslint-parser':
specifier: 7.24.6
version: 7.24.6(@babel/core@7.26.10)(eslint@9.12.0)
version: 7.24.6(@babel/core@7.26.10)(eslint@9.35.0)
'@babel/generator':
specifier: 7.27.0
version: 7.27.0
......@@ -3476,6 +3479,12 @@ packages:
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
'@eslint-community/eslint-utils@4.9.0':
resolution: {integrity: sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
'@eslint-community/regexpp@4.11.0':
resolution: {integrity: sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
......@@ -3484,10 +3493,26 @@ packages:
resolution: {integrity: sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
'@eslint-community/regexpp@4.12.1':
resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
'@eslint/config-array@0.18.0':
resolution: {integrity: sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@eslint/config-array@0.21.0':
resolution: {integrity: sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@eslint/config-helpers@0.3.1':
resolution: {integrity: sha512-xR93k9WhrDYpXHORXpxVL5oHj3Era7wo6k/Wd8/IsQNnZUTzkGS29lyn3nAT05v6ltUuTFVCCYDEGfy2Or/sPA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@eslint/core@0.15.2':
resolution: {integrity: sha512-78Md3/Rrxh83gCxoUc0EiciuOHsIITzLy53m3d9UyiW8y9Dj2D29FeETqyKA+BRK76tnTp6RXWb3pCay8Oyomg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@eslint/core@0.6.0':
resolution: {integrity: sha512-8I2Q8ykA4J0x0o7cg67FPVnehcqWTBehu/lmY+bolPFHGjh49YzGBMXTvpqVgEbBdvNCSxj6iFgiIyHzf03lzg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
......@@ -3500,14 +3525,10 @@ packages:
resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
'@eslint/eslintrc@3.1.0':
resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==}
'@eslint/eslintrc@3.3.1':
resolution: {integrity: sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@eslint/js@8.56.0':
resolution: {integrity: sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
'@eslint/js@8.57.1':
resolution: {integrity: sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
......@@ -3516,14 +3537,22 @@ packages:
resolution: {integrity: sha512-eohesHH8WFRUprDNyEREgqP6beG6htMeUYeCpkEgBCieCMme5r9zFWjzAJp//9S+Kub4rqE+jXe9Cp1a7IYIIA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@eslint/object-schema@2.1.4':
resolution: {integrity: sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==}
'@eslint/js@9.35.0':
resolution: {integrity: sha512-30iXE9whjlILfWobBkNerJo+TXYsgVM5ERQwMcMKCHckHflCmf7wXDAHlARoWnh0s1U72WqlbeyE7iAcCzuCPw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@eslint/object-schema@2.1.6':
resolution: {integrity: sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@eslint/plugin-kit@0.2.0':
resolution: {integrity: sha512-vH9PiIMMwvhCx31Af3HiGzsVNULDbyVkHXwlemn/B0TFj/00ho3y55efXrUZTfQipxoHC5u4xq6zblww1zm1Ig==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@eslint/plugin-kit@0.3.5':
resolution: {integrity: sha512-Z5kJ+wU3oA7MMIqVR9tyZRtjYPr4OC004Q4Rw7pgOKUOKkJfZ3O24nz3WYfGRpMDNmcOi3TwQOmgm7B7Tpii0w==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@fastify/busboy@2.0.0':
resolution: {integrity: sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==}
engines: {node: '>=14'}
......@@ -3713,19 +3742,14 @@ packages:
'@hapi/topo@5.1.0':
resolution: {integrity: sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==}
'@humanfs/core@0.19.0':
resolution: {integrity: sha512-2cbWIHbZVEweE853g8jymffCA+NCMiuqeECeBBLm8dg2oFdjuGJhgN4UAbI+6v0CKbbhvtXA4qV8YR5Ji86nmw==}
'@humanfs/core@0.19.1':
resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==}
engines: {node: '>=18.18.0'}
'@humanfs/node@0.16.5':
resolution: {integrity: sha512-KSPA4umqSG4LHYRodq31VDwKAvaTF4xmVlzM8Aeh4PlU1JQ3IG0wiA8C25d3RQ9nJyM3mBHyI53K06VVL/oFFg==}
'@humanfs/node@0.16.7':
resolution: {integrity: sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==}
engines: {node: '>=18.18.0'}
'@humanwhocodes/config-array@0.11.14':
resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==}
engines: {node: '>=10.10.0'}
deprecated: Use @eslint/config-array instead
'@humanwhocodes/config-array@0.13.0':
resolution: {integrity: sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==}
engines: {node: '>=10.10.0'}
......@@ -3752,6 +3776,10 @@ packages:
resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==}
engines: {node: '>=18.18'}
'@humanwhocodes/retry@0.4.3':
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
engines: {node: '>=18.18'}
'@img/sharp-darwin-arm64@0.34.3':
resolution: {integrity: sha512-ryFMfvxxpQRsgZJqBd4wsttYQbCxsJksrv9Lw/v798JcQ8+w84mBWuXwl+TT0WJ/WrYOLaYpwQXi3sA9nTIaIg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
......@@ -5553,8 +5581,8 @@ packages:
'@types/eslint-scope@3.7.7':
resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==}
'@types/eslint@7.28.0':
resolution: {integrity: sha512-07XlgzX0YJUn4iG1ocY4IX9DzKSmMGUs6ESKlxWhZRaa0fatIWaHWUVapcuGa8r5HFnTqzj+4OCjd5f7EZ/i/A==}
'@types/eslint@9.6.1':
resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==}
'@types/estree-jsx@1.0.0':
resolution: {integrity: sha512-3qvGd0z8F2ENTGr/GG1yViqfiKmRfrXVx5sJyHGFu3z7m5g5utCQtGp/g29JnjflhtQJBv1WDQukHiT58xPcYQ==}
......@@ -6219,6 +6247,11 @@ packages:
engines: {node: '>=0.4.0'}
hasBin: true
acorn@8.15.0:
resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==}
engines: {node: '>=0.4.0'}
hasBin: true
acorn@8.5.0:
resolution: {integrity: sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==}
engines: {node: '>=0.4.0'}
......@@ -8885,8 +8918,8 @@ packages:
resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
eslint-scope@8.1.0:
resolution: {integrity: sha512-14dSvlhaVhKKsa9Fx1l8A17s7ah7Ef7wCakJ10LYk6+GYmP9yDti2oq2SEwcyndt6knfcZyhyxwY3i9yL78EQw==}
eslint-scope@8.4.0:
resolution: {integrity: sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
eslint-utils@2.1.0:
......@@ -8921,12 +8954,6 @@ packages:
deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options.
hasBin: true
eslint@8.56.0:
resolution: {integrity: sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options.
hasBin: true
eslint@8.57.1:
resolution: {integrity: sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
......@@ -8943,8 +8970,18 @@ packages:
jiti:
optional: true
espree@10.2.0:
resolution: {integrity: sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g==}
eslint@9.35.0:
resolution: {integrity: sha512-QePbBFMJFjgmlE+cXAlbHZbHpdFVS2E/6vzCy7aKlebddvl1vadiC4JFV5u/wqTkNUwEV8WrQi257jf5f06hrg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
hasBin: true
peerDependencies:
jiti: '*'
peerDependenciesMeta:
jiti:
optional: true
espree@10.4.0:
resolution: {integrity: sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
espree@7.3.1:
......@@ -17118,6 +17155,14 @@ snapshots:
eslint-visitor-keys: 2.1.0
semver: 6.3.1
'@babel/eslint-parser@7.24.6(@babel/core@7.26.10)(eslint@9.35.0)':
dependencies:
'@babel/core': 7.26.10
'@nicolo-ribaudo/eslint-scope-5-internals': 5.1.1-v1
eslint: 9.35.0
eslint-visitor-keys: 2.1.0
semver: 6.3.1
'@babel/generator@7.18.0':
dependencies:
'@babel/types': 7.27.0
......@@ -18663,33 +18708,54 @@ snapshots:
'@esbuild/win32-x64@0.25.2':
optional: true
'@eslint-community/eslint-utils@4.4.0(eslint@8.56.0)':
'@eslint-community/eslint-utils@4.4.0(eslint@9.12.0)':
dependencies:
eslint: 8.56.0
eslint: 9.12.0
eslint-visitor-keys: 3.4.3
'@eslint-community/eslint-utils@4.4.0(eslint@9.12.0)':
'@eslint-community/eslint-utils@4.7.0(eslint@9.12.0)':
dependencies:
eslint: 9.12.0
eslint-visitor-keys: 3.4.3
'@eslint-community/eslint-utils@4.7.0(eslint@9.12.0)':
'@eslint-community/eslint-utils@4.9.0(eslint@9.12.0)':
dependencies:
eslint: 9.12.0
eslint-visitor-keys: 3.4.3
'@eslint-community/eslint-utils@4.9.0(eslint@9.35.0)':
dependencies:
eslint: 9.35.0
eslint-visitor-keys: 3.4.3
'@eslint-community/regexpp@4.11.0': {}
'@eslint-community/regexpp@4.11.1': {}
'@eslint-community/regexpp@4.12.1': {}
'@eslint/config-array@0.18.0':
dependencies:
'@eslint/object-schema': 2.1.4
'@eslint/object-schema': 2.1.6
debug: 4.4.0
minimatch: 3.1.2
transitivePeerDependencies:
- supports-color
'@eslint/config-array@0.21.0':
dependencies:
'@eslint/object-schema': 2.1.6
debug: 4.4.0
minimatch: 3.1.2
transitivePeerDependencies:
- supports-color
'@eslint/config-helpers@0.3.1': {}
'@eslint/core@0.15.2':
dependencies:
'@types/json-schema': 7.0.15
'@eslint/core@0.6.0': {}
'@eslint/eslintrc@0.4.3':
......@@ -18720,11 +18786,11 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@eslint/eslintrc@3.1.0':
'@eslint/eslintrc@3.3.1':
dependencies:
ajv: 6.12.6
debug: 4.4.0
espree: 10.2.0
espree: 10.4.0
globals: 14.0.0
ignore: 5.3.2
import-fresh: 3.3.0
......@@ -18734,18 +18800,23 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@eslint/js@8.56.0': {}
'@eslint/js@8.57.1': {}
'@eslint/js@9.12.0': {}
'@eslint/object-schema@2.1.4': {}
'@eslint/js@9.35.0': {}
'@eslint/object-schema@2.1.6': {}
'@eslint/plugin-kit@0.2.0':
dependencies:
levn: 0.4.1
'@eslint/plugin-kit@0.3.5':
dependencies:
'@eslint/core': 0.15.2
levn: 0.4.1
'@fastify/busboy@2.0.0': {}
'@firebase/analytics-types@0.3.1': {}
......@@ -18990,20 +19061,12 @@ snapshots:
dependencies:
'@hapi/hoek': 9.3.0
'@humanfs/core@0.19.0': {}
'@humanfs/core@0.19.1': {}
'@humanfs/node@0.16.5':
'@humanfs/node@0.16.7':
dependencies:
'@humanfs/core': 0.19.0
'@humanwhocodes/retry': 0.3.1
'@humanwhocodes/config-array@0.11.14':
dependencies:
'@humanwhocodes/object-schema': 2.0.3
debug: 4.4.0
minimatch: 3.1.2
transitivePeerDependencies:
- supports-color
'@humanfs/core': 0.19.1
'@humanwhocodes/retry': 0.4.3
'@humanwhocodes/config-array@0.13.0':
dependencies:
......@@ -19029,6 +19092,8 @@ snapshots:
'@humanwhocodes/retry@0.3.1': {}
'@humanwhocodes/retry@0.4.3': {}
'@img/sharp-darwin-arm64@0.34.3':
optionalDependencies:
'@img/sharp-libvips-darwin-arm64': 1.2.0
......@@ -21468,10 +21533,10 @@ snapshots:
'@types/eslint-scope@3.7.7':
dependencies:
'@types/eslint': 7.28.0
'@types/eslint': 9.6.1
'@types/estree': 1.0.7
'@types/eslint@7.28.0':
'@types/eslint@9.6.1':
dependencies:
'@types/estree': 1.0.7
'@types/json-schema': 7.0.15
......@@ -22332,6 +22397,10 @@ snapshots:
dependencies:
acorn: 8.14.0
acorn-jsx@5.3.2(acorn@8.15.0):
dependencies:
acorn: 8.15.0
acorn-loose@8.3.0:
dependencies:
acorn: 8.14.0
......@@ -22352,6 +22421,8 @@ snapshots:
acorn@8.14.0: {}
acorn@8.15.0: {}
acorn@8.5.0: {}
acorn@8.8.0: {}
......@@ -25632,7 +25703,7 @@ snapshots:
esrecurse: 4.3.0
estraverse: 5.3.0
eslint-scope@8.1.0:
eslint-scope@8.4.0:
dependencies:
esrecurse: 4.3.0
estraverse: 5.3.0
......@@ -25699,13 +25770,13 @@ snapshots:
transitivePeerDependencies:
- supports-color
eslint@8.56.0:
eslint@8.57.1:
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0)
'@eslint-community/eslint-utils': 4.4.0(eslint@9.12.0)
'@eslint-community/regexpp': 4.11.1
'@eslint/eslintrc': 2.1.4
'@eslint/js': 8.56.0
'@humanwhocodes/config-array': 0.11.14
'@eslint/js': 8.57.1
'@humanwhocodes/config-array': 0.13.0
'@humanwhocodes/module-importer': 1.0.1
'@nodelib/fs.walk': 1.2.8
'@ungap/structured-clone': 1.2.0
......@@ -25742,71 +25813,69 @@ snapshots:
transitivePeerDependencies:
- supports-color
eslint@8.57.1:
eslint@9.12.0:
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@9.12.0)
'@eslint-community/regexpp': 4.11.1
'@eslint/eslintrc': 2.1.4
'@eslint/js': 8.57.1
'@humanwhocodes/config-array': 0.13.0
'@eslint-community/eslint-utils': 4.9.0(eslint@9.12.0)
'@eslint-community/regexpp': 4.12.1
'@eslint/config-array': 0.18.0
'@eslint/core': 0.6.0
'@eslint/eslintrc': 3.3.1
'@eslint/js': 9.12.0
'@eslint/plugin-kit': 0.2.0
'@humanfs/node': 0.16.7
'@humanwhocodes/module-importer': 1.0.1
'@nodelib/fs.walk': 1.2.8
'@ungap/structured-clone': 1.2.0
'@humanwhocodes/retry': 0.3.1
'@types/estree': 1.0.7
'@types/json-schema': 7.0.15
ajv: 6.12.6
chalk: 4.1.2
cross-spawn: 7.0.3
debug: 4.3.7
doctrine: 3.0.0
debug: 4.4.0
escape-string-regexp: 4.0.0
eslint-scope: 7.2.2
eslint-visitor-keys: 3.4.3
espree: 9.6.1
eslint-scope: 8.4.0
eslint-visitor-keys: 4.2.1
espree: 10.4.0
esquery: 1.6.0
esutils: 2.0.3
fast-deep-equal: 3.1.3
file-entry-cache: 6.0.1
file-entry-cache: 8.0.0
find-up: 5.0.0
glob-parent: 6.0.2
globals: 13.24.0
graphemer: 1.4.0
ignore: 5.3.2
imurmurhash: 0.1.4
is-glob: 4.0.3
is-path-inside: 3.0.3
js-yaml: 4.1.0
json-stable-stringify-without-jsonify: 1.0.1
levn: 0.4.1
lodash.merge: 4.6.2
minimatch: 3.1.2
natural-compare: 1.4.0
optionator: 0.9.4
strip-ansi: 6.0.1
text-table: 0.2.0
transitivePeerDependencies:
- supports-color
eslint@9.12.0:
dependencies:
'@eslint-community/eslint-utils': 4.7.0(eslint@9.12.0)
'@eslint-community/regexpp': 4.11.1
'@eslint/config-array': 0.18.0
'@eslint/core': 0.6.0
'@eslint/eslintrc': 3.1.0
'@eslint/js': 9.12.0
'@eslint/plugin-kit': 0.2.0
'@humanfs/node': 0.16.5
eslint@9.35.0:
dependencies:
'@eslint-community/eslint-utils': 4.9.0(eslint@9.35.0)
'@eslint-community/regexpp': 4.12.1
'@eslint/config-array': 0.21.0
'@eslint/config-helpers': 0.3.1
'@eslint/core': 0.15.2
'@eslint/eslintrc': 3.3.1
'@eslint/js': 9.35.0
'@eslint/plugin-kit': 0.3.5
'@humanfs/node': 0.16.7
'@humanwhocodes/module-importer': 1.0.1
'@humanwhocodes/retry': 0.3.1
'@humanwhocodes/retry': 0.4.3
'@types/estree': 1.0.7
'@types/json-schema': 7.0.15
ajv: 6.12.6
chalk: 4.1.2
cross-spawn: 7.0.3
cross-spawn: 7.0.6
debug: 4.4.0
escape-string-regexp: 4.0.0
eslint-scope: 8.1.0
eslint-scope: 8.4.0
eslint-visitor-keys: 4.2.1
espree: 10.2.0
espree: 10.4.0
esquery: 1.6.0
esutils: 2.0.3
fast-deep-equal: 3.1.3
......@@ -25821,14 +25890,13 @@ snapshots:
minimatch: 3.1.2
natural-compare: 1.4.0
optionator: 0.9.4
text-table: 0.2.0
transitivePeerDependencies:
- supports-color
espree@10.2.0:
espree@10.4.0:
dependencies:
acorn: 8.14.0
acorn-jsx: 5.3.2(acorn@8.14.0)
acorn: 8.15.0
acorn-jsx: 5.3.2(acorn@8.15.0)
eslint-visitor-keys: 4.2.1
espree@7.3.1:
{
"extends": "plugin:@next/next/core-web-vitals",
"extends": "plugin:@next/next/core-web-vitals-legacy",
"root": true,
"parserOptions": {
"sourceType": "module",
......
{
"extends": "plugin:@next/next/recommended",
"extends": "plugin:@next/next/recommended-legacy",
"root": true,
"parserOptions": {
"sourceType": "module",
......
......@@ -14,6 +14,36 @@ describe('@next/eslint-plugin-next index', () => {
expect(index.rules).toContainAllKeys(rules)
})
it('should have meta information', () => {
expect(index.meta).toBeDefined()
expect(index.meta.name).toBe('@next/eslint-plugin-next')
})
it('should have proper flat config structure for recommended', () => {
const config = index.configs.recommended
expect(config.name).toBe('next/recommended')
expect(config.rules).toBeDefined()
})
it('should have proper flat config structure for core-web-vitals', () => {
const config = index.configs['core-web-vitals']
expect(config.name).toBe('next/core-web-vitals')
expect(config.rules).toBeDefined()
})
it('should have legacy recommended config', () => {
const config = index.configs['recommended-legacy']
expect(config.plugins).toContain('@next/next')
expect(config.rules).toBeDefined()
})
it('should have legacy core-web-vitals config', () => {
const config = index.configs['core-web-vitals-legacy']
expect(config.plugins).toContain('@next/next')
expect(config.extends).toContain('plugin:@next/next/recommended-legacy')
expect(config.rules).toBeDefined()
})
rulePaths.forEach((rulePath) => {
let rule = require(rulePath)
rule = rule.default ?? rule
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment