storybook/.eslintrc.js

78 lines
2.1 KiB
JavaScript
Raw Normal View History

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': [
'error',
2019-10-03 11:08:40 +02:00
'never',
{ ignorePackages: true, md: 'always', svg: 'always', json: 'always', tag: 'always' },
],
'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': [
'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'],
},
},
],
'max-classes-per-file': 'off',
2019-10-03 11:08:40 +02:00
},
2018-02-17 22:33:31 +03:00
overrides: [
{
files: [
'**/__tests__/**',
2019-04-25 17:59:37 +02:00
'**/*.test.*',
'**/*.stories.*',
'**/storyshots/**/stories/**',
'docs/src/new-components/lib/StoryLinkWrapper.js',
'docs/src/stories/**',
],
rules: {
'@typescript-eslint/no-empty-function': 'off',
'import/no-extraneous-dependencies': 'off',
},
},
{ files: '**/.storybook/config.js', rules: { 'global-require': 'off' } },
2019-04-25 17:59:37 +02:00
{
files: ['**/*.stories.*'],
rules: {
'no-console': 'off',
2019-04-25 17:59:37 +02:00
},
},
{
files: ['**/*.tsx', '**/*.ts'],
rules: {
'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: {
'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
],
};