eslint-plugin-import-next 2.3.12 → 2.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  <p align="center">
2
- <a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-import-next" target="blank"><img src="https://eslint.interlace.tools/icon-light.svg" alt="Interlace" height="90" /></a>
2
+ <a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-import-next" target="blank"><img src="https://eslint.interlace.tools/logos/interlace.svg" alt="Interlace" height="90" /></a>
3
3
  &nbsp;&nbsp;
4
- <a href="https://eslint.org" target="_blank"><img src="https://eslint.interlace.tools/eslint-logo.svg" alt="ESLint" height="90" /></a>
4
+ <a href="https://oxc.rs" target="_blank"><img src="https://eslint.interlace.tools/logos/oxlint.svg" alt="oxlint" height="90" /></a>
5
+ &nbsp;&nbsp;
6
+ <a href="https://eslint.org" target="_blank"><img src="https://eslint.interlace.tools/logos/eslint.svg" alt="ESLint" height="90" /></a>
5
7
  </p>
6
8
 
7
9
  <p align="center">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-import-next",
3
- "version": "2.3.12",
3
+ "version": "2.3.14",
4
4
  "description": "ESLint plugin for imports and module boundaries — drop-in replacement for eslint-plugin-import, 3.1x faster end-to-end, zero-config migration.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -118,7 +118,7 @@ exports.rules = {
118
118
  exports.plugin = {
119
119
  meta: {
120
120
  name: 'eslint-plugin-import-next',
121
- version: '2.3.12',
121
+ version: '2.3.14',
122
122
  },
123
123
  rules: exports.rules,
124
124
  };
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultRule = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const eslint_devkit_1 = require("@interlace/eslint-devkit");
6
5
  const eslint_devkit_2 = require("@interlace/eslint-devkit");
7
- const typescript_1 = tslib_1.__importDefault(require("typescript"));
6
+ const typescript_peer_1 = require("../utils/typescript-peer");
8
7
  exports.defaultRule = (0, eslint_devkit_1.createRule)({
9
8
  name: 'default',
10
9
  meta: {
@@ -41,8 +40,10 @@ exports.defaultRule = (0, eslint_devkit_1.createRule)({
41
40
  const moduleNode = services.esTreeNodeToTSNodeMap.get(node.parent.source);
42
41
  const moduleSymbol = checker?.getSymbolAtLocation?.(moduleNode);
43
42
  if (moduleSymbol && !symbol) {
44
- if (moduleSymbol.exports &&
45
- !moduleSymbol.exports.has(typescript_1.default.InternalSymbolName.Default)) {
43
+ const tsModule = (0, typescript_peer_1.loadTypeScript)();
44
+ if (tsModule &&
45
+ moduleSymbol.exports &&
46
+ !moduleSymbol.exports.has(tsModule.InternalSymbolName.Default)) {
46
47
  context.report({
47
48
  node,
48
49
  messageId: 'noDefaultExport',
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.named = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const eslint_devkit_1 = require("@interlace/eslint-devkit");
6
5
  const eslint_devkit_2 = require("@interlace/eslint-devkit");
7
- const typescript_1 = tslib_1.__importDefault(require("typescript"));
6
+ const typescript_peer_1 = require("../utils/typescript-peer");
8
7
  exports.named = (0, eslint_devkit_1.createRule)({
9
8
  name: 'named',
10
9
  meta: {
@@ -38,7 +37,7 @@ exports.named = (0, eslint_devkit_1.createRule)({
38
37
  return;
39
38
  const tsNode = services.esTreeNodeToTSNodeMap.get(node.imported);
40
39
  let symbol = checker?.getSymbolAtLocation?.(tsNode);
41
- if (symbol && (symbol.flags & typescript_1.default.SymbolFlags.Alias)) {
40
+ if (symbol && (symbol.flags & (0, typescript_peer_1.aliasSymbolFlag)())) {
42
41
  try {
43
42
  symbol = checker?.getAliasedSymbol?.(symbol);
44
43
  }
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.namespace = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const eslint_devkit_1 = require("@interlace/eslint-devkit");
6
5
  const eslint_devkit_2 = require("@interlace/eslint-devkit");
7
- const typescript_1 = tslib_1.__importDefault(require("typescript"));
6
+ const typescript_peer_1 = require("../utils/typescript-peer");
8
7
  exports.namespace = (0, eslint_devkit_1.createRule)({
9
8
  name: 'namespace',
10
9
  meta: {
@@ -40,7 +39,7 @@ exports.namespace = (0, eslint_devkit_1.createRule)({
40
39
  const symbol = checker?.getSymbolAtLocation?.(tsNode);
41
40
  if (symbol && symbol.declarations && symbol.declarations.length > 0) {
42
41
  const declaration = symbol.declarations[0];
43
- if (declaration.kind === typescript_1.default.SyntaxKind.NamespaceImport) {
42
+ if (declaration.kind === (0, typescript_peer_1.loadTypeScript)()?.SyntaxKind.NamespaceImport) {
44
43
  if (node.property.type !== 'Identifier')
45
44
  return;
46
45
  const propertyName = node.property.name;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadTypeScript = loadTypeScript;
4
+ exports.aliasSymbolFlag = aliasSymbolFlag;
5
+ exports.resetTypeScriptPeerCache = resetTypeScriptPeerCache;
6
+ let cached;
7
+ function loadTypeScript() {
8
+ if (cached === undefined) {
9
+ try {
10
+ cached = require('typescript');
11
+ }
12
+ catch {
13
+ cached = null;
14
+ }
15
+ }
16
+ return cached;
17
+ }
18
+ function aliasSymbolFlag() {
19
+ return loadTypeScript()?.SymbolFlags.Alias ?? 0;
20
+ }
21
+ function resetTypeScriptPeerCache() {
22
+ cached = undefined;
23
+ }