Skip to content

Commit b4b4a94

Browse files
feat(babel): upgrade and set newer browser targets (#6422)
* feat(babel): upgrade and set newer browser targets * fix @babel/traverse security issue * remove unused babel plugin * dedupe lockfile * add babel to vue-instantsearch * exclude helper docs from eslint rule --------- Co-authored-by: Haroen Viaene <[email protected]>
1 parent 8f9f827 commit b4b4a94

File tree

22 files changed

+1577
-1301
lines changed

22 files changed

+1577
-1301
lines changed

.eslintrc.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,21 +215,11 @@ const config = {
215215
rules: {
216216
'no-restricted-syntax': [
217217
'error',
218-
{
219-
selector: '[async=true]',
220-
message:
221-
'The polyfill for async/await is very large, which is why we use promise chains',
222-
},
223218
{
224219
selector: 'ForInStatement',
225220
message:
226221
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
227222
},
228-
{
229-
selector: 'ForOfStatement',
230-
message:
231-
'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
232-
},
233223
{
234224
selector: 'LabeledStatement',
235225
message:
@@ -243,6 +233,23 @@ const config = {
243233
],
244234
},
245235
},
236+
{
237+
files: 'packages/**/*',
238+
excludedFiles: [
239+
'*.test.*',
240+
'**/__tests__/**',
241+
'**/stories/**',
242+
'packages/algoliasearch-helper/documentation-src/**',
243+
],
244+
plugins: ['compat'],
245+
extends: ['plugin:compat/recommended'],
246+
env: {
247+
browser: true,
248+
},
249+
settings: {
250+
lintAllEsApis: true,
251+
},
252+
},
246253
// Disable stricter rules introduced for the next versions of the libraries.
247254
{
248255
files: [

babel.config.js

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = (api) => {
1818
if (isTest) {
1919
targets.node = true;
2020
} else {
21-
targets.browsers = ['last 2 versions', 'ie >= 9'];
21+
targets.browsers = require('./package.json').browserslist;
2222
}
2323

2424
const testPlugins = [
@@ -61,46 +61,6 @@ module.exports = (api) => {
6161
],
6262
},
6363
],
64-
// this plugin is used to test if we need polyfills, not to actually insert them
65-
// only UMD, since cjs & esm have false positives due to imports
66-
isUMD && [
67-
'polyfill-es-shims',
68-
{
69-
method: 'usage-global',
70-
targets: {
71-
ie: 11,
72-
},
73-
shouldInjectPolyfill(name, defaultShouldInject) {
74-
const exclude = [
75-
// false positives (we access these from objects only)
76-
'Array.prototype.item',
77-
'String.prototype.item',
78-
'Array.prototype.values',
79-
'Function.prototype.name',
80-
81-
// we require polyfills for this already
82-
'Array.prototype.includes',
83-
84-
// false positive (babel doesn't know types)
85-
// this is actually only called on arrays
86-
'String.prototype.includes',
87-
88-
// false positive (spread)
89-
'Object.getOwnPropertyDescriptors',
90-
91-
// @TODO: see when we remove IE11 support
92-
'Object.fromEntries',
93-
'Object.entries',
94-
];
95-
if (defaultShouldInject && !exclude.includes(name)) {
96-
throw new Error(
97-
`Usage of a builtin which isn't allowed to be polyfilled: ${name}`
98-
);
99-
}
100-
return false;
101-
},
102-
},
103-
],
10464
]);
10565

10666
return {

examples/js/algolia-experiences/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"instantsearch.css": "8.5.1"
1414
},
1515
"devDependencies": {
16-
"@babel/core": "7.15.5",
16+
"@babel/core": "7.25.9",
1717
"@parcel/core": "2.10.0",
1818
"@parcel/packager-raw-url": "2.10.0",
1919
"@parcel/transformer-webmanifest": "2.10.0",

examples/js/calendar-widget/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"instantsearch.js": "4.77.0"
1414
},
1515
"devDependencies": {
16-
"@babel/core": "7.15.5",
16+
"@babel/core": "7.25.9",
1717
"@parcel/packager-raw-url": "2.10.0",
1818
"@parcel/transformer-webmanifest": "2.10.0",
1919
"parcel": "2.10.0"

examples/js/e-commerce-umd/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"instantsearch.js": "4.77.0"
1515
},
1616
"devDependencies": {
17-
"@babel/core": "7.15.5",
17+
"@babel/core": "7.25.9",
1818
"@parcel/core": "2.10.0",
1919
"@parcel/packager-raw-url": "2.10.0",
2020
"@parcel/transformer-webmanifest": "2.10.0",

examples/js/e-commerce/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"instantsearch.js": "4.77.0"
1515
},
1616
"devDependencies": {
17-
"@babel/core": "7.15.5",
17+
"@babel/core": "7.25.9",
1818
"@parcel/core": "2.10.0",
1919
"@parcel/packager-raw-url": "2.10.0",
2020
"@parcel/transformer-webmanifest": "2.10.0",

examples/js/getting-started/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"instantsearch.js": "4.77.0"
1515
},
1616
"devDependencies": {
17-
"@babel/core": "7.15.5",
17+
"@babel/core": "7.25.9",
1818
"@parcel/core": "2.10.0",
1919
"@parcel/packager-raw-url": "2.10.0",
2020
"@parcel/transformer-webmanifest": "2.10.0",

examples/js/media/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"instantsearch.js": "4.77.0"
1616
},
1717
"devDependencies": {
18-
"@babel/core": "7.15.5",
18+
"@babel/core": "7.25.9",
1919
"@parcel/core": "2.10.0",
2020
"@parcel/packager-raw-url": "2.10.0",
2121
"@parcel/transformer-webmanifest": "2.10.0",

examples/js/tourism/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"instantsearch.js": "4.77.0"
1414
},
1515
"devDependencies": {
16-
"@babel/core": "7.15.5",
16+
"@babel/core": "7.25.9",
1717
"@parcel/core": "2.10.0",
1818
"@parcel/packager-raw-url": "2.10.0",
1919
"@parcel/transformer-webmanifest": "2.10.0",

examples/react/react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"react-native-web": "0.17.1"
2222
},
2323
"devDependencies": {
24-
"@babel/core": "7.15.5",
24+
"@babel/core": "7.25.9",
2525
"@types/react": "~17.0.21",
2626
"@types/react-native": "~0.64.12",
2727
"expo-cli": "5.1.1",

0 commit comments

Comments
 (0)