@@ -11,7 +11,7 @@ use oxc_span::Span;
1111use crate :: {
1212 context:: LintContext ,
1313 rule:: Rule ,
14- utils:: { find_url_query_value, get_next_script_import_local_name} ,
14+ utils:: { NEXT_POLYFILLED_FEATURES , find_url_query_value, get_next_script_import_local_name} ,
1515} ;
1616
1717fn no_unwanted_polyfillio_diagnostic ( polyfill_name : & str , span : Span ) -> OxcDiagnostic {
@@ -47,73 +47,6 @@ declare_oxc_lint!(
4747 correctness
4848) ;
4949
50- // Keep in sync with next.js polyfills file : https://github.com/vercel/next.js/blob/v15.0.2/packages/next-polyfill-nomodule/src/index.js
51- const NEXT_POLYFILLED_FEATURES : phf:: Set < & ' static str > = phf:: phf_set![
52- "Array.from" ,
53- "Array.of" ,
54- "Array.prototype.@@iterator" ,
55- "Array.prototype.at" ,
56- "Array.prototype.copyWithin" ,
57- "Array.prototype.fill" ,
58- "Array.prototype.find" ,
59- "Array.prototype.findIndex" ,
60- "Array.prototype.flat" ,
61- "Array.prototype.flatMap" ,
62- "Array.prototype.includes" ,
63- "Function.prototype.name" ,
64- "Map" ,
65- "Number.EPSILON" ,
66- "Number.Epsilon" ,
67- "Number.MAX_SAFE_INTEGER" ,
68- "Number.MIN_SAFE_INTEGER" ,
69- "Number.isFinite" ,
70- "Number.isInteger" ,
71- "Number.isNaN" ,
72- "Number.isSafeInteger" ,
73- "Number.parseFloat" ,
74- "Number.parseInt" ,
75- "Object.assign" ,
76- "Object.entries" ,
77- "Object.fromEntries" ,
78- "Object.getOwnPropertyDescriptor" ,
79- "Object.getOwnPropertyDescriptors" ,
80- "Object.is" ,
81- "Object.keys" ,
82- "Object.values" ,
83- "Promise" ,
84- "Promise.prototype.finally" ,
85- "Reflect" ,
86- "Set" ,
87- "String.fromCodePoint" ,
88- "String.prototype.@@iterator" ,
89- "String.prototype.codePointAt" ,
90- "String.prototype.endsWith" ,
91- "String.prototype.includes" ,
92- "String.prototype.padEnd" ,
93- "String.prototype.padStart" ,
94- "String.prototype.repeat" ,
95- "String.prototype.startsWith" ,
96- "String.prototype.trimEnd" ,
97- "String.prototype.trimStart" ,
98- "String.raw" ,
99- "Symbol" ,
100- "Symbol.asyncIterator" ,
101- "URL" ,
102- "URL.prototype.toJSON" ,
103- "URLSearchParams" ,
104- "WeakMap" ,
105- "WeakSet" ,
106- "es2015" , // Should be covered by babel-preset-env instead.
107- "es2016" , // contains polyfilled 'Array.prototype.includes', 'String.prototype.padEnd' and 'String.prototype.padStart'
108- "es2017" , // contains polyfilled 'Object.entries', 'Object.getOwnPropertyDescriptors', 'Object.values', 'String.prototype.padEnd' and 'String.prototype.padStart'
109- "es2018" , // contains polyfilled 'Promise.prototype.finally' and ''Symbol.asyncIterator'
110- "es2019" , // Contains polyfilled 'Object.fromEntries' and polyfilled 'Array.prototype.flat', 'Array.prototype.flatMap', 'String.prototype.trimEnd' and 'String.prototype.trimStart'
111- "es5" , // Should be covered by babel-preset-env instead.
112- "es6" , // Should be covered by babel-preset-env instead.
113- "es7" , // contains polyfilled 'Array.prototype.includes', 'String.prototype.padEnd' and 'String.prototype.padStart'];
114- "fetch" ,
115- ] ;
116-
11750impl Rule for NoUnwantedPolyfillio {
11851 fn run < ' a > ( & self , node : & AstNode < ' a > , ctx : & LintContext < ' a > ) {
11952 let AstKind :: JSXOpeningElement ( jsx_el) = node. kind ( ) else {
0 commit comments