1 | const error = 2;
|
2 | const warn = 1;
|
3 | const ignore = 0;
|
4 |
|
5 | module.exports = {
|
6 | root: true,
|
7 | extends: [
|
8 | 'airbnb',
|
9 | 'plugin:jest/recommended',
|
10 | 'plugin:import/react-native',
|
11 | 'plugin:@typescript-eslint/recommended',
|
12 | 'prettier',
|
13 | 'prettier/react',
|
14 | 'prettier/@typescript-eslint',
|
15 | ],
|
16 | plugins: [
|
17 | '@typescript-eslint',
|
18 | 'prettier',
|
19 | 'jest',
|
20 | 'import',
|
21 | 'react',
|
22 | 'jsx-a11y',
|
23 | 'json',
|
24 | ],
|
25 | parser: '@typescript-eslint/parser',
|
26 | parserOptions: {
|
27 | ecmaVersion: 8,
|
28 | sourceType: 'module',
|
29 | ecmaFeatures: {
|
30 | jsx: true,
|
31 | },
|
32 | },
|
33 | env: { es6: true, node: true, 'jest/globals': true },
|
34 | settings: {
|
35 | 'import/core-modules': ['enzyme'],
|
36 | 'import/ignore': ['node_modules\\/(?!@storybook)'],
|
37 | 'import/resolver': {
|
38 | node: {
|
39 | extensions: ['.js', '.ts', '.tsx', '.mjs', '.d.ts'],
|
40 | paths: ['node_modules/', 'node_modules/@types/'],
|
41 | },
|
42 | },
|
43 | },
|
44 | rules: {
|
45 | 'no-useless-constructor': ignore,
|
46 | '@typescript-eslint/no-useless-constructor': error,
|
47 | 'no-restricted-imports': [
|
48 | error,
|
49 | {
|
50 | paths: [
|
51 | {
|
52 | name: 'lodash.isequal',
|
53 | message:
|
54 | 'Lodash modularised (and lodash < 4.17.11) have CVE vulnerabilities. Please use tree-shakeable imports like lodash/xxx instead',
|
55 | },
|
56 | {
|
57 | name: 'lodash.mergewith',
|
58 | message:
|
59 | 'Lodash modularised (and lodash < 4.17.11) have CVE vulnerabilities. Please use tree-shakeable imports like lodash/xxx instead',
|
60 | },
|
61 | {
|
62 | name: 'lodash.pick',
|
63 | message:
|
64 | 'Lodash modularised (and lodash < 4.17.11) have CVE vulnerabilities. Please use tree-shakeable imports like lodash/xxx instead',
|
65 | },
|
66 | ],
|
67 |
|
68 | patterns: ['lodash.*'],
|
69 | },
|
70 | ],
|
71 | 'prettier/prettier': [warn],
|
72 | 'no-debugger': process.env.NODE_ENV === 'production' ? error : ignore,
|
73 | 'class-methods-use-this': ignore,
|
74 | 'import/extensions': [
|
75 | error,
|
76 | 'always',
|
77 | {
|
78 | js: 'never',
|
79 | ts: 'never',
|
80 | tsx: 'never',
|
81 | mjs: 'never',
|
82 | },
|
83 | ],
|
84 | 'import/no-extraneous-dependencies': [
|
85 | error,
|
86 | {
|
87 | devDependencies: [
|
88 | 'examples/**',
|
89 | 'examples-native/**',
|
90 | '**/example/**',
|
91 | '*.js',
|
92 | '**/*.test.js',
|
93 | '**/*.stories.*',
|
94 | '**/scripts/*.js',
|
95 | '**/stories/**/*.js',
|
96 | '**/__tests__/**/*.js',
|
97 | '**/.storybook/**/*.*',
|
98 | ],
|
99 | peerDependencies: true,
|
100 | },
|
101 | ],
|
102 | 'import/prefer-default-export': ignore,
|
103 | 'import/default': error,
|
104 | 'import/named': error,
|
105 | 'import/namespace': error,
|
106 | 'react/jsx-filename-extension': [
|
107 | warn,
|
108 | {
|
109 | extensions: ['.js', '.jsx', '.tsx'],
|
110 | },
|
111 | ],
|
112 | 'react/jsx-no-bind': [
|
113 | error,
|
114 | {
|
115 | ignoreDOMComponents: true,
|
116 | ignoreRefs: true,
|
117 | allowArrowFunctions: true,
|
118 | allowFunctions: true,
|
119 | allowBind: true,
|
120 | },
|
121 | ],
|
122 | 'jsx-a11y/accessible-emoji': ignore,
|
123 | 'jsx-a11y/label-has-associated-control': [
|
124 | warn,
|
125 | {
|
126 | labelComponents: ['CustomInputLabel'],
|
127 | labelAttributes: ['label'],
|
128 | controlComponents: ['CustomInput'],
|
129 | depth: 3,
|
130 | },
|
131 | ],
|
132 | 'react/no-unescaped-entities': ignore,
|
133 | 'jsx-a11y/label-has-for': [error, { required: { some: ['nesting', 'id'] } }],
|
134 | 'jsx-a11y/anchor-is-valid': [
|
135 | error,
|
136 | {
|
137 | components: ['A', 'LinkTo', 'Link'],
|
138 | specialLink: ['overrideParams', 'kind', 'story', 'to'],
|
139 | },
|
140 | ],
|
141 | 'no-underscore-dangle': [
|
142 | error,
|
143 | {
|
144 | allow: [
|
145 | '__STORYBOOK_CLIENT_API__',
|
146 | '__STORYBOOK_ADDONS_CHANNEL__',
|
147 | '__STORYBOOK_STORY_STORE__',
|
148 | ],
|
149 | },
|
150 | ],
|
151 | '@typescript-eslint/no-var-requires': ignore,
|
152 | '@typescript-eslint/camelcase': ignore,
|
153 | '@typescript-eslint/no-unused-vars': ignore,
|
154 | '@typescript-eslint/explicit-member-accessibility': ignore,
|
155 | '@typescript-eslint/explicit-function-return-type': ignore,
|
156 | '@typescript-eslint/no-explicit-any': ignore,
|
157 | '@typescript-eslint/no-use-before-define': ignore,
|
158 | '@typescript-eslint/interface-name-prefix': ignore,
|
159 | },
|
160 | };
|