@@ -53,36 +53,30 @@ const coreWebVitalsRules = {
5353 '@next/next/no-sync-scripts' : 'error' ,
5454} satisfies Linter . RulesRecord
5555
56- const plugin = {
57- meta : {
58- name : '@next/eslint-plugin-next' ,
59- } ,
60- rules : {
61- 'google-font-display' : googleFontDisplay ,
62- 'google-font-preconnect' : googleFontPreconnect ,
63- 'inline-script-id' : inlineScriptId ,
64- 'next-script-for-ga' : nextScriptForGa ,
65- 'no-assign-module-variable' : noAssignModuleVariable ,
66- 'no-async-client-component' : noAsyncClientComponent ,
67- 'no-before-interactive-script-outside-document' :
68- noBeforeInteractiveScriptOutsideDocument ,
69- 'no-css-tags' : noCssTags ,
70- 'no-document-import-in-page' : noDocumentImportInPage ,
71- 'no-duplicate-head' : noDuplicateHead ,
72- 'no-head-element' : noHeadElement ,
73- 'no-head-import-in-document' : noHeadImportInDocument ,
74- 'no-html-link-for-pages' : noHtmlLinkForPages ,
75- 'no-img-element' : noImgElement ,
76- 'no-page-custom-font' : noPageCustomFont ,
77- 'no-script-component-in-head' : noScriptComponentInHead ,
78- 'no-styled-jsx-in-document' : noStyledJsxInDocument ,
79- 'no-sync-scripts' : noSyncScripts ,
80- 'no-title-in-document-head' : noTitleInDocumentHead ,
81- 'no-typos' : noTypos ,
82- 'no-unwanted-polyfillio' : noUnwantedPolyfillio ,
83- } satisfies Record < string , Rule . RuleModule > ,
84- configs : { } as ESLintPluginConfigs ,
85- }
56+ const rules = {
57+ 'google-font-display' : googleFontDisplay ,
58+ 'google-font-preconnect' : googleFontPreconnect ,
59+ 'inline-script-id' : inlineScriptId ,
60+ 'next-script-for-ga' : nextScriptForGa ,
61+ 'no-assign-module-variable' : noAssignModuleVariable ,
62+ 'no-async-client-component' : noAsyncClientComponent ,
63+ 'no-before-interactive-script-outside-document' :
64+ noBeforeInteractiveScriptOutsideDocument ,
65+ 'no-css-tags' : noCssTags ,
66+ 'no-document-import-in-page' : noDocumentImportInPage ,
67+ 'no-duplicate-head' : noDuplicateHead ,
68+ 'no-head-element' : noHeadElement ,
69+ 'no-head-import-in-document' : noHeadImportInDocument ,
70+ 'no-html-link-for-pages' : noHtmlLinkForPages ,
71+ 'no-img-element' : noImgElement ,
72+ 'no-page-custom-font' : noPageCustomFont ,
73+ 'no-script-component-in-head' : noScriptComponentInHead ,
74+ 'no-styled-jsx-in-document' : noStyledJsxInDocument ,
75+ 'no-sync-scripts' : noSyncScripts ,
76+ 'no-title-in-document-head' : noTitleInDocumentHead ,
77+ 'no-typos' : noTypos ,
78+ 'no-unwanted-polyfillio' : noUnwantedPolyfillio ,
79+ } satisfies Record < string , Rule . RuleModule >
8680
8781type ESLintPluginConfigs = {
8882 'recommended-legacy' : Linter . LegacyConfig
@@ -91,7 +85,16 @@ type ESLintPluginConfigs = {
9185 'core-web-vitals' : Linter . Config
9286}
9387
94- Object . assign ( plugin . configs , {
88+ // Define plugin first with empty configs to be used in configs definition
89+ const plugin = {
90+ meta : {
91+ name : '@next/eslint-plugin-next' ,
92+ } ,
93+ rules,
94+ configs : { } as ESLintPluginConfigs ,
95+ }
96+
97+ const configs : ESLintPluginConfigs = {
9598 'recommended-legacy' : {
9699 plugins : [ '@next/next' ] ,
97100 rules : recommendedRules ,
@@ -118,7 +121,17 @@ Object.assign(plugin.configs, {
118121 ...coreWebVitalsRules ,
119122 } ,
120123 } ,
121- } satisfies ESLintPluginConfigs )
124+ }
125+
126+ // Assign configs to plugin
127+ Object . assign ( plugin . configs , configs )
128+
129+ export = plugin
130+
131+ // @ts -ignore
132+ exports . meta = plugin . meta
122133
123- export default plugin
124- export const { rules, configs } = plugin
134+ // @ts -ignore
135+ exports . rules = rules
136+ // @ts -ignore
137+ exports . configs = configs
0 commit comments