2017-04-17 16:37:37 +02:00
|
|
|
const error = 2;
|
|
|
|
const warn = 1;
|
|
|
|
const ignore = 0;
|
2017-04-14 09:26:27 +02:00
|
|
|
module.exports = {
|
2017-05-26 14:10:52 +02:00
|
|
|
root: true,
|
2018-02-17 21:27:49 +03:00
|
|
|
extends: [
|
2018-02-25 03:48:49 +03:00
|
|
|
'airbnb',
|
2018-02-17 21:27:49 +03:00
|
|
|
'plugin:jest/recommended',
|
|
|
|
'plugin:import/react-native',
|
2019-04-25 15:00:28 +02:00
|
|
|
'plugin:@typescript-eslint/recommended',
|
2018-02-17 21:27:49 +03:00
|
|
|
'prettier',
|
|
|
|
'prettier/react',
|
2019-04-25 15:00:28 +02:00
|
|
|
'prettier/@typescript-eslint',
|
2018-02-17 21:27:49 +03:00
|
|
|
],
|
2019-04-25 15:00:28 +02:00
|
|
|
plugins: [
|
|
|
|
'@typescript-eslint',
|
|
|
|
'prettier',
|
|
|
|
'jest',
|
|
|
|
'import',
|
|
|
|
'react',
|
|
|
|
'jsx-a11y',
|
|
|
|
'json',
|
|
|
|
'html',
|
|
|
|
],
|
|
|
|
parser: '@typescript-eslint/parser',
|
|
|
|
parserOptions: {
|
|
|
|
ecmaVersion: 8,
|
|
|
|
sourceType: 'module',
|
|
|
|
ecmaFeatures: {
|
|
|
|
jsx: true,
|
|
|
|
},
|
|
|
|
},
|
2018-09-11 16:21:31 +02:00
|
|
|
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)'],
|
2018-09-11 16:21:31 +02:00
|
|
|
'import/resolver': { node: { extensions: ['.js', '.ts'] } },
|
|
|
|
'html/html-extensions': ['.html'],
|
2017-10-04 00:20:18 +03:00
|
|
|
},
|
2017-04-14 10:13:31 +02:00
|
|
|
rules: {
|
2018-09-11 16:21:31 +02:00
|
|
|
'prettier/prettier': [warn],
|
2017-12-15 00:10:35 +01:00
|
|
|
'no-debugger': process.env.NODE_ENV === 'production' ? error : ignore,
|
2017-04-17 16:37:49 +02:00
|
|
|
'class-methods-use-this': ignore,
|
2017-06-06 13:18:33 +02:00
|
|
|
'import/extensions': [
|
2017-10-02 01:40:46 +03:00
|
|
|
error,
|
2018-02-17 21:27:49 +03:00
|
|
|
'always',
|
2017-06-06 13:18:33 +02:00
|
|
|
{
|
|
|
|
js: 'never',
|
2018-02-17 21:27:49 +03:00
|
|
|
ts: 'never',
|
2018-11-25 01:26:54 +01:00
|
|
|
mjs: 'never',
|
2017-06-06 13:18:33 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
'import/no-extraneous-dependencies': [
|
2017-08-18 04:35:25 +03:00
|
|
|
error,
|
2017-06-06 13:18:33 +02:00
|
|
|
{
|
|
|
|
devDependencies: [
|
2017-08-18 04:35:25 +03:00
|
|
|
'examples/**',
|
2018-10-13 18:39:23 +02:00
|
|
|
'examples-native/**',
|
2017-08-18 04:35:25 +03:00
|
|
|
'**/example/**',
|
|
|
|
'*.js',
|
2017-06-06 13:18:33 +02:00
|
|
|
'**/*.test.js',
|
2017-11-27 13:48:46 +11:00
|
|
|
'**/*.stories.js',
|
2017-06-06 13:18:33 +02:00
|
|
|
'**/scripts/*.js',
|
2017-11-18 14:20:34 +03:00
|
|
|
'**/stories/**/*.js',
|
|
|
|
'**/__tests__/**/*.js',
|
2018-02-17 23:32:26 +03:00
|
|
|
'**/.storybook/**/*.js',
|
2017-06-06 13:18:33 +02:00
|
|
|
],
|
|
|
|
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,
|
2017-06-06 13:18:33 +02:00
|
|
|
'react/jsx-filename-extension': [
|
|
|
|
warn,
|
|
|
|
{
|
2018-12-08 14:29:37 +01:00
|
|
|
extensions: ['.js', '.jsx', '.tsx'],
|
2017-06-06 13:18:33 +02:00
|
|
|
},
|
|
|
|
],
|
2018-08-15 04:56:20 +02:00
|
|
|
'react/jsx-no-bind': [
|
|
|
|
error,
|
|
|
|
{
|
|
|
|
ignoreDOMComponents: true,
|
|
|
|
ignoreRefs: true,
|
|
|
|
allowArrowFunctions: true,
|
|
|
|
allowFunctions: true,
|
|
|
|
allowBind: true,
|
|
|
|
},
|
|
|
|
],
|
2018-12-29 16:15:00 +01:00
|
|
|
'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,
|
|
|
|
},
|
|
|
|
],
|
2018-02-17 21:27:49 +03:00
|
|
|
'react/no-unescaped-entities': ignore,
|
2018-09-11 16:21:31 +02:00
|
|
|
'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'],
|
|
|
|
},
|
|
|
|
],
|
2018-02-23 12:00:38 +11:00
|
|
|
'no-underscore-dangle': [
|
|
|
|
error,
|
2018-09-11 16:21:31 +02:00
|
|
|
{ allow: ['__STORYBOOK_CLIENT_API__', '__STORYBOOK_ADDONS_CHANNEL__'] },
|
2018-02-23 12:00:38 +11:00
|
|
|
],
|
2017-04-14 09:26:27 +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__/**',
|
|
|
|
'**/*.test.js',
|
|
|
|
'**/*.stories.js',
|
|
|
|
'**/storyshots/**/stories/**',
|
|
|
|
'docs/src/new-components/lib/StoryLinkWrapper.js',
|
|
|
|
'docs/src/stories/**',
|
|
|
|
],
|
2018-11-19 17:21:53 +01:00
|
|
|
rules: {
|
|
|
|
'import/no-extraneous-dependencies': ignore,
|
|
|
|
},
|
|
|
|
},
|
2018-09-11 16:21:31 +02:00
|
|
|
{ files: '**/.storybook/config.js', rules: { 'global-require': ignore } },
|
2018-02-17 22:33:31 +03:00
|
|
|
],
|
2017-06-06 13:18:33 +02:00
|
|
|
};
|