1
- module . exports = {
1
+ const recommendedRules = {
2
+ // warnings
3
+ '@next/next/google-font-display' : 'warn' ,
4
+ '@next/next/google-font-preconnect' : 'warn' ,
5
+ '@next/next/next-script-for-ga' : 'warn' ,
6
+ '@next/next/no-async-client-component' : 'warn' ,
7
+ '@next/next/no-before-interactive-script-outside-document' : 'warn' ,
8
+ '@next/next/no-css-tags' : 'warn' ,
9
+ '@next/next/no-head-element' : 'warn' ,
10
+ '@next/next/no-html-link-for-pages' : 'warn' ,
11
+ '@next/next/no-img-element' : 'warn' ,
12
+ '@next/next/no-page-custom-font' : 'warn' ,
13
+ '@next/next/no-styled-jsx-in-document' : 'warn' ,
14
+ '@next/next/no-sync-scripts' : 'warn' ,
15
+ '@next/next/no-title-in-document-head' : 'warn' ,
16
+ '@next/next/no-typos' : 'warn' ,
17
+ '@next/next/no-unwanted-polyfillio' : 'warn' ,
18
+ // errors
19
+ '@next/next/inline-script-id' : 'error' ,
20
+ '@next/next/no-assign-module-variable' : 'error' ,
21
+ '@next/next/no-document-import-in-page' : 'error' ,
22
+ '@next/next/no-duplicate-head' : 'error' ,
23
+ '@next/next/no-head-import-in-document' : 'error' ,
24
+ '@next/next/no-script-component-in-head' : 'error' ,
25
+ }
26
+
27
+ const coreWebVitalsRules = {
28
+ '@next/next/no-html-link-for-pages' : 'error' ,
29
+ '@next/next/no-sync-scripts' : 'error' ,
30
+ }
31
+
32
+ const plugin = {
2
33
rules : {
3
34
'google-font-display' : require ( './rules/google-font-display' ) ,
4
35
'google-font-preconnect' : require ( './rules/google-font-preconnect' ) ,
@@ -25,39 +56,33 @@ module.exports = {
25
56
configs : {
26
57
recommended : {
27
58
plugins : [ '@next/next' ] ,
28
- rules : {
29
- // warnings
30
- '@next/next/google-font-display' : 'warn' ,
31
- '@next/next/google-font-preconnect' : 'warn' ,
32
- '@next/next/next-script-for-ga' : 'warn' ,
33
- '@next/next/no-async-client-component' : 'warn' ,
34
- '@next/next/no-before-interactive-script-outside-document' : 'warn' ,
35
- '@next/next/no-css-tags' : 'warn' ,
36
- '@next/next/no-head-element' : 'warn' ,
37
- '@next/next/no-html-link-for-pages' : 'warn' ,
38
- '@next/next/no-img-element' : 'warn' ,
39
- '@next/next/no-page-custom-font' : 'warn' ,
40
- '@next/next/no-styled-jsx-in-document' : 'warn' ,
41
- '@next/next/no-sync-scripts' : 'warn' ,
42
- '@next/next/no-title-in-document-head' : 'warn' ,
43
- '@next/next/no-typos' : 'warn' ,
44
- '@next/next/no-unwanted-polyfillio' : 'warn' ,
45
- // errors
46
- '@next/next/inline-script-id' : 'error' ,
47
- '@next/next/no-assign-module-variable' : 'error' ,
48
- '@next/next/no-document-import-in-page' : 'error' ,
49
- '@next/next/no-duplicate-head' : 'error' ,
50
- '@next/next/no-head-import-in-document' : 'error' ,
51
- '@next/next/no-script-component-in-head' : 'error' ,
52
- } ,
59
+ rules : recommendedRules ,
53
60
} ,
54
61
'core-web-vitals' : {
55
62
plugins : [ '@next/next' ] ,
56
63
extends : [ 'plugin:@next/next/recommended' ] ,
57
- rules : {
58
- '@next/next/no-html-link-for-pages' : 'error' ,
59
- '@next/next/no-sync-scripts' : 'error' ,
60
- } ,
64
+ rules : coreWebVitalsRules ,
65
+ } ,
66
+ } ,
67
+ }
68
+
69
+ module . exports = plugin
70
+ module . exports . flatConfig = {
71
+ recommended : {
72
+ name : 'next/recommended' ,
73
+ plugins : {
74
+ '@next/next' : plugin ,
75
+ } ,
76
+ rules : recommendedRules ,
77
+ } ,
78
+ coreWebVitals : {
79
+ name : 'next/core-web-vitals' ,
80
+ plugins : {
81
+ '@next/next' : plugin ,
82
+ } ,
83
+ rules : {
84
+ ...recommendedRules ,
85
+ ...coreWebVitalsRules ,
61
86
} ,
62
87
} ,
63
88
}
0 commit comments