saleor-dashboard/.eslintrc.json
Michał Droń 3123f04c69
Upgrade to ESLint 8 (#3781)
* Upgrade ESLint

* Add eslint-nibble

* Move typescript to dev deps

* Update ESLint config

* Turn off semi, comma-dangle & quotes rules

* Enable simple sort

* Fix errors in ESLint (#3788)

* Disable rules requiring heavy changes

* Autofix new ESLint rules

* Autofix more-rules

* Fix jsx/generics ambiguity

* Add warnings for broken rules requiring manual fixes

* Remove redundant expected-error

* Add simple-sort

* Add prettier config

* Lint config

* Fix sort plugin

* Fix simple sort plugin

* Fix sort order

* Update src/orders/components/OrderTransaction/components/TransactionEvents/components/PspReferenceLink.tsx

Co-authored-by: Paweł Chyła <chyla1988@gmail.com>

* Remove redundant comment

* Remove chai friendly

* Update package.json

Co-authored-by: Krzysztof Żuraw <9116238+krzysztofzuraw@users.noreply.github.com>

* Remove to-be-checked comment

* Update formatjs plugin

* Lint staged only in src

* Add changeset

* Add tracking issue for new rules

* Resolve auto-fixable warning after merge

* Change sorts to warnings

* Run lint on new files

* Fix errors

---------

Co-authored-by: Paweł Chyła <chyla1988@gmail.com>
Co-authored-by: Krzysztof Żuraw <9116238+krzysztofzuraw@users.noreply.github.com>
2023-06-30 10:07:13 +02:00

115 lines
4 KiB
JSON

{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"standard-with-typescript",
"plugin:react/recommended",
"prettier"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
},
"settings": {
"react": {
"version": "detect"
}
},
"plugins": [
"react",
"import",
"local-rules",
"cypress",
"formatjs",
"react-refresh",
"react-hooks",
"simple-import-sort"
],
"overrides": [
{
"files": ["src/**/*.test.*", "src/**/*.stories.*"],
"rules": {
"react-refresh/only-export-components": "off"
}
}
],
"rules": {
"@typescript-eslint/semi": ["off"],
"@typescript-eslint/quotes": ["off", "double"],
"import/no-duplicates": "error",
"import/no-extraneous-dependencies": "off", // imports are handled by simple-import-sort/sort
"import/no-internal-modules": "off", // imports are handled by simple-import-sort/sort
"import/order": "off", // imports are handled by simple-import-sort/sort
"sort-imports": "off", // imports are handled by simple-import-sort/sort
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"react-refresh/only-export-components": "warn",
"react-hooks/rules-of-hooks": "error",
"formatjs/enforce-id": [
"error",
{
"idInterpolationPattern": "[sha512:contenthash:base64:6]"
}
],
"local-rules/named-styles": "error",
"no-restricted-imports": [
"error",
{
"paths": ["lodash", "@material-ui/icons/Delete", "classnames"]
}
],
// These rules should be reviewed - tracked in
// Tracked in https://github.com/saleor/saleor-dashboard/issues/3813
"@typescript-eslint/consistent-type-imports": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/method-signature-style": "off",
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/prefer-reduce-type-parameter": "off",
"@typescript-eslint/promise-function-async": "off",
"@typescript-eslint/return-await": "off",
"@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"multiline-ternary": "off",
"no-extra-boolean-cast": "off",
"@typescript-eslint/await-thenable": "warn",
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/ban-types": "warn",
"@typescript-eslint/consistent-type-assertions": "warn",
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/no-base-to-string": "warn",
"@typescript-eslint/no-dynamic-delete": "warn",
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-invalid-void-type": "warn",
"@typescript-eslint/no-misused-promises": "warn",
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-redeclare": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/restrict-plus-operands": "warn",
"@typescript-eslint/restrict-template-expressions": "warn",
"array-callback-return": "warn",
"import/export": "warn",
"n/no-callback-literal": "warn",
"no-case-declarations": "warn",
"no-empty-pattern": "warn",
"no-fallthrough": "warn",
"no-new": "warn",
"no-prototype-builtins": "warn",
"no-unreachable": "warn",
"no-useless-catch": "warn",
"no-useless-escape": "warn",
"prefer-promise-reject-errors": "warn",
"react/display-name": "warn",
"react/jsx-key": "warn",
"react/prop-types": "warn",
"symbol-description": "warn"
},
"ignorePatterns": ["node_modules/", "**/types/**/*", "type-policies.ts"]
}