forked from storybookjs/storybook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
81 lines (80 loc) · 2.17 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
const ignore = 0;
// const warn = 1;
const error = 2;
module.exports = {
root: true,
extends: ['@storybook/eslint-config-storybook'],
rules: {
'import/extensions': [
error,
'never',
{ ignorePackages: true, md: 'always', svg: 'always', json: 'always', tag: 'always' },
],
'import/no-unresolved': [error, { ignore: ['@storybook'] }],
'react/state-in-constructor': ignore,
'react/static-property-placement': ignore,
'react/jsx-props-no-spreading': ignore,
'react/jsx-fragments': ignore,
'@typescript-eslint/ban-ts-ignore': ignore,
'@typescript-eslint/no-object-literal-type-assertion': ignore,
'react/sort-comp': [
error,
{
order: [
'staticLifecycle',
'static-methods',
'instance-variables',
'lifecycle',
'/^on.+$/',
'/^(get|set)(?!(DerivedStateFromProps|SnapshotBeforeUpdate$)).+$/',
'instance-methods',
'instance-variables',
'everything-else',
'render',
],
groups: {
staticLifecycle: ['displayName', 'propTypes', 'defaultProps', 'getDerivedStateFromProps'],
},
},
],
'max-classes-per-file': ignore,
},
overrides: [
{
files: [
'**/__tests__/**',
'**/*.test.*',
'**/*.stories.*',
'**/storyshots/**/stories/**',
'docs/src/new-components/lib/StoryLinkWrapper.js',
'docs/src/stories/**',
],
rules: {
'@typescript-eslint/no-empty-function': ignore,
'import/no-extraneous-dependencies': ignore,
},
},
{ files: '**/.storybook/config.js', rules: { 'global-require': ignore } },
{
files: ['**/*.stories.*'],
rules: {
'no-console': ignore,
},
},
{
files: ['**/*.tsx', '**/*.ts'],
rules: {
'react/prop-types': ignore, // we should use types
'no-dupe-class-members': ignore, // this is called overloads in typescript
},
},
{
files: ['**/*.d.ts'],
rules: {
'vars-on-top': ignore,
'no-var': ignore, // this is how typescript works
'spaced-comment': ignore,
},
},
],
};