@wistia/eslint-config 0.16.1 → 0.17.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Wistia's ESLint configurations",
|
|
5
5
|
"main": "react.js",
|
|
6
6
|
"exports": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"./node": "./configs/eslint/node.js",
|
|
12
12
|
"./prettier": "./configs/eslint/prettier.js",
|
|
13
13
|
"./react": "./configs/eslint/react.js",
|
|
14
|
+
"./storybook": "./configs/eslint/storybook.js",
|
|
14
15
|
"./strict": "./configs/eslint/strict.js",
|
|
15
16
|
"./styled-components": "./configs/eslint/styled-components.js",
|
|
16
17
|
"./stylelint": "./configs/stylelint/default.js",
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
"eslint-plugin-react": "^7.31.10",
|
|
54
55
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
55
56
|
"eslint-plugin-sonarjs": "^0.16.0",
|
|
57
|
+
"eslint-plugin-storybook": "^0.6.7",
|
|
56
58
|
"eslint-plugin-styled-components-a11y": "^1.0.0",
|
|
57
59
|
"eslint-plugin-testing-library": "^5.9.1",
|
|
58
60
|
"postcss": "^8.4.18",
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// only add storybook rules
|
|
2
|
+
// see: https://github.com/storybookjs/eslint-plugin-storybook#supported-rules-and-configurations
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
plugins: ['eslint-plugin-storybook'],
|
|
6
|
+
|
|
7
|
+
rules: {
|
|
8
|
+
// storybook 6 requires default exports in stories
|
|
9
|
+
'import/no-anonymous-default-export': 'off',
|
|
10
|
+
'import/no-default-export': 'off',
|
|
11
|
+
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
|
|
12
|
+
'import/prefer-default-export': 'error',
|
|
13
|
+
|
|
14
|
+
// Interactions should be awaited
|
|
15
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/await-interactions.md
|
|
16
|
+
'storybook/await-interactions': 'error',
|
|
17
|
+
|
|
18
|
+
// Pass a context when invoking play function of another story
|
|
19
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/context-in-play-function.md
|
|
20
|
+
'storybook/context-in-play-function': 'error',
|
|
21
|
+
|
|
22
|
+
// The component property should be set
|
|
23
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/csf-component.md
|
|
24
|
+
'storybook/csf-component': 'error',
|
|
25
|
+
|
|
26
|
+
// Story files should have a default export
|
|
27
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/default-exports.md
|
|
28
|
+
'storybook/default-exports': 'error',
|
|
29
|
+
|
|
30
|
+
// Deprecated hierarchy separator in title property
|
|
31
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/hierarchy-separator.md
|
|
32
|
+
'storybook/hierarchy-separator': 'error',
|
|
33
|
+
|
|
34
|
+
// A story should not have a redundant name property
|
|
35
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/no-redundant-story-name.md
|
|
36
|
+
'storybook/no-redundant-story-name': 'error',
|
|
37
|
+
|
|
38
|
+
// storiesOf is deprecated and should not be used
|
|
39
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/no-stories-of.md
|
|
40
|
+
'storybook/no-stories-of': 'error',
|
|
41
|
+
|
|
42
|
+
// Do not define a title in meta
|
|
43
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/no-title-property-in-meta.md
|
|
44
|
+
'storybook/no-title-property-in-meta': 'error',
|
|
45
|
+
|
|
46
|
+
// This rule identifies storybook addons that are invalid because they are either not installed or contain a typo in their name
|
|
47
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/no-uninstalled-addons.md
|
|
48
|
+
'storybook/no-uninstalled-addons': 'error',
|
|
49
|
+
|
|
50
|
+
// Stories should use PascalCase
|
|
51
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/prefer-pascal-case.md
|
|
52
|
+
'storybook/prefer-pascal-case': 'error',
|
|
53
|
+
|
|
54
|
+
// A story file must contain at least one story export
|
|
55
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/story-exports.md
|
|
56
|
+
'storybook/story-exports': 'error',
|
|
57
|
+
|
|
58
|
+
// Use expect from @storybook/jest
|
|
59
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/use-storybook-expect.md
|
|
60
|
+
'storybook/use-storybook-expect': 'error',
|
|
61
|
+
|
|
62
|
+
// Do not use testing-library directly on stories
|
|
63
|
+
// https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/storybook/use-storybook-testing-library.md
|
|
64
|
+
'storybook/use-storybook-testing-library': 'error',
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -22,6 +22,8 @@ module.exports = {
|
|
|
22
22
|
|
|
23
23
|
settings: {
|
|
24
24
|
'import/parsers': {
|
|
25
|
+
// omit `.d.ts` because 1) TypeScript compilation already confirms that types are resolved, and
|
|
26
|
+
// 2) it would mask an unresolved `.ts`/`.tsx`/`.js`/`.jsx` implementation.
|
|
25
27
|
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
26
28
|
},
|
|
27
29
|
|
|
@@ -307,7 +307,7 @@ module.exports = {
|
|
|
307
307
|
// Require function parameters to be typed as <code>readonly</code> to prevent accidental mutation of inputs
|
|
308
308
|
// https://typescript-eslint.io/rules/prefer-readonly-parameter-types
|
|
309
309
|
// disabled due to development friction and lackluster linting hints to resolve violations
|
|
310
|
-
'@typescript-eslint/prefer-readonly-parameter-types': '
|
|
310
|
+
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
|
|
311
311
|
|
|
312
312
|
// Enforce using type parameter when calling <code>Array#reduce</code> instead of casting
|
|
313
313
|
// https://typescript-eslint.io/rules/prefer-reduce-type-parameter
|