@1stg/eslint-config 9.0.1 → 9.0.3

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/CHANGELOG.md CHANGED
@@ -1,10 +1,22 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8851c03`](https://github.com/1stG/configs/commit/8851c037975d2b2152c9f8875a1380f49cfc57a5) Thanks [@JounQin](https://github.com/JounQin)! - fix(eslint-config): `plugins` could not be `undefined`
8
+
9
+ ## 9.0.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#347](https://github.com/1stG/configs/pull/347) [`fac96c2`](https://github.com/1stG/configs/commit/fac96c21f6335f369c86f1ac74b59881dd35c5cb) Thanks [@JounQin](https://github.com/JounQin)! - fix: `reactJsx` should be optional for `mdx`
14
+
3
15
  ## 9.0.1
4
16
 
5
17
  ### Patch Changes
6
18
 
7
- - [#343](https://github.com/1stG/configs/pull/343) [`ad28a13`](https://github.com/1stG/configs/commit/ad28a1398b427b4e5253ab65b1136a3b5d997f7e) Thanks [@JounQin](https://github.com/JounQin)! - fix: add missing `repository` field
19
+ - [#343](https://github.com/1stG/configs/pull/343) [`ad28a13`](https://github.com/1stG/configs/commit/ad28a1398b427b4e5253ab65b1136a3b5d997f7e) Thanks [@JounQin](https://github.com/JounQin)! - fix: add missing `homepage` field
8
20
 
9
21
  - Updated dependencies [[`ad28a13`](https://github.com/1stG/configs/commit/ad28a1398b427b4e5253ab65b1136a3b5d997f7e)]:
10
22
  - @1stg/config@1.0.5
package/_util.js CHANGED
@@ -41,6 +41,10 @@ export const isTsAvailable = isPkgAvailable('typescript')
41
41
  export const isWebpackAvailable =
42
42
  isPkgAvailable('webpack') || isPkgAvailable('@rspack/core')
43
43
 
44
+ export const isReactPluginAvailable = isPkgAvailable(
45
+ '@eslint-react/eslint-plugin',
46
+ )
47
+
44
48
  export const webpackSpecVars = [
45
49
  '__non_webpack_require__',
46
50
  '__resourceQuery',
package/js-base.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- /** @import {TSESLint} from '@typescript-eslint/utils' */
3
+ /** @import { TSESLint } from '@typescript-eslint/utils' */
4
4
 
5
5
  import { tryFile, tryPkg, tryRequirePkg } from '@pkgr/utils'
6
6
 
@@ -26,13 +26,15 @@ export const jsBase = {
26
26
  : { requireConfigFile: false },
27
27
  }
28
28
  : {},
29
- plugins: isBabelAvailable
30
- ? {
31
- '@babel': /** @type {Omit<TSESLint.FlatConfig.Plugin, 'configs'>} */ (
32
- tryRequirePkg('@babel/eslint-plugin')
33
- ),
34
- }
35
- : undefined,
29
+ plugins: /** @type {TSESLint.FlatConfig.Plugins} */ (
30
+ isBabelAvailable
31
+ ? {
32
+ '@babel': /** @type {Omit<TSESLint.FlatConfig.Plugin, 'configs'>} */ (
33
+ tryRequirePkg('@babel/eslint-plugin')
34
+ ),
35
+ }
36
+ : {}
37
+ ),
36
38
  rules: {
37
39
  camelcase: [2, { properties: 'never', ignoreDestructuring: true }],
38
40
  ...(isBabelAvailable && {
package/overrides.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- /** @import {TSESLint} from '@typescript-eslint/utils' */
3
+ /** @import { TSESLint } from '@typescript-eslint/utils' */
4
4
 
5
5
  import { jsoncFiles, nonJsonRcFiles, preferPrettier } from '@1stg/config'
6
6
  import { isPkgAvailable } from '@pkgr/utils'
@@ -13,6 +13,7 @@ import yml_ from 'eslint-plugin-yml'
13
13
  import tseslint from 'typescript-eslint'
14
14
 
15
15
  import {
16
+ isReactPluginAvailable,
16
17
  isTsAvailable,
17
18
  magicNumbers,
18
19
  nonSourceRules,
@@ -20,7 +21,6 @@ import {
20
21
  } from './_util.js'
21
22
  import { jsBase } from './js-base.js'
22
23
  import { js } from './js.js'
23
- import { reactJsx } from './react.js'
24
24
  import { test } from './test.js'
25
25
  import { resolveSettings, tsBase } from './ts-base.js'
26
26
 
@@ -128,16 +128,20 @@ export const md = tseslint.config(
128
128
  mdx_.configs.flatCodeBlocks,
129
129
  )
130
130
 
131
+ const react = isReactPluginAvailable ? await import('./react.js') : undefined
132
+
131
133
  export const mdx = tseslint.config(
132
134
  {
133
135
  name: '@1stg/mdx',
134
136
  files: ['**/*.mdx'],
135
- extends: [reactJsx, mdx_.configs.flat],
137
+ extends: [react?.reactJsx, mdx_.configs.flat].filter(Boolean),
136
138
  languageOptions: {
137
139
  ...jsBase.languageOptions,
138
140
  parser: eslintMdx,
139
141
  },
140
- settings: { ...reactJsx[0].settings, ...resolveSettings },
142
+ settings: react?.reactJsx
143
+ ? { ...react.reactJsx[0].settings, ...resolveSettings }
144
+ : resolveSettings,
141
145
  rules: {
142
146
  'prettier/prettier': preferPrettier ? 0 : 2,
143
147
  },
@@ -216,9 +220,7 @@ export const yml = yaml
216
220
  export const overrides = tseslint.config(
217
221
  js,
218
222
  isTsAvailable ? ts : [],
219
- isPkgAvailable('@eslint-react/eslint-plugin')
220
- ? await import('./react.js').then(({ react }) => react)
221
- : [],
223
+ react?.react || [],
222
224
  // The order matters, the later should to be preferred
223
225
  markup,
224
226
  isPkgAvailable('eslint-plugin-vue')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1stg/eslint-config",
3
- "version": "9.0.1",
3
+ "version": "9.0.3",
4
4
  "type": "module",
5
5
  "description": "Personal but Shareable ESLint Configuration for all 1stG.me projects",
6
6
  "repository": "git+https://github.com/1stG/configs.git",
package/test.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- /** @import {TSESLint} from '@typescript-eslint/utils' */
3
+ /** @import { TSESLint } from '@typescript-eslint/utils' */
4
4
 
5
5
  import { nonSourceRules } from './_util.js'
6
6