From f919d1654a1f9908df52d849eecab4be7b6f751c Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 5 Nov 2024 18:33:42 +0000 Subject: [PATCH] Simplify eslint configs Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .eslintrc-module_system.js | 60 -------------------------------------- .eslintrc.js | 54 ++++++++++++++++++++++++++++++++++ .lintstagedrc | 2 +- package.json | 8 ++--- 4 files changed, 57 insertions(+), 67 deletions(-) delete mode 100644 .eslintrc-module_system.js diff --git a/.eslintrc-module_system.js b/.eslintrc-module_system.js deleted file mode 100644 index d56087e522..0000000000 --- a/.eslintrc-module_system.js +++ /dev/null @@ -1,60 +0,0 @@ -module.exports = { - plugins: ["matrix-org"], - extends: ["./.eslintrc.js"], - parserOptions: { - project: ["./tsconfig.module_system.json"], - }, - overrides: [ - { - files: ["module_system/**/*.{ts,tsx}"], - extends: ["plugin:matrix-org/typescript", "plugin:matrix-org/react"], - // NOTE: These rules are frozen and new rules should not be added here. - // New changes belong in https://github.com/matrix-org/eslint-plugin-matrix-org/ - rules: { - // Things we do that break the ideal style - "prefer-promise-reject-errors": "off", - "quotes": "off", - - // We disable this while we're transitioning - "@typescript-eslint/no-explicit-any": "off", - // We're okay with assertion errors when we ask for them - "@typescript-eslint/no-non-null-assertion": "off", - - // Ban matrix-js-sdk/src imports in favour of matrix-js-sdk/src/matrix imports to prevent unleashing hell. - "no-restricted-imports": [ - "error", - { - paths: [ - { - name: "matrix-js-sdk", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - { - name: "matrix-js-sdk/src/index", - message: "Please use matrix-js-sdk/src/matrix instead", - }, - ], - patterns: [ - { - group: ["matrix-js-sdk/lib", "matrix-js-sdk/lib/", "matrix-js-sdk/lib/**"], - message: "Please use matrix-js-sdk/src/* instead", - }, - ], - }, - ], - }, - }, - ], -}; diff --git a/.eslintrc.js b/.eslintrc.js index dd406134fe..e95f4834e9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -270,6 +270,60 @@ module.exports = { "react-hooks/rules-of-hooks": ["off"], }, }, + { + files: ["module_system/**/*.{ts,tsx}"], + parserOptions: { + project: ["./tsconfig.module_system.json"], + }, + extends: ["plugin:matrix-org/typescript", "plugin:matrix-org/react"], + // NOTE: These rules are frozen and new rules should not be added here. + // New changes belong in https://github.com/matrix-org/eslint-plugin-matrix-org/ + rules: { + // Things we do that break the ideal style + "prefer-promise-reject-errors": "off", + "quotes": "off", + + // We disable this while we're transitioning + "@typescript-eslint/no-explicit-any": "off", + // We're okay with assertion errors when we ask for them + "@typescript-eslint/no-non-null-assertion": "off", + + // Ban matrix-js-sdk/src imports in favour of matrix-js-sdk/src/matrix imports to prevent unleashing hell. + "no-restricted-imports": [ + "error", + { + paths: [ + { + name: "matrix-js-sdk", + message: "Please use matrix-js-sdk/src/matrix instead", + }, + { + name: "matrix-js-sdk/", + message: "Please use matrix-js-sdk/src/matrix instead", + }, + { + name: "matrix-js-sdk/src", + message: "Please use matrix-js-sdk/src/matrix instead", + }, + { + name: "matrix-js-sdk/src/", + message: "Please use matrix-js-sdk/src/matrix instead", + }, + { + name: "matrix-js-sdk/src/index", + message: "Please use matrix-js-sdk/src/matrix instead", + }, + ], + patterns: [ + { + group: ["matrix-js-sdk/lib", "matrix-js-sdk/lib/", "matrix-js-sdk/lib/**"], + message: "Please use matrix-js-sdk/src/* instead", + }, + ], + }, + ], + }, + }, ], settings: { react: { diff --git a/.lintstagedrc b/.lintstagedrc index c07ed8df5b..6b93e89d5a 100644 --- a/.lintstagedrc +++ b/.lintstagedrc @@ -2,6 +2,6 @@ "*": "prettier --write", "src/**/*.(ts|tsx)": ["eslint --fix"], "scripts/**/*.(ts|tsx)": ["eslint --fix"], - "module_system/**/*.(ts|tsx)": ["eslint --fix --config .eslintrc-module_system.js module_system"], + "module_system/**/*.(ts|tsx)": ["eslint --fix"], "*.pcss": ["stylelint --fix"] } diff --git a/package.json b/package.json index 2f26fdbb3e..62b5e9a3d3 100644 --- a/package.json +++ b/package.json @@ -51,12 +51,8 @@ "start:res": "ts-node scripts/copy-res.ts -w", "start:js": "webpack serve --output-path webapp --output-filename=bundles/_dev_/[name].js --output-chunk-filename=bundles/_dev_/[name].js --mode development", "lint": "yarn lint:types && yarn lint:js && yarn lint:style && yarn lint:workflows", - "lint:js": "yarn lint:js:src && yarn lint:js:module_system", - "lint:js:src": "eslint --max-warnings 0 src test playwright && prettier --check .", - "lint:js:module_system": "eslint --max-warnings 0 --config .eslintrc-module_system.js module_system", - "lint:js-fix": "yarn lint:js-fix:src && yarn lint:js-fix:module_system", - "lint:js-fix:src": "prettier --log-level=warn --write . && eslint --fix src test playwright", - "lint:js-fix:module_system": "eslint --fix --config .eslintrc-module_system.js module_system", + "lint:js": "eslint --max-warnings 0 src test playwright module_system && prettier --check .", + "lint:js-fix": "prettier --log-level=warn --write . && eslint --fix src test playwright module_system", "lint:types": "yarn lint:types:src && yarn lint:types:module_system", "lint:types:src": "tsc --noEmit --jsx react && tsc --noEmit --jsx react -p playwright", "lint:types:module_system": "tsc --noEmit --project ./tsconfig.module_system.json",