@bedrockio/eslint-plugin 1.4.4 → 1.4.6
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/importRules.js +1 -0
- package/dist/cjs/typescript.js +22 -6
- package/package.json +1 -1
- package/src/importRules.js +1 -0
- package/src/typescript.js +22 -5
package/dist/cjs/importRules.js
CHANGED
package/dist/cjs/typescript.js
CHANGED
|
@@ -4,18 +4,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
8
|
-
|
|
7
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
8
|
+
let ts;
|
|
9
|
+
let importError;
|
|
10
|
+
try {
|
|
11
|
+
// This is to make this package optional.
|
|
12
|
+
ts = await Promise.resolve().then(() => _interopRequireWildcard(require('typescript-eslint')));
|
|
13
|
+
} catch (err) {
|
|
14
|
+
// Package not installed. Capture error to
|
|
15
|
+
// allow re-throwing if plugin is accessed,
|
|
16
|
+
// otherwise allow it to export silently.
|
|
17
|
+
importError = err;
|
|
18
|
+
}
|
|
9
19
|
var _default = exports.default = {
|
|
10
20
|
files: ['**/*.{ts,tsx}'],
|
|
11
21
|
ignores: ['node_modules/**/*', '**/dist/**/*', '**/*.d.ts'],
|
|
12
22
|
languageOptions: {
|
|
13
|
-
parser:
|
|
23
|
+
parser: ts?.parser
|
|
14
24
|
},
|
|
15
|
-
plugins
|
|
16
|
-
|
|
25
|
+
get plugins() {
|
|
26
|
+
if (importError) {
|
|
27
|
+
throw importError;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
'@typescript-eslint': ts?.plugin
|
|
31
|
+
};
|
|
17
32
|
},
|
|
18
33
|
rules: {
|
|
19
|
-
...
|
|
34
|
+
...ts?.plugin.configs.recommended.rules,
|
|
35
|
+
'@typescript-eslint/no-unused-vars': 'warn'
|
|
20
36
|
}
|
|
21
37
|
};
|
package/package.json
CHANGED
package/src/importRules.js
CHANGED
package/src/typescript.js
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
let ts;
|
|
2
|
+
let importError;
|
|
3
|
+
|
|
4
|
+
try {
|
|
5
|
+
// This is to make this package optional.
|
|
6
|
+
ts = await import('typescript-eslint');
|
|
7
|
+
} catch (err) {
|
|
8
|
+
// Package not installed. Capture error to
|
|
9
|
+
// allow re-throwing if plugin is accessed,
|
|
10
|
+
// otherwise allow it to export silently.
|
|
11
|
+
importError = err;
|
|
12
|
+
}
|
|
2
13
|
|
|
3
14
|
export default {
|
|
4
15
|
files: ['**/*.{ts,tsx}'],
|
|
5
16
|
ignores: ['node_modules/**/*', '**/dist/**/*', '**/*.d.ts'],
|
|
6
17
|
languageOptions: {
|
|
7
|
-
parser: ts
|
|
18
|
+
parser: ts?.parser,
|
|
8
19
|
},
|
|
9
|
-
plugins
|
|
10
|
-
|
|
20
|
+
get plugins() {
|
|
21
|
+
if (importError) {
|
|
22
|
+
throw importError;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
'@typescript-eslint': ts?.plugin,
|
|
26
|
+
};
|
|
11
27
|
},
|
|
12
28
|
rules: {
|
|
13
|
-
...ts
|
|
29
|
+
...ts?.plugin.configs.recommended.rules,
|
|
30
|
+
'@typescript-eslint/no-unused-vars': 'warn',
|
|
14
31
|
},
|
|
15
32
|
};
|