storybook/.eslintrc.js

132 lines
3.1 KiB
JavaScript
Raw Normal View History

2017-04-17 16:37:37 +02:00
const error = 2;
const warn = 1;
const ignore = 0;
module.exports = {
2017-05-26 14:10:52 +02:00
root: true,
extends: [
2018-02-25 03:48:49 +03:00
'airbnb',
'plugin:jest/recommended',
'plugin:import/react-native',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/react',
'prettier/@typescript-eslint',
],
plugins: [
'@typescript-eslint',
'prettier',
'jest',
'import',
'react',
'jsx-a11y',
'json',
'html',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 8,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
env: { es6: true, node: true, 'jest/globals': true },
2017-10-04 00:20:18 +03:00
settings: {
'import/core-modules': ['enzyme'],
2017-12-28 04:38:46 +03:00
'import/ignore': ['node_modules\\/(?!@storybook)'],
'import/resolver': { node: { extensions: ['.js', '.ts'] } },
'html/html-extensions': ['.html'],
2017-10-04 00:20:18 +03:00
},
rules: {
'prettier/prettier': [warn],
'no-debugger': process.env.NODE_ENV === 'production' ? error : ignore,
2017-04-17 16:37:49 +02:00
'class-methods-use-this': ignore,
'import/extensions': [
error,
'always',
{
js: 'never',
ts: 'never',
2018-11-25 01:26:54 +01:00
mjs: 'never',
},
],
'import/no-extraneous-dependencies': [
error,
{
devDependencies: [
'examples/**',
'examples-native/**',
'**/example/**',
'*.js',
'**/*.test.js',
2017-11-27 13:48:46 +11:00
'**/*.stories.js',
'**/scripts/*.js',
'**/stories/**/*.js',
'**/__tests__/**/*.js',
2018-02-17 23:32:26 +03:00
'**/.storybook/**/*.js',
],
peerDependencies: true,
},
],
2017-04-17 16:37:37 +02:00
'import/prefer-default-export': ignore,
2017-12-28 04:38:46 +03:00
'import/default': error,
'import/named': error,
'import/namespace': error,
'react/jsx-filename-extension': [
warn,
{
extensions: ['.js', '.jsx', '.tsx'],
},
],
2018-08-15 04:56:20 +02:00
'react/jsx-no-bind': [
error,
{
ignoreDOMComponents: true,
ignoreRefs: true,
allowArrowFunctions: true,
allowFunctions: true,
allowBind: true,
},
],
'jsx-a11y/accessible-emoji': ignore,
2018-08-15 04:56:20 +02:00
'jsx-a11y/label-has-associated-control': [
warn,
{
labelComponents: ['CustomInputLabel'],
labelAttributes: ['label'],
controlComponents: ['CustomInput'],
depth: 3,
},
],
'react/no-unescaped-entities': ignore,
'jsx-a11y/label-has-for': [error, { required: { some: ['nesting', 'id'] } }],
2018-02-17 22:33:31 +03:00
'jsx-a11y/anchor-is-valid': [
error,
{
2018-12-24 17:21:53 +01:00
components: ['A', 'LinkTo', 'Link'],
2018-02-17 22:33:31 +03:00
specialLink: ['overrideParams', 'kind', 'story', 'to'],
},
],
'no-underscore-dangle': [
error,
{ allow: ['__STORYBOOK_CLIENT_API__', '__STORYBOOK_ADDONS_CHANNEL__'] },
],
},
2018-02-17 22:33:31 +03:00
overrides: [
{
files: [
'**/__tests__/**',
'**/*.test.js',
'**/*.stories.js',
'**/storyshots/**/stories/**',
'docs/src/new-components/lib/StoryLinkWrapper.js',
'docs/src/stories/**',
],
rules: {
'import/no-extraneous-dependencies': ignore,
},
},
{ files: '**/.storybook/config.js', rules: { 'global-require': ignore } },
2018-02-17 22:33:31 +03:00
],
};