@guardian/eslint-config 13.0.7 → 14.0.0

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,5 +1,15 @@
1
1
  # @guardian/eslint-config
2
2
 
3
+ ## 14.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - c267f87: Make `eslint-plugin-storybook` into an optional peer dependency
8
+
9
+ tl;dr if using the `storybook` config from `@guardian/eslint-config`, then you must have both `eslint-plugin-storybook` and `storybook` installed. If you are not using the `storybook` config, then you do not need to have either of these installed.
10
+ - Issue was found that since `eslint-plugin-storybook` is a direct dependency of `@guardian/eslint-config`, and that `storybook` is a peer dependency of `eslint-plugin-storybook`, then `storybook` is always installed as a transitive dependency of `@guardian/eslint-config`. This causes issues for projects that use `@guardian/eslint-config` but do not use Storybook, as they will have an unnecessary dependency on Storybook and may encounter issues if they have a different version of Storybook installed.
11
+ - Now we've moved `eslint-plugin-storybook` from `dependencies` to `peerDependencies` and mark it as optional via `peerDependenciesMeta`. This means that projects that use `@guardian/eslint-config` but do not use Storybook will not have `eslint-plugin-storybook` or `storybook` installed, and will not encounter any issues. Projects that do use the `storybook` config from `@guardian/eslint-config` will need to have both `eslint-plugin-storybook` and `storybook` installed as direct dependencies.
12
+
3
13
  ## 13.0.7
4
14
 
5
15
  ### Patch Changes
package/README.md CHANGED
@@ -106,3 +106,5 @@ Provides a collection of configs for checking React components.
106
106
  #### [`configs.storybook`](./configs/storybook.js)
107
107
 
108
108
  Provides a collection of configs for checking Storybook stories.
109
+
110
+ When using the storybook config, be sure to also have `eslint-plugin-storybook` and `storybook` installed in your project, otherwise the config will be ignored.
@@ -1,15 +1,16 @@
1
- // eslint-plugin-storybook has a dependency on on Storybook which causes it
2
- // to crash eslint when it is imported if Storybook is not installed.
1
+ // eslint-plugin-storybook is an optional peer dependency.
2
+ // It also has its own peer dependency on Storybook which can cause it
3
+ // to crash eslint when imported if Storybook is not installed.
3
4
  const loadStorybookRecommended = async () => {
4
5
  try {
5
- // eslint-disable-next-line import/no-unresolved -- We're checking if Storybook is resolveable
6
+ // eslint-disable-next-line import/no-unresolved -- We're checking if Storybook is resolvable
6
7
  await import('storybook');
8
+ // Check that plugin is also available
9
+ const storybook = await import('eslint-plugin-storybook');
10
+ return storybook.configs['flat/recommended'];
7
11
  } catch {
8
12
  return [];
9
13
  }
10
-
11
- const storybook = await import('eslint-plugin-storybook');
12
- return storybook.configs['flat/recommended'];
13
14
  };
14
15
 
15
16
  export default [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/eslint-config",
3
- "version": "13.0.7",
3
+ "version": "14.0.0",
4
4
  "description": "ESLint config for Guardian JavaScript projects",
5
5
  "repository": {
6
6
  "url": "https://github.com/guardian/csnx",
@@ -18,7 +18,6 @@
18
18
  "eslint-plugin-jsx-a11y": "6.10.2",
19
19
  "eslint-plugin-react": "7.37.5",
20
20
  "eslint-plugin-react-hooks": "7.0.1",
21
- "eslint-plugin-storybook": "10.2.13",
22
21
  "globals": "17.3.0",
23
22
  "read-package-up": "12.0.0",
24
23
  "typescript-eslint": "8.55.0"
@@ -28,7 +27,13 @@
28
27
  "wireit": "0.14.12"
29
28
  },
30
29
  "peerDependencies": {
31
- "eslint": "^9.39.1"
30
+ "eslint": "^9.39.1",
31
+ "eslint-plugin-storybook": "^10.2.13"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "eslint-plugin-storybook": {
35
+ "optional": true
36
+ }
32
37
  },
33
38
  "wireit": {
34
39
  "lint": {