2022-03-08 14:17:59 +01:00
|
|
|
/* global module */
|
2020-05-13 14:17:00 +02:00
|
|
|
module.exports = {
|
2021-11-04 23:03:28 +01:00
|
|
|
ignorePatterns: ['node_modules', 'plugin-server'],
|
2020-05-13 14:17:00 +02:00
|
|
|
env: {
|
|
|
|
browser: true,
|
|
|
|
es6: true,
|
2020-06-08 20:34:39 +02:00
|
|
|
'cypress/globals': true,
|
2020-05-13 14:17:00 +02:00
|
|
|
},
|
|
|
|
settings: {
|
|
|
|
react: {
|
|
|
|
version: 'detect',
|
|
|
|
},
|
|
|
|
},
|
2022-03-08 14:17:59 +01:00
|
|
|
extends: [
|
|
|
|
'plugin:@typescript-eslint/recommended',
|
|
|
|
'plugin:react/recommended',
|
2022-05-25 16:38:44 +02:00
|
|
|
'plugin:eslint-comments/recommended',
|
2022-03-08 14:17:59 +01:00
|
|
|
'plugin:storybook/recommended',
|
2022-05-25 16:38:44 +02:00
|
|
|
'prettier',
|
2022-03-08 14:17:59 +01:00
|
|
|
],
|
2020-05-13 14:17:00 +02:00
|
|
|
globals: {
|
|
|
|
Atomics: 'readonly',
|
|
|
|
SharedArrayBuffer: 'readonly',
|
|
|
|
},
|
2020-07-17 19:57:42 +02:00
|
|
|
parser: '@typescript-eslint/parser',
|
2020-05-13 14:17:00 +02:00
|
|
|
parserOptions: {
|
|
|
|
ecmaFeatures: {
|
|
|
|
jsx: true,
|
|
|
|
},
|
2020-07-28 22:25:24 +02:00
|
|
|
ecmaVersion: 2018,
|
|
|
|
sourceType: 'module',
|
2020-05-13 14:17:00 +02:00
|
|
|
},
|
2022-08-04 15:14:11 +02:00
|
|
|
plugins: ['prettier', 'react', 'cypress', '@typescript-eslint', 'no-only-tests'],
|
2020-05-13 14:17:00 +02:00
|
|
|
rules: {
|
2023-07-27 11:51:29 +02:00
|
|
|
'no-console': ['error', { allow: ['warn', 'error'] }],
|
2023-05-11 11:01:27 +02:00
|
|
|
'no-debugger': 'error',
|
2022-08-04 15:14:11 +02:00
|
|
|
'no-only-tests/no-only-tests': 'error',
|
2020-05-13 14:17:00 +02:00
|
|
|
'react/prop-types': [0],
|
2022-10-17 19:30:31 +02:00
|
|
|
'react/react-in-jsx-scope': [0],
|
2020-05-13 14:17:00 +02:00
|
|
|
'react/no-unescaped-entities': [0],
|
2020-08-27 14:34:11 +02:00
|
|
|
'react/jsx-no-target-blank': [0],
|
2020-10-26 11:45:57 +01:00
|
|
|
'react/self-closing-comp': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
component: true,
|
|
|
|
html: true,
|
|
|
|
},
|
|
|
|
],
|
2022-05-25 16:38:44 +02:00
|
|
|
'no-unused-vars': 'off',
|
|
|
|
'@typescript-eslint/no-unused-vars': [
|
2022-03-08 14:17:59 +01:00
|
|
|
'error',
|
|
|
|
{
|
|
|
|
ignoreRestSiblings: true,
|
|
|
|
},
|
|
|
|
],
|
2022-05-25 16:38:44 +02:00
|
|
|
'@typescript-eslint/prefer-ts-expect-error': 'error',
|
2020-07-08 09:45:23 +02:00
|
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
|
|
'@typescript-eslint/no-empty-function': 'off',
|
2020-07-28 22:25:24 +02:00
|
|
|
'@typescript-eslint/no-inferrable-types': 'off',
|
2021-02-09 18:11:53 +01:00
|
|
|
'@typescript-eslint/ban-ts-comment': 'off',
|
2021-07-01 04:27:36 +02:00
|
|
|
'@typescript-eslint/no-non-null-assertion': 'error',
|
2020-11-25 17:46:49 +01:00
|
|
|
curly: 'error',
|
2022-01-20 13:13:29 +01:00
|
|
|
'no-restricted-imports': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
paths: [
|
|
|
|
{
|
|
|
|
name: 'dayjs',
|
|
|
|
message: 'Do not directly import dayjs. Only import the dayjs exported from lib/dayjs.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2022-08-02 10:49:06 +02:00
|
|
|
'react/forbid-dom-props': [
|
|
|
|
1,
|
|
|
|
{
|
|
|
|
forbid: [
|
|
|
|
{
|
|
|
|
propName: 'style',
|
|
|
|
message:
|
|
|
|
'style should be avoided in favor of utility CSS classes - see https://storybook.posthog.net/?path=/docs/lemon-ui-utilities--overview',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'react/forbid-elements': [
|
|
|
|
1,
|
|
|
|
{
|
|
|
|
forbid: [
|
|
|
|
{
|
|
|
|
element: 'Row',
|
|
|
|
message:
|
2023-01-12 12:37:17 +01:00
|
|
|
'use flex utility classes instead, e.g. <Row align="middle"> could be <div className="flex items-center">',
|
2022-08-02 10:49:06 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
element: 'Col',
|
2023-01-12 12:37:17 +01:00
|
|
|
message: 'use flex utility classes instead - most of the time can simply be a plain <div>',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
element: 'Space',
|
|
|
|
message: 'use flex or space utility classes instead',
|
|
|
|
},
|
2023-08-04 15:49:45 +02:00
|
|
|
{
|
|
|
|
element: 'Divider',
|
|
|
|
message: 'use <LemonDivider> instead',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
element: 'Typography',
|
|
|
|
message: 'use utility classes instead',
|
|
|
|
},
|
2023-01-12 12:37:17 +01:00
|
|
|
{
|
|
|
|
element: 'Card',
|
|
|
|
message: 'use utility classes instead',
|
2022-08-02 10:49:06 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
element: 'Button',
|
|
|
|
message: 'use <LemonButton> instead',
|
|
|
|
},
|
2022-08-16 11:07:50 +02:00
|
|
|
{
|
|
|
|
element: 'Input.TextArea',
|
|
|
|
message: 'use <LemonTextArea> instead',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
element: 'Input',
|
|
|
|
message: 'use <LemonInput> instead',
|
|
|
|
},
|
2022-09-08 15:54:00 +02:00
|
|
|
{
|
|
|
|
element: 'Skeleton',
|
|
|
|
message: 'use <LemonSkeleton> instead',
|
|
|
|
},
|
2023-02-13 17:13:07 +01:00
|
|
|
{
|
2023-08-04 15:49:45 +02:00
|
|
|
element: 'Modal',
|
|
|
|
message: 'use <LemonModal> or `<LemonDialog> instead',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
element: 'Select',
|
|
|
|
message: 'use <LemonSelect> instead',
|
2023-02-13 17:13:07 +01:00
|
|
|
},
|
2022-09-08 14:23:28 +02:00
|
|
|
{
|
|
|
|
element: 'a',
|
|
|
|
message: 'use <Link> instead',
|
|
|
|
},
|
2022-08-02 10:49:06 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2023-01-12 12:37:17 +01:00
|
|
|
'react/forbid-elements': [
|
|
|
|
2,
|
|
|
|
{
|
|
|
|
forbid: [
|
|
|
|
{
|
|
|
|
element: 'Layout',
|
|
|
|
message: 'use utility classes instead',
|
|
|
|
},
|
2023-08-04 15:49:45 +02:00
|
|
|
{
|
|
|
|
element: 'Tabs',
|
|
|
|
message: 'use <LemonTabs> instead',
|
|
|
|
},
|
2023-01-12 12:37:17 +01:00
|
|
|
{
|
|
|
|
element: 'Spin',
|
|
|
|
message: 'use Spinner instead',
|
|
|
|
},
|
2023-01-18 15:50:51 +01:00
|
|
|
{
|
|
|
|
element: 'Badge',
|
|
|
|
message: 'use LemonBadge instead',
|
|
|
|
},
|
2023-03-10 15:55:26 +01:00
|
|
|
{
|
|
|
|
element: 'Collapse',
|
|
|
|
message: 'use <LemonCollapse> instead',
|
|
|
|
},
|
2023-01-12 12:37:17 +01:00
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2020-05-13 14:17:00 +02:00
|
|
|
},
|
2020-07-08 09:45:23 +02:00
|
|
|
overrides: [
|
2020-07-28 22:25:24 +02:00
|
|
|
{
|
2023-01-12 12:37:17 +01:00
|
|
|
// disable these rules for files generated by kea-typegen
|
2020-07-28 22:25:24 +02:00
|
|
|
files: ['*Type.ts', '*Type.tsx'],
|
|
|
|
rules: {
|
|
|
|
'@typescript-eslint/no-explicit-any': ['off'],
|
|
|
|
'@typescript-eslint/ban-types': ['off'],
|
|
|
|
},
|
|
|
|
},
|
2020-07-08 09:45:23 +02:00
|
|
|
{
|
|
|
|
// enable the rule specifically for TypeScript files
|
|
|
|
files: ['*.ts', '*.tsx'],
|
|
|
|
rules: {
|
2020-07-28 22:25:24 +02:00
|
|
|
'@typescript-eslint/no-explicit-any': ['off'],
|
|
|
|
'@typescript-eslint/explicit-function-return-type': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
allowExpressions: true,
|
|
|
|
},
|
|
|
|
],
|
2020-10-14 10:42:06 +02:00
|
|
|
'@typescript-eslint/explicit-module-boundary-types': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
allowArgumentsExplicitlyTypedAsAny: true,
|
|
|
|
},
|
|
|
|
],
|
2020-07-08 09:45:23 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['*.js'],
|
|
|
|
rules: {
|
2021-01-13 00:46:59 +01:00
|
|
|
'@typescript-eslint/no-var-requires': 'off',
|
2020-07-08 09:45:23 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2022-05-25 16:38:44 +02:00
|
|
|
reportUnusedDisableDirectives: true,
|
2020-05-13 14:17:00 +02:00
|
|
|
}
|