Skip to content

Commit 0b0c2aa

Browse files
committed
✨ Node.js 13 supports ES modules
1 parent 3102915 commit 0b0c2aa

File tree

2 files changed

+58
-8
lines changed

2 files changed

+58
-8
lines changed

lib/rules/no-unsupported-features/es-syntax.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const features = {
125125
ruleId: "no-modules",
126126
cases: [
127127
{
128-
supported: null,
128+
supported: "13.2.0",
129129
messageId: "no-modules",
130130
},
131131
],
@@ -368,7 +368,7 @@ const features = {
368368
ruleId: "no-dynamic-import",
369369
cases: [
370370
{
371-
supported: null,
371+
supported: "13.2.0",
372372
messageId: "no-dynamic-import",
373373
},
374374
],
@@ -546,7 +546,7 @@ module.exports = {
546546
"no-generators":
547547
"Generator functions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
548548
"no-modules":
549-
"Import and export declarations are not supported yet.",
549+
"Import and export declarations are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
550550
"no-new-target":
551551
"'new.target' is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.",
552552
"no-object-super-properties":

tests/lib/rules/no-unsupported-features/es-syntax.js

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,46 @@ ruleTester.run(
841841
code: "exports.a = {}",
842842
options: [{ version: "0.0.0" }],
843843
},
844+
{
845+
code: "import a from 'a'",
846+
parserOptions: { sourceType: "module" },
847+
options: [{ version: "13.1.0", ignores: ["modules"] }],
848+
},
849+
{
850+
code: "export default {}",
851+
parserOptions: { sourceType: "module" },
852+
options: [{ version: "13.1.0", ignores: ["modules"] }],
853+
},
854+
{
855+
code: "export const a = {}",
856+
parserOptions: { sourceType: "module" },
857+
options: [{ version: "13.1.0", ignores: ["modules"] }],
858+
},
859+
{
860+
code: "export {}",
861+
parserOptions: { sourceType: "module" },
862+
options: [{ version: "13.1.0", ignores: ["modules"] }],
863+
},
864+
{
865+
code: "import a from 'a'",
866+
parserOptions: { sourceType: "module" },
867+
options: [{ version: "13.2.0" }],
868+
},
869+
{
870+
code: "export default {}",
871+
parserOptions: { sourceType: "module" },
872+
options: [{ version: "13.2.0" }],
873+
},
874+
{
875+
code: "export const a = {}",
876+
parserOptions: { sourceType: "module" },
877+
options: [{ version: "13.2.0" }],
878+
},
879+
{
880+
code: "export {}",
881+
parserOptions: { sourceType: "module" },
882+
options: [{ version: "13.2.0" }],
883+
},
844884
],
845885
invalid: [
846886
{
@@ -850,7 +890,7 @@ ruleTester.run(
850890
errors: [
851891
{
852892
messageId: "no-modules",
853-
data: { version: "10.0.0" },
893+
data: { supported: "13.2.0", version: "10.0.0" },
854894
},
855895
],
856896
},
@@ -861,7 +901,7 @@ ruleTester.run(
861901
errors: [
862902
{
863903
messageId: "no-modules",
864-
data: { version: "10.0.0" },
904+
data: { supported: "13.2.0", version: "10.0.0" },
865905
},
866906
],
867907
},
@@ -872,7 +912,7 @@ ruleTester.run(
872912
errors: [
873913
{
874914
messageId: "no-modules",
875-
data: { version: "10.0.0" },
915+
data: { supported: "13.2.0", version: "10.0.0" },
876916
},
877917
],
878918
},
@@ -883,7 +923,7 @@ ruleTester.run(
883923
errors: [
884924
{
885925
messageId: "no-modules",
886-
data: { version: "10.0.0" },
926+
data: { supported: "13.2.0", version: "10.0.0" },
887927
},
888928
],
889929
},
@@ -2435,6 +2475,16 @@ ruleTester.run(
24352475
code: "obj.import(source)",
24362476
options: [{ version: "12.0.0" }],
24372477
},
2478+
{
2479+
code: "import(source)",
2480+
options: [
2481+
{ version: "13.1.0", ignores: ["dynamicImport"] },
2482+
],
2483+
},
2484+
{
2485+
code: "import(source)",
2486+
options: [{ version: "13.2.0" }],
2487+
},
24382488
],
24392489
invalid: [
24402490
{
@@ -2444,7 +2494,7 @@ ruleTester.run(
24442494
{
24452495
messageId: "no-dynamic-import",
24462496
data: {
2447-
supported: null,
2497+
supported: "13.2.0",
24482498
version: "12.0.0",
24492499
},
24502500
},

0 commit comments

Comments
 (0)