@bedrockio/eslint-plugin 1.2.0 → 1.2.2
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/dist/cjs/vite-imports.js +12 -4
- package/package.json +1 -1
- package/src/vite-imports.js +11 -6
package/dist/cjs/vite-imports.js
CHANGED
|
@@ -10,9 +10,17 @@ var _importRules = _interopRequireDefault(require("./importRules.js"));
|
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
13
|
+
let viteConfig;
|
|
14
|
+
try {
|
|
15
|
+
const file = _path.default.join(process.cwd(), 'vite.config.js');
|
|
16
|
+
const {
|
|
17
|
+
default: config
|
|
18
|
+
} = await (specifier => new Promise(r => r(`${specifier}`)).then(s => _interopRequireWildcard(require(s))))(file);
|
|
19
|
+
viteConfig = config;
|
|
20
|
+
} catch {
|
|
21
|
+
// Config file does not exist or
|
|
22
|
+
// top-level await not supported.
|
|
23
|
+
}
|
|
16
24
|
var _default = exports.default = {
|
|
17
25
|
...plugin.flatConfigs.recommended,
|
|
18
26
|
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
@@ -28,7 +36,7 @@ var _default = exports.default = {
|
|
|
28
36
|
settings: {
|
|
29
37
|
'import/resolver': {
|
|
30
38
|
vite: {
|
|
31
|
-
viteConfig
|
|
39
|
+
viteConfig
|
|
32
40
|
},
|
|
33
41
|
node: {
|
|
34
42
|
moduleDirectory: ['node_modules', 'src']
|
package/package.json
CHANGED
package/src/vite-imports.js
CHANGED
|
@@ -2,11 +2,16 @@ import path from 'path';
|
|
|
2
2
|
import * as plugin from 'eslint-plugin-import';
|
|
3
3
|
import importRules from './importRules.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
'
|
|
9
|
-
);
|
|
5
|
+
let viteConfig;
|
|
6
|
+
|
|
7
|
+
try {
|
|
8
|
+
const file = path.join(process.cwd(), 'vite.config.js');
|
|
9
|
+
const { default: config } = await import(file);
|
|
10
|
+
viteConfig = config;
|
|
11
|
+
} catch {
|
|
12
|
+
// Config file does not exist or
|
|
13
|
+
// top-level await not supported.
|
|
14
|
+
}
|
|
10
15
|
|
|
11
16
|
export default {
|
|
12
17
|
...plugin.flatConfigs.recommended,
|
|
@@ -23,7 +28,7 @@ export default {
|
|
|
23
28
|
settings: {
|
|
24
29
|
'import/resolver': {
|
|
25
30
|
vite: {
|
|
26
|
-
viteConfig
|
|
31
|
+
viteConfig,
|
|
27
32
|
},
|
|
28
33
|
node: {
|
|
29
34
|
moduleDirectory: ['node_modules', 'src'],
|