@newhighsco/eslint-config 7.0.0 → 7.0.1

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.
Files changed (2) hide show
  1. package/eslint.config.js +16 -9
  2. package/package.json +1 -1
package/eslint.config.js CHANGED
@@ -11,7 +11,6 @@ import simpleImportSort from 'eslint-plugin-simple-import-sort'
11
11
  import testingLibrary from 'eslint-plugin-testing-library'
12
12
  import { findUp } from 'find-up'
13
13
  import globals from 'globals'
14
- import typescript from 'typescript-eslint'
15
14
 
16
15
  const existsDependency = async name =>
17
16
  await import(name).then(() => true).catch(() => false)
@@ -21,6 +20,21 @@ const optionalDependency = async name =>
21
20
  .then(({ default: plugin }) => plugin)
22
21
  .catch(() => undefined)
23
22
 
23
+ let typescriptConfig = []
24
+
25
+ if (await existsDependency('typescript')) {
26
+ const typescript = await optionalDependency('typescript-eslint')
27
+
28
+ typescriptConfig = [
29
+ typescript.configs.recommended,
30
+ {
31
+ files: ['**/*.ts?(x)'],
32
+ rules: { '@typescript-eslint/consistent-type-imports': 'error' }
33
+ },
34
+ { files: ['**/*.ts?(x)'], ...prettierRecommended }
35
+ ]
36
+ }
37
+
24
38
  /** @type {import("@eslint/config-helpers").ConfigWithExtendsArray} */
25
39
  const configs = [
26
40
  {
@@ -36,14 +50,7 @@ const configs = [
36
50
  }
37
51
  },
38
52
  // Typescript
39
- ...((await existsDependency('typescript')) && [
40
- typescript.configs.recommended,
41
- {
42
- files: ['**/*.ts?(x)'],
43
- rules: { '@typescript-eslint/consistent-type-imports': 'error' }
44
- },
45
- { files: ['**/*.ts?(x)'], ...prettierRecommended }
46
- ]),
53
+ ...typescriptConfig,
47
54
  // Javascript
48
55
  {
49
56
  files: ['**/*.?(c|m)js'],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@newhighsco/eslint-config",
3
3
  "description": "New High Score shareable config for ESLint",
4
- "version": "7.0.0",
4
+ "version": "7.0.1",
5
5
  "author": "New High Score",
6
6
  "license": "ISC",
7
7
  "private": false,