Skip to content
Snippets Groups Projects
.eslintrc.json 3.15 KiB
{
	"extends": ["@rocket.chat/eslint-config", "@rocket.chat/eslint-config/react", "plugin:you-dont-need-lodash-underscore/compatible"],
	"globals": {
		"__meteor_bootstrap__": false,
		"__meteor_runtime_config__": false,
		"Assets": false,
		"chrome": false,
		"jscolor": false
	},
	"rules": {
		"import/named": "error",
		"react-hooks/exhaustive-deps": [
			"warn",
			{
				"additionalHooks": "(useComponentDidUpdate)"
			}
		],
		"prefer-arrow-callback": [
			"error",
			{
				"allowNamedFunctions": true
			}
		]
	},
	"overrides": [
		{
			"files": ["**/*.ts", "**/*.tsx"],
			"rules": {
				"@typescript-eslint/naming-convention": [
					"error",
					{
						"selector": ["function", "parameter", "variable"],
						"modifiers": ["destructured"],
						"format": null
					},
					{
						"selector": ["variable"],
						"format": ["camelCase", "UPPER_CASE", "PascalCase"],
						"leadingUnderscore": "allowSingleOrDouble"
					},
					{
						"selector": ["function"],
						"format": ["camelCase", "PascalCase"],
						"leadingUnderscore": "allowSingleOrDouble"
					},
					{
						"selector": ["parameter"],
						"format": ["PascalCase"],
						"filter": {
							"regex": "Component$",
							"match": true
						}
					},
					{
						"selector": ["parameter"],
						"format": ["camelCase"],
						"leadingUnderscore": "allow"
					},
					{
						"selector": ["parameter"],
						"format": ["camelCase"],
						"modifiers": ["unused"],
						"leadingUnderscore": "require"
					},
					{
						"selector": ["interface"],
						"format": ["PascalCase"],
						"custom": {
							"regex": "^I[A-Z]",
							"match": true
						}
					}
				],
				"@typescript-eslint/no-misused-promises": [
					"error",
					{
						"checksVoidReturn": {
							"arguments": false
						}
					}
				],
				"@typescript-eslint/no-floating-promises": "error",
				"no-unreachable-loop": "error"
			},
			"parserOptions": {
				"project": ["./tsconfig.json"]
			},
			"excludedFiles": [".scripts/*.ts"]
		},
		{
			"files": ["**/*.tests.js", "**/*.tests.ts", "**/*.spec.ts"],
			"env": {
				"mocha": true
			}
		},
		{
			"files": ["**/*.spec.ts", "**/*.spec.tsx"],
			"extends": ["plugin:testing-library/react"],
			"rules": {
				"testing-library/no-await-sync-events": "warn",
				"testing-library/no-manual-cleanup": "warn",
				"testing-library/prefer-explicit-assert": "warn",
				"testing-library/prefer-user-event": "warn"
			},
			"env": {
				"mocha": true
			}
		},
		{
			"files": ["**/*.stories.js", "**/*.stories.jsx", "**/*.stories.ts", "**/*.stories.tsx", "**/*.spec.tsx"],
			"rules": {
				"react/display-name": "off",
				"react/no-multi-comp": "off"
			}
		},
		{
			"files": ["**/*.stories.ts", "**/*.stories.tsx"],
			"rules": {
				"@typescript-eslint/explicit-function-return-type": "off",
				"@typescript-eslint/explicit-module-boundary-types": "off"
			}
		},
		{
			"files": ["client/**/*.ts", "client/**/*.tsx", "ee/client/**/*.ts", "ee/client/**/*.tsx"],
			"rules": {
				"@typescript-eslint/no-misused-promises": "off",
				"@typescript-eslint/no-floating-promises": "off"
			}
		},
		{
			"files": ["**/*.d.ts"],
			"rules": {
				"@typescript-eslint/naming-convention": "off"
			}
		}
	]
}