test(linter): add regression tests for import/namespace (#7723)

Related to #7696
This commit is contained in:
dalaoshu 2024-12-08 15:35:14 +08:00 committed by GitHub
parent 37709cec18
commit 02f9903211
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1 @@
export declare function parse(): void;

View file

@ -0,0 +1 @@
export function parse(): void;

View file

@ -0,0 +1,8 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.acorn = {}));
})(this, (function (exports) {
'use strict';
exports.parse = () => {}
}))

View file

@ -0,0 +1,5 @@
function parse() {
return void 0
}
export { parse }

View file

@ -0,0 +1,17 @@
{
"name": "acorn",
"version": "1.0.0",
"main": "./acorn.js",
"types": "./acorn.d.ts",
"module": "./acorn.mjs",
"exports": {
".": [
{
"import": "./acorn.mjs",
"require": "./acorn.js",
"default": "./acorn.js"
},
"./acorn.js"
]
}
}

View file

@ -9,6 +9,7 @@
},
"dependencies": {
"@org/package": "^1.0.0",
"acorn": "^1.0.0",
"esm-package": "^1.0.0",
"jquery": "^3.1.0",
"lodash.cond": "^4.3.0",

View file

@ -477,6 +477,8 @@ fn test() {
(r#"import * as a from "./deep-es7/a"; var {b:{c:{d:{e}}}} = a"#, None),
(r#"import { b } from "./deep-es7/a"; var {c:{d:{e}}} = b"#, None),
(r"import { a } from './oxc/indirect-export'; console.log(a.nothing)", None),
// Issue: <https://github.com/oxc-project/oxc/issues/7696>
(r"import * as acorn from 'acorn'; acorn.parse()", None),
];
let fail = vec![