storybook/.eslintrc.js

96 lines
3.1 KiB
JavaScript
Raw Normal View History

module.exports = {
2017-05-26 14:10:52 +02:00
root: true,
2021-11-11 16:06:51 +01:00
extends: ['@storybook/eslint-config-storybook', 'plugin:storybook/recommended'],
2021-02-16 18:57:43 +01:00
rules: {
'@typescript-eslint/ban-ts-comment': 'warn',
2021-11-23 17:30:12 -08:00
'jest/no-standalone-expect': [
'error',
{ additionalTestBlockFunctions: ['it.skipWindows', 'it.onWindows'] },
],
2021-02-16 18:57:43 +01:00
},
2018-02-17 22:33:31 +03:00
overrides: [
2022-02-11 16:01:20 +01:00
{
// this package depends on a lot of peerDependencies we don't want to specify, because npm would install them
files: ['**/addons/docs/**/*'],
rules: {
'import/no-extraneous-dependencies': 'off',
},
},
{
// this package uses pre-bundling, dependencies will be bundled, and will be in devDepenencies
files: [
'**/lib/theming/**/*',
'**/lib/router/**/*',
'**/lib/ui/**/*',
'**/lib/components/**/*',
],
rules: {
'import/no-extraneous-dependencies': ['error', { bundledDependencies: false }],
},
},
{
files: [
'**/__tests__/**',
2020-05-09 11:34:50 +02:00
'scripts/**',
'**/__testfixtures__/**',
2019-04-25 17:59:37 +02:00
'**/*.test.*',
'**/*.stories.*',
'**/storyshots/**/stories/**',
],
rules: {
'@typescript-eslint/no-empty-function': 'off',
'import/no-extraneous-dependencies': 'off',
},
},
{
files: ['**/__testfixtures__/**'],
rules: {
'react/forbid-prop-types': 'off',
'react/no-unused-prop-types': 'off',
'react/require-default-props': 'off',
},
},
{ files: '**/.storybook/config.js', rules: { 'global-require': 'off' } },
2020-05-09 11:34:50 +02:00
{ files: 'cypress/**', rules: { 'jest/expect-expect': '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: {
2020-11-26 16:55:47 +01:00
'react/require-default-props': 'off',
'react/prop-types': 'off', // we should use types
2020-11-26 16:55:47 +01:00
'react/forbid-prop-types': 'off', // we should use types
'no-dupe-class-members': 'off', // this is called overloads in typescript
'react/no-unused-prop-types': 'off', // we should use types
'react/default-props-match-prop-types': 'off', // we should use types
'import/no-named-as-default': 'warn',
'import/no-named-as-default-member': 'warn',
'react/destructuring-assignment': 'warn',
// This warns about importing interfaces and types in a normal import, it's arguably better to import with the `type` prefix separate from the runtime imports,
// I leave this as a warning right now because we haven't really decided yet, and the codebase is riddled with errors if I set to 'error'.
// It IS set to 'error' for JS files.
'import/named': 'warn',
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
},
},
{
files: ['**/mithril/**/*'],
rules: {
'react/no-unknown-property': 'off', // Need to deactivate otherwise eslint replaces some unknown properties with React ones
},
},
2018-02-17 22:33:31 +03:00
],
};