mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-28 18:26:15 +01:00
59d4398646
* Remove redundant Playwright specs * Increase tolerance in Playwright * Wait for profile pictures to resolve * Ensure scene is loaded before proceeding * Always wait for loaders to disappear * Disable Gravatars in snapshots * Don't wait for loaders in more stories with loaders * Improve resiliency of batch export story * Fix one more loading story * Unskip Playwright tests * Improve inconsistencies * Upgrade Playwright from 1.29.2 to 1.37.1 * Wait for images to load * Unify code editors * Properly wait for images to load * Go back to Playwright 1.29.2 * Wait for loader selector in LemonTable stories * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
237 lines
7.5 KiB
JavaScript
237 lines
7.5 KiB
JavaScript
/* global module */
|
|
|
|
const env = {
|
|
browser: true,
|
|
es6: true,
|
|
'cypress/globals': true,
|
|
}
|
|
|
|
const globals = {
|
|
Atomics: 'readonly',
|
|
SharedArrayBuffer: 'readonly',
|
|
}
|
|
|
|
module.exports = {
|
|
ignorePatterns: ['node_modules', 'plugin-server'],
|
|
env,
|
|
settings: {
|
|
react: {
|
|
version: 'detect',
|
|
},
|
|
},
|
|
extends: [
|
|
'eslint:recommended',
|
|
'plugin:@typescript-eslint/recommended',
|
|
'plugin:react/recommended',
|
|
'plugin:eslint-comments/recommended',
|
|
'plugin:storybook/recommended',
|
|
'prettier',
|
|
],
|
|
globals,
|
|
parser: '@typescript-eslint/parser',
|
|
parserOptions: {
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
ecmaVersion: 2018,
|
|
sourceType: 'module',
|
|
},
|
|
plugins: ['prettier', 'react', 'cypress', '@typescript-eslint', 'no-only-tests', 'jest'],
|
|
rules: {
|
|
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
'no-debugger': 'error',
|
|
'no-only-tests/no-only-tests': 'error',
|
|
'react/prop-types': [0],
|
|
'react/react-in-jsx-scope': [0],
|
|
'react/no-unescaped-entities': [0],
|
|
'react/jsx-no-target-blank': [0],
|
|
'react/self-closing-comp': [
|
|
'error',
|
|
{
|
|
component: true,
|
|
html: true,
|
|
},
|
|
],
|
|
'no-unused-vars': 'off',
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'error',
|
|
{
|
|
ignoreRestSiblings: true,
|
|
},
|
|
],
|
|
'@typescript-eslint/prefer-ts-expect-error': 'error',
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
'@typescript-eslint/no-empty-function': 'off',
|
|
'@typescript-eslint/no-inferrable-types': 'off',
|
|
'@typescript-eslint/ban-ts-comment': 'off',
|
|
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
curly: 'error',
|
|
'no-restricted-imports': [
|
|
'error',
|
|
{
|
|
paths: [
|
|
{
|
|
name: 'dayjs',
|
|
message: 'Do not directly import dayjs. Only import the dayjs exported from lib/dayjs.',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
'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:
|
|
'use flex utility classes instead, e.g. <Row align="middle"> could be <div className="flex items-center">',
|
|
},
|
|
{
|
|
element: 'Col',
|
|
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',
|
|
},
|
|
{
|
|
element: 'Divider',
|
|
message: 'use <LemonDivider> instead',
|
|
},
|
|
{
|
|
element: 'Typography',
|
|
message: 'use utility classes instead',
|
|
},
|
|
{
|
|
element: 'Card',
|
|
message: 'use utility classes instead',
|
|
},
|
|
{
|
|
element: 'Button',
|
|
message: 'use <LemonButton> instead',
|
|
},
|
|
{
|
|
element: 'Input.TextArea',
|
|
message: 'use <LemonTextArea> instead',
|
|
},
|
|
{
|
|
element: 'Input',
|
|
message: 'use <LemonInput> instead',
|
|
},
|
|
{
|
|
element: 'Skeleton',
|
|
message: 'use <LemonSkeleton> instead',
|
|
},
|
|
{
|
|
element: 'Modal',
|
|
message: 'use <LemonModal> or `<LemonDialog> instead',
|
|
},
|
|
{
|
|
element: 'Select',
|
|
message: 'use <LemonSelect> instead',
|
|
},
|
|
{
|
|
element: 'a',
|
|
message: 'use <Link> instead',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
'react/forbid-elements': [
|
|
2,
|
|
{
|
|
forbid: [
|
|
{
|
|
element: 'Layout',
|
|
message: 'use utility classes instead',
|
|
},
|
|
{
|
|
element: 'Tabs',
|
|
message: 'use <LemonTabs> instead',
|
|
},
|
|
{
|
|
element: 'Spin',
|
|
message: 'use Spinner instead',
|
|
},
|
|
{
|
|
element: 'Badge',
|
|
message: 'use LemonBadge instead',
|
|
},
|
|
{
|
|
element: 'Collapse',
|
|
message: 'use <LemonCollapse> instead',
|
|
},
|
|
{
|
|
element:'MonacoEditor',
|
|
message: 'use <CodeEditor> instead',
|
|
}
|
|
],
|
|
},
|
|
],
|
|
'no-constant-condition': 0,
|
|
'no-prototype-builtins': 0,
|
|
'no-irregular-whitespace': 0,
|
|
},
|
|
overrides: [
|
|
{
|
|
files: ['**/test/**/*', '**/*.test.*'],
|
|
env: {
|
|
...env,
|
|
node: true,
|
|
'jest/globals': true,
|
|
},
|
|
globals: {
|
|
...globals,
|
|
given: 'readonly',
|
|
},
|
|
},
|
|
{
|
|
// disable these rules for files generated by kea-typegen
|
|
files: ['*Type.ts', '*Type.tsx'],
|
|
rules: {
|
|
'@typescript-eslint/no-explicit-any': ['off'],
|
|
'@typescript-eslint/ban-types': ['off'],
|
|
},
|
|
},
|
|
{
|
|
// enable the rule specifically for TypeScript files
|
|
files: ['*.ts', '*.tsx'],
|
|
rules: {
|
|
'@typescript-eslint/no-explicit-any': ['off'],
|
|
'@typescript-eslint/explicit-function-return-type': [
|
|
'error',
|
|
{
|
|
allowExpressions: true,
|
|
},
|
|
],
|
|
'@typescript-eslint/explicit-module-boundary-types': [
|
|
'error',
|
|
{
|
|
allowArgumentsExplicitlyTypedAsAny: true,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ['*.js'],
|
|
rules: {
|
|
'@typescript-eslint/no-var-requires': 'off',
|
|
},
|
|
},
|
|
],
|
|
reportUnusedDisableDirectives: true,
|
|
}
|