2017-04-14 09:26:27 +02:00
|
|
|
module.exports = {
|
2017-05-26 14:10:52 +02:00
|
|
|
root: true,
|
2019-09-26 17:49:50 +02:00
|
|
|
extends: ['@storybook/eslint-config-storybook'],
|
2019-10-03 11:08:40 +02:00
|
|
|
rules: {
|
|
|
|
'import/extensions': [
|
2019-11-15 15:37:14 +02:00
|
|
|
'error',
|
2019-10-03 11:08:40 +02:00
|
|
|
'never',
|
|
|
|
{ ignorePackages: true, md: 'always', svg: 'always', json: 'always', tag: 'always' },
|
|
|
|
],
|
2019-11-15 15:37:14 +02:00
|
|
|
'import/no-unresolved': ['error', { ignore: ['@storybook'] }],
|
|
|
|
'react/state-in-constructor': 'off',
|
|
|
|
'react/static-property-placement': 'off',
|
|
|
|
'react/jsx-props-no-spreading': 'off',
|
|
|
|
'react/jsx-fragments': 'off',
|
|
|
|
'@typescript-eslint/ban-ts-ignore': 'off',
|
|
|
|
'@typescript-eslint/no-object-literal-type-assertion': 'off',
|
2019-10-03 22:17:10 +02:00
|
|
|
'react/sort-comp': [
|
2019-11-15 15:37:14 +02:00
|
|
|
'error',
|
2019-10-03 22:17:10 +02:00
|
|
|
{
|
|
|
|
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'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2019-11-15 15:37:14 +02:00
|
|
|
'max-classes-per-file': 'off',
|
2019-10-03 11:08:40 +02:00
|
|
|
},
|
2018-02-17 22:33:31 +03:00
|
|
|
overrides: [
|
2018-11-19 17:21:53 +01:00
|
|
|
{
|
2019-04-05 04:58:14 +02:00
|
|
|
files: [
|
|
|
|
'**/__tests__/**',
|
2019-04-25 17:59:37 +02:00
|
|
|
'**/*.test.*',
|
|
|
|
'**/*.stories.*',
|
2019-04-05 04:58:14 +02:00
|
|
|
'**/storyshots/**/stories/**',
|
|
|
|
'docs/src/new-components/lib/StoryLinkWrapper.js',
|
|
|
|
'docs/src/stories/**',
|
|
|
|
],
|
2018-11-19 17:21:53 +01:00
|
|
|
rules: {
|
2019-11-15 15:37:14 +02:00
|
|
|
'@typescript-eslint/no-empty-function': 'off',
|
|
|
|
'import/no-extraneous-dependencies': 'off',
|
2018-11-19 17:21:53 +01:00
|
|
|
},
|
|
|
|
},
|
2019-11-15 15:37:14 +02:00
|
|
|
{ files: '**/.storybook/config.js', rules: { 'global-require': 'off' } },
|
2019-04-25 17:59:37 +02:00
|
|
|
{
|
|
|
|
files: ['**/*.stories.*'],
|
|
|
|
rules: {
|
2019-11-15 15:37:14 +02:00
|
|
|
'no-console': 'off',
|
2019-04-25 17:59:37 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['**/*.tsx', '**/*.ts'],
|
|
|
|
rules: {
|
2019-11-15 15:37:14 +02:00
|
|
|
'react/prop-types': 'off', // we should use types
|
|
|
|
'no-dupe-class-members': 'off', // this is called overloads in typescript
|
2019-04-25 17:59:37 +02:00
|
|
|
},
|
|
|
|
},
|
2019-04-25 23:59:40 +02:00
|
|
|
{
|
|
|
|
files: ['**/*.d.ts'],
|
|
|
|
rules: {
|
2019-11-15 15:37:14 +02:00
|
|
|
'vars-on-top': 'off',
|
|
|
|
'no-var': 'off', // this is how typescript works
|
|
|
|
'spaced-comment': 'off',
|
2019-04-25 23:59:40 +02:00
|
|
|
},
|
|
|
|
},
|
2018-02-17 22:33:31 +03:00
|
|
|
],
|
2017-06-06 13:18:33 +02:00
|
|
|
};
|