Add ESLint Jest (#10261)
This commit is contained in:
parent
db7748b743
commit
5398db21ad
55 changed files with 336 additions and 351 deletions
26
.eslintrc.js
26
.eslintrc.js
|
@ -165,10 +165,31 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
files: ["test/**/*.{ts,tsx}", "cypress/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/jest"],
|
||||
rules: {
|
||||
// We don't need super strict typing in test utilities
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"@typescript-eslint/explicit-member-accessibility": "off",
|
||||
|
||||
// Jest/Cypress specific
|
||||
|
||||
// Disabled tests are a reality for now but as soon as all of the xits are
|
||||
// eliminated, we should enforce this.
|
||||
"jest/no-disabled-tests": "off",
|
||||
// TODO: There are many tests with invalid expects that should be fixed,
|
||||
// https://github.com/vector-im/element-web/issues/24709
|
||||
"jest/valid-expect": "off",
|
||||
// TODO: There are many cases to refactor away,
|
||||
// https://github.com/vector-im/element-web/issues/24710
|
||||
"jest/no-conditional-expect": "off",
|
||||
// Also treat "oldBackendOnly" as a test function.
|
||||
// Used in some crypto tests.
|
||||
"jest/no-standalone-expect": [
|
||||
"error",
|
||||
{
|
||||
additionalTestBlockFunctions: ["beforeAll", "beforeEach", "oldBackendOnly"],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -176,6 +197,11 @@ module.exports = {
|
|||
parserOptions: {
|
||||
project: ["./cypress/tsconfig.json"],
|
||||
},
|
||||
rules: {
|
||||
// Cypress "promises" work differently - disable some related rules
|
||||
"jest/valid-expect-in-promise": "off",
|
||||
"jest/no-done-callback": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
settings: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue