* Consolidate modules vitest coverage * Use vite-common as base for modules vitest config * Make knip happier * Fix coverage paths * Place modules unit tests alongside src * Switch to defineProject for better type safety * Consolidate vitest CI & coverage Kills off vite-common * Update comment * Update lockfile * Fix shared-components vitest config * Soften eslint config for tests in modules * Run eslint on modules/playwright dir too * Make tsc happy
76 lines
2.3 KiB
JavaScript
76 lines
2.3 KiB
JavaScript
module.exports = {
|
|
plugins: ["matrix-org", "eslint-plugin-react-compiler"],
|
|
extends: ["plugin:matrix-org/typescript", "plugin:matrix-org/react", "plugin:matrix-org/a11y"],
|
|
parserOptions: {
|
|
project: true,
|
|
},
|
|
env: {
|
|
browser: true,
|
|
node: true,
|
|
},
|
|
rules: {
|
|
"react/jsx-key": ["error"],
|
|
|
|
"no-restricted-properties": [
|
|
"error",
|
|
...buildRestrictedPropertiesOptions(
|
|
["window.innerHeight", "window.innerWidth", "window.visualViewport"],
|
|
"Use UIStore to access window dimensions instead.",
|
|
),
|
|
...buildRestrictedPropertiesOptions(
|
|
["*.mxcUrlToHttp", "*.getHttpUriForMxc"],
|
|
"Use Media helper instead to centralise access for customisation.",
|
|
),
|
|
...buildRestrictedPropertiesOptions(["window.setImmediate"], "Use setTimeout instead."),
|
|
],
|
|
"no-restricted-globals": [
|
|
"error",
|
|
{
|
|
name: "setImmediate",
|
|
message: "Use setTimeout instead.",
|
|
},
|
|
{
|
|
name: "Buffer",
|
|
message: "Buffer is not available in the web.",
|
|
},
|
|
],
|
|
|
|
"import/no-duplicates": ["error"],
|
|
"matrix-org/require-copyright-header": "error",
|
|
|
|
"react-compiler/react-compiler": "error",
|
|
},
|
|
overrides: [
|
|
{
|
|
files: ["playwright/**/*.ts", "*/e2e/**/*.{ts,tsx}", "*/src/**/*.test.{ts,tsx}"],
|
|
rules: {
|
|
// This is necessary for Playwright fixtures
|
|
"no-empty-pattern": "off",
|
|
// This is necessary for Playwright fixtures
|
|
"react-hooks/rules-of-hooks": "off",
|
|
// This just gets annoying in test code
|
|
"@typescript-eslint/explicit-function-return-type": "off",
|
|
},
|
|
},
|
|
],
|
|
settings: {
|
|
react: {
|
|
version: "19",
|
|
},
|
|
},
|
|
};
|
|
|
|
function buildRestrictedPropertiesOptions(properties, message) {
|
|
return properties.map((prop) => {
|
|
let [object, property] = prop.split(".");
|
|
if (object === "*") {
|
|
object = undefined;
|
|
}
|
|
return {
|
|
object,
|
|
property,
|
|
message,
|
|
};
|
|
});
|
|
}
|