Skip to content

Commit 74f5d6d

Browse files
authored
Fix: always initialize ExportDeclaration attributes (#17164)
* chore: bump eslint and espree * fix: always initialize ExportDeclaration attributes * update AST fixtures * fix: initialize attributes when importAssertions is not enabled * update AST fixtures * update test snapshot * update Makefile.js * update Babel 8 AST fixtures
1 parent fb1e134 commit 74f5d6d

235 files changed

Lines changed: 566 additions & 214 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint/babel-eslint-parser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@types/estree": "^1.0.5",
5050
"@typescript-eslint/scope-manager": "^6.19.0",
5151
"dedent": "^1.5.3",
52-
"eslint": "^9.7.0"
52+
"eslint": "^9.21.0"
5353
},
5454
"conditions": {
5555
"BABEL_8_BREAKING": [

eslint/babel-eslint-plugin-development-internal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"eslint": ">=7.5.0"
2121
},
2222
"devDependencies": {
23-
"eslint": "^9.7.0"
23+
"eslint": "^9.21.0"
2424
},
2525
"type": "module"
2626
}

eslint/babel-eslint-plugin-development/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
"homepage": "https://babel.dev/",
3333
"devDependencies": {
34-
"eslint": "^9.7.0"
34+
"eslint": "^9.21.0"
3535
},
3636
"conditions": {
3737
"BABEL_8_BREAKING": [

eslint/babel-eslint-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
},
4646
"devDependencies": {
4747
"clone-deep": "^4.0.1",
48-
"eslint": "^9.7.0"
48+
"eslint": "^9.21.0"
4949
},
5050
"conditions": {
5151
"BABEL_8_BREAKING": [

eslint/babel-eslint-shared-fixtures/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@babel/preset-env": "workspace:^",
1717
"@babel/preset-flow": "workspace:^",
1818
"@babel/preset-react": "workspace:^",
19-
"eslint": "^9.7.0"
19+
"eslint": "^9.21.0"
2020
},
2121
"type": "commonjs"
2222
}

eslint/babel-eslint-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@babel/preset-flow": "workspace:^",
1010
"@babel/preset-react": "workspace:^",
1111
"dedent": "^1.5.3",
12-
"eslint": "^9.7.0",
12+
"eslint": "^9.21.0",
1313
"eslint-plugin-import": "^2.31.0",
1414
"globals": "^15.9.0",
1515
"npm-babel-parser": "npm:@babel/parser@^7.14.0"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"c8": "^10.0.0",
5252
"charcodes": "^0.2.0",
5353
"core-js": "^3.36.1",
54-
"eslint": "^9.12.0",
54+
"eslint": "^9.21.0",
5555
"eslint-config-prettier": "^9.1.0",
5656
"eslint-formatter-codeframe": "^7.32.1",
5757
"eslint-import-resolver-node": "^0.3.9",

packages/babel-parser/src/parser/statement.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2478,13 +2478,13 @@ export default abstract class StatementParser extends ExpressionParser {
24782478
if (!node2.specifiers) node2.specifiers = [];
24792479
const isTypeExport = node2.exportKind === "type";
24802480
node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport));
2481-
24822481
node2.source = null;
2483-
node2.declaration = null;
24842482
if (!process.env.BABEL_8_BREAKING && this.hasPlugin("importAssertions")) {
24852483
node2.assertions = [];
2484+
} else {
2485+
node2.attributes = [];
24862486
}
2487-
2487+
node2.declaration = null;
24882488
return true;
24892489
}
24902490
return false;
@@ -2499,6 +2499,8 @@ export default abstract class StatementParser extends ExpressionParser {
24992499
node.source = null;
25002500
if (!process.env.BABEL_8_BREAKING && this.hasPlugin("importAssertions")) {
25012501
node.assertions = [];
2502+
} else {
2503+
node.attributes = [];
25022504
}
25032505
node.declaration = this.parseExportDeclaration(node);
25042506
return true;

packages/babel-parser/test/fixtures/comments/decorators/decorators-after-export/output.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"start":8,"end":86,"loc":{"start":{"line":1,"column":8,"index":8},"end":{"line":2,"column":43,"index":86}},
1313
"specifiers": [],
1414
"source": null,
15+
"attributes": [],
1516
"declaration": {
1617
"type": "ClassDeclaration",
1718
"start":23,"end":86,"loc":{"start":{"line":1,"column":23,"index":23},"end":{"line":2,"column":43,"index":86}},

0 commit comments

Comments
 (0)