1 const path = require('path');
11 extends: ['airbnb-typescript', 'prettier', 'plugin:monorepo-cop/recommended', 'plugin:jsx-a11y/recommended'],
12 parser: '@typescript-eslint/parser',
14 project: './tsconfig.json',
29 '@typescript-eslint/array-type': [
35 '@typescript-eslint/default-param-last': 'off',
36 '@typescript-eslint/no-shadow': 'off',
37 '@typescript-eslint/no-redeclare': ['error'],
38 '@typescript-eslint/explicit-function-return-type': 'off',
39 '@typescript-eslint/indent': 'off',
40 '@typescript-eslint/no-explicit-any': 'off',
41 '@typescript-eslint/no-floating-promises': 'warn',
42 '@typescript-eslint/no-for-in-array': 'error',
43 '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: false }],
44 '@typescript-eslint/naming-convention': [
48 format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
52 format: ['camelCase', 'PascalCase'],
56 format: ['PascalCase', 'UPPER_CASE'],
60 format: ['PascalCase', 'UPPER_CASE'],
63 'arrow-body-style': 'off',
64 'consistent-return': 'off',
65 curly: ['error', 'all'],
68 'import/named': 'off',
69 'import/default': 'off',
70 'import/namespace': 'off',
71 // Off since we use @trivago/prettier-plugin-sort-imports
72 'import/order': 'off',
73 'import/no-extraneous-dependencies': 'off',
74 'import/no-named-as-default': 'off',
75 'import/no-named-as-default-member': 'off',
76 'import/no-mutable-exports': 'off',
77 'import/no-unresolved': [
84 'import/prefer-default-export': 'off',
85 'no-redeclare': 'off',
86 'no-await-in-loop': 'off',
90 'no-nested-ternary': 'warn',
91 'no-param-reassign': 'off',
93 'no-restricted-imports': [
100 'You should probably import from `@proton/crypto` instead: using `pmcrypto` directly is only needed for crypto-specific use cases.',
105 'no-restricted-syntax': [
109 'TaggedTemplateExpression > TemplateLiteral > TemplateElement.quasis[value.raw=/\\bProton\\b(?!\\s+(Account|Mail|Drive|Calendar|VPN|Verify))/i]',
110 message: 'Use `BRAND_NAME` instead to avoid possible translation.',
114 'TaggedTemplateExpression > TemplateLiteral > TemplateElement.quasis[value.raw=/\\bProton Account\\b/i]',
115 message: 'Use `${BRAND_NAME} Account` instead to allow translation of `Account`.',
119 'TaggedTemplateExpression > TemplateLiteral > TemplateElement.quasis[value.raw=/\\bProton Mail\\b/i]',
120 message: 'Use `MAIL_APP_NAME` instead to avoid possible translation.',
124 'TaggedTemplateExpression > TemplateLiteral > TemplateElement.quasis[value.raw=/\\bProton Drive\\b/i]',
125 message: 'Use `DRIVE_APP_NAME` instead to avoid possible translation.',
129 'TaggedTemplateExpression > TemplateLiteral > TemplateElement.quasis[value.raw=/\\bProton Calendar\\b/i]',
130 message: 'Use `CALENDAR_APP_NAME` instead to avoid possible translation.',
134 'TaggedTemplateExpression > TemplateLiteral > TemplateElement.quasis[value.raw=/\\bProton VPN\\b/i]',
135 message: 'Use `VPN_APP_NAME` instead to avoid possible translation.',
139 'TaggedTemplateExpression > TemplateLiteral > TemplateElement.quasis[value.raw=/\\bProton Verify\\b/i]',
140 message: 'Use `VERIFY_APP_NAME` instead to avoid possible translation.',
144 'no-void': [2, { allowAsStatement: true }],
145 'react-hooks/rules-of-hooks': 'error',
146 'react/display-name': 'warn',
147 'react/jsx-filename-extension': [
150 extensions: ['.js', '.jsx', '.tsx'],
153 'react/jsx-props-no-spreading': 'off',
154 'react/prop-types': 'warn',
155 'react/require-default-props': 'off',
157 * next two rules "off" because of the new JSX transform that
160 'react/jsx-uses-react': 'off',
161 'react/react-in-jsx-scope': 'off',
162 'react/forbid-component-props': [
167 propName: 'data-test-id',
168 message: 'Please use `data-testid` instead',
173 'es/no-regexp-lookbehind-assertions': 'error',
174 'no-only-tests/no-only-tests': 'error',
177 * set up some as warning only, while waiting real feedback
180 'jsx-a11y/anchor-ambiguous-text': 'warn',
181 'jsx-a11y/anchor-is-valid': 'warn',
182 'jsx-a11y/click-events-have-key-events': 'warn',
183 'jsx-a11y/control-has-associated-label': 'warn',
184 'jsx-a11y/interactive-supports-focus': 'warn',
185 'jsx-a11y/label-has-associated-control': 'warn',
186 'jsx-a11y/media-has-caption': 'warn',
187 'jsx-a11y/mouse-events-have-key-events': 'warn',
188 'jsx-a11y/no-static-element-interactions': 'warn',
189 'jsx-a11y/no-interactive-element-to-noninteractive-role': 'warn',
190 'jsx-a11y/no-noninteractive-element-interactions': 'warn',
191 'jsx-a11y/no-noninteractive-tabindex': 'warn',
192 'jsx-a11y/no-aria-hidden-on-focusable': 'warn',
193 'jsx-a11y/prefer-tag-over-role': 'warn',
194 'jsx-a11y/img-redundant-alt': 'off',
195 'jsx-a11y/label-has-for': 'off',
196 'jsx-a11y/no-autofocus': 'off',
197 'jsx-a11y/no-onchange': 'off',
198 'custom-rules/deprecate-spacing-utility-classes': 'warn',
199 'custom-rules/deprecate-responsive-utility-classes': 'warn',
200 'custom-rules/deprecate-sizing-classes': 'warn',
201 'custom-rules/deprecate-classes': 'warn',
202 'custom-rules/no-template-in-translator-context': 'error',
203 '@typescript-eslint/consistent-type-imports': 'error',
204 'lodash/import-scope': [2, 'method'],
208 // The built-in node resolver does not support the `exports` entrypoints.
209 // The TS one is used as a workaround, see https://github.com/import-js/eslint-plugin-import/issues/1810#issuecomment-1189510672
214 ['proton-mail', path.resolve(__dirname, '../../applications/mail/src/app')],
215 ['tests', path.resolve(__dirname, '../../tests')],
216 ['proton-pass-extension', path.resolve(__dirname, '../../applications/pass-extension/src')],
217 ['proton-pass-web', path.resolve(__dirname, '../../applications/pass/src')],
219 extensions: ['.ts', '.tsx'],