@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.
@@ -10,6 +10,7 @@ var _default = exports.default = {
10
10
  'import/first': 'warn',
11
11
  'import/order': ['warn', {
12
12
  'newlines-between': 'always-and-inside-groups',
13
+ sortTypesGroup: true,
13
14
  alphabetize: {
14
15
  order: 'asc',
15
16
  caseInsensitive: false
@@ -4,18 +4,34 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _typescriptEslint = _interopRequireDefault(require("typescript-eslint"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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: _typescriptEslint.default.parser
23
+ parser: ts?.parser
14
24
  },
15
- plugins: {
16
- '@typescript-eslint': _typescriptEslint.default.plugin
25
+ get plugins() {
26
+ if (importError) {
27
+ throw importError;
28
+ }
29
+ return {
30
+ '@typescript-eslint': ts?.plugin
31
+ };
17
32
  },
18
33
  rules: {
19
- ..._typescriptEslint.default.plugin.configs.recommended.rules
34
+ ...ts?.plugin.configs.recommended.rules,
35
+ '@typescript-eslint/no-unused-vars': 'warn'
20
36
  }
21
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrockio/eslint-plugin",
3
- "version": "1.4.4",
3
+ "version": "1.4.6",
4
4
  "description": "Common ESLint plugin for Bedrock projects.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -6,6 +6,7 @@ export default {
6
6
  'warn',
7
7
  {
8
8
  'newlines-between': 'always-and-inside-groups',
9
+ sortTypesGroup: true,
9
10
  alphabetize: {
10
11
  order: 'asc',
11
12
  caseInsensitive: false,
package/src/typescript.js CHANGED
@@ -1,15 +1,32 @@
1
- import ts from 'typescript-eslint';
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.parser,
18
+ parser: ts?.parser,
8
19
  },
9
- plugins: {
10
- '@typescript-eslint': ts.plugin,
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.plugin.configs.recommended.rules,
29
+ ...ts?.plugin.configs.recommended.rules,
30
+ '@typescript-eslint/no-unused-vars': 'warn',
14
31
  },
15
32
  };