Skip to content

Commit

Permalink
- bugfix - fix issue jslint-org#316, jslint-org#317 - jslint complain…
Browse files Browse the repository at this point in the history
…s about dynamic-import.

- bugfix - fix off-by-one-column bug in missing-semicolon-warning.
  • Loading branch information
kaizhu256 committed Jun 8, 2021
1 parent 3a1982c commit 4e2ca9a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -19,6 +19,8 @@

## v2021.6.4-beta
- bugfix - fix cli appending slash "/" to normalized filename.
- bugfix - fix issue #316, #317 - jslint complains about dynamic-import.
- bugfix - fix off-by-one-column bug in missing-semicolon-warning.
- bugfix - fix try-catch-block complaining about "Unexpected await" inside async-function.
- directive - re-introduce `/*jslint name*/` to ignore "Bad property name" warning.
- jslint - add warning for unexpected ? in example `aa=/.{0}?/`.
Expand Down
37 changes: 13 additions & 24 deletions jslint.js
Expand Up @@ -1312,7 +1312,7 @@ function jslint(
warn_at(
"expected_a_b",
token_now.line,
token_now.thru,
token_now.thru + 1,
";",
artifact(token_nxt)
);
Expand Down Expand Up @@ -1366,7 +1366,14 @@ function jslint(
first = token_now;
first.statement = true;
the_symbol = syntax[first.id];
if (the_symbol !== undefined && the_symbol.fud !== undefined) {
if (
the_symbol !== undefined
&& the_symbol.fud !== undefined

// Fixes issues #316, #317 - dynamic-import().

&& !(the_symbol.id === "import" && token_nxt.id === "(")
) {
the_symbol.disrupt = false;
the_symbol.statement = true;
the_statement = the_symbol.fud();
Expand Down Expand Up @@ -3094,6 +3101,10 @@ function jslint(
// cause: "export default {}"

warn("freeze_exports", the_thing);


// Fixes issues #282 - optional-semicolon.

} else {

// cause: "export default Object.freeze({})"
Expand Down Expand Up @@ -3263,28 +3274,6 @@ function jslint(
});
stmt("import", function () {
const the_import = token_now;
if (token_nxt.id === "(") {
the_import.arity = "unary";
the_import.constant = true;
the_import.statement = false;
advance("(");
const string = expression(0);
if (string.id !== "(string)") {

// cause: "import(aa)"

warn("expected_string_a", string);
}
import_from_array.push(token_now.value);
advance(")");
advance(".");
advance("then");
advance("(");
the_import.expression = expression(0);
advance(")");
semicolon();
return the_import;
}
let name;
if (typeof mode_module === "object") {

Expand Down

0 comments on commit 4e2ca9a

Please sign in to comment.