/** @format */
{
	"root": true,
	"parser": "babel-eslint",
	"extends": [
		"wpcalypso/react",
		"plugin:jsx-a11y/recommended",
		"prettier",
		"plugin:@woocommerce/eslint-plugin/recommended"
	],
	"plugins": [ "jsx-a11y", "jest", "jsdoc-alignment" ],
	"env": {
		"browser": true,
		"jest/globals": true,
		"node": true
	},
	"globals": {
		"wp": true,
		"wpApiSettings": true,
		"wcSettings": true,
		"wcpaySettings": true,
		"page": true,
		"browser": true,
		"context": true,
		"jestPuppeteer": true
	},
	"settings": {
		"react": {
			"version": "detect"
		},
		"import/resolver": {
			"typescript": {}
		}
	},
	"ignorePatterns": [ "docs/rest-api/source/**/*.js" ],
	"rules": {
		"camelcase": [
			"error",
			{
				"properties": "never",
				"ignoreGlobals": true
			}
		],
		"import/no-extraneous-dependencies": "off",
		"indent": "off",
		"max-len": [
			"error",
			{
				"code": 140
			}
		],
		"no-console": "warn",
		"react/no-danger": "off",
		"react/react-in-jsx-scope": "off",
		"wpcalypso/import-no-redux-combine-reducers": "off",
		"wpcalypso/jsx-classname-namespace": "off",
		"wpcalypso/redux-no-bound-selectors": "warn",
		"react/jsx-curly-spacing": [
			2,
			{
				"when": "always",
				"children": {
					"when": "always"
				}
			}
		],
		"jsx-a11y/label-has-for": [
			"error",
			{
				"required": "id"
			}
		],
		"jsdoc/check-tag-names": [
			"error",
			{
				"definedTags": [ "format" ]
			}
		],
		/* partially disable rules to get @woocommerce/eslint-plugin integration done */
		"jsdoc/no-undefined-types": "off",
		"jsdoc/require-param": "off",
		"jsdoc/check-param-names": "off",
		"jsdoc/require-property": "off",
		"@wordpress/no-global-event-listener": "off",
		"@wordpress/no-unused-vars-before-return": "off",
		"@wordpress/i18n-translator-comments": "off",
		"@wordpress/valid-sprintf": "off",
		"@woocommerce/dependency-group": "off",
		"react-hooks/exhaustive-deps": "error",
		"react-hooks/rules-of-hooks": "error",
		"jest/no-conditional-expect": "off",
		"jest/valid-title": "off",
		"jest/expect-expect": "off",
		"jest/no-disabled-tests": "off",
		"jest/no-standalone-expect": "off",
		"jest/no-identical-title": "off",
		"jest/no-deprecated-functions": "off",
		"no-alert": "off",
		"object-shorthand": "off",
		"no-multi-str": "off",
		"no-restricted-syntax": [
			"error",
			{
				"selector": "ImportDeclaration[source.value=/gridicons(?!\\u002F)/]",
				"message": "Do not import whole Gridicons, import them individually with 'gridicons/dist/icon-name'."
			}
		]
	},
	"overrides": [
		{
			"files": [ "*.ts", "*.tsx" ],
			"parser": "@typescript-eslint/parser",
			"plugins": [ "jsx-a11y", "jest", "@typescript-eslint" ],
			"extends": [
				"wpcalypso/react",
				"plugin:jsx-a11y/recommended",
				"plugin:@typescript-eslint/recommended",
				"prettier",
				"prettier/@typescript-eslint"
			],
			"rules": {
				"camelcase": "off",
				"@typescript-eslint/naming-convention": [
					"error",
					{
						"selector": [ "method", "variableLike" ],
						"format": [ "camelCase", "PascalCase" ]
					},
					{
						"selector": "typeProperty",
						"format": [ "camelCase", "snake_case" ]
					}
				],
				"@typescript-eslint/no-explicit-any": "off",
				"no-use-before-define": "off",
				"@typescript-eslint/no-use-before-define": [ "error" ],
				"@typescript-eslint/explicit-module-boundary-types": "off",
				"wpcalypso/jsx-classname-namespace": "off",
				"react/react-in-jsx-scope": "error",
				"no-shadow": "off",
				"@typescript-eslint/no-shadow": "error",
				"jsdoc/require-param-type": 0,
				"jsdoc/require-returns-type": 0,
				"valid-jsdoc": "off"
			}
		}
	]
}
