Migrate to eslint-plugin-matrix-org

This migrates to the new plugin form of our custom ESLint configs. As part of
this, some packages are de-duplicated, configs streamlined, etc.
This commit is contained in:
J. Ryan Stinnett 2021-04-01 13:17:09 +01:00
parent 2d3163fef5
commit 71116bfa27
4 changed files with 208 additions and 634 deletions

View file

@ -1,7 +1,10 @@
module.exports = { module.exports = {
extends: ["matrix-org", "matrix-org/react-legacy"], plugins: ["matrix-org"],
parser: "babel-eslint", extends: [
"plugin:matrix-org/javascript",
"plugin:matrix-org/react",
],
parser: "@babel/eslint-parser",
env: { env: {
browser: true, browser: true,
node: true, node: true,
@ -15,12 +18,30 @@ module.exports = {
"prefer-promise-reject-errors": "off", "prefer-promise-reject-errors": "off",
"no-async-promise-executor": "off", "no-async-promise-executor": "off",
"quotes": "off", "quotes": "off",
}, "no-extra-boolean-cast": "off",
// Bind or arrow functions in props causes performance issues (but we
// currently use them in some places).
// It's disabled here, but we should using it sparingly.
"react/jsx-no-bind": "off",
"react/jsx-key": ["error"],
},
overrides: [{ overrides: [{
"files": ["src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}"], "files": [
"extends": ["matrix-org/ts"], "src/**/*.{ts,tsx}",
"test/**/*.{ts,tsx}",
],
"extends": [
"plugin:matrix-org/typescript",
"plugin:matrix-org/react",
],
"rules": { "rules": {
// Things we do that break the ideal style
"prefer-promise-reject-errors": "off",
"quotes": "off",
"indent": "off",
"no-extra-boolean-cast": "off",
// We're okay being explicit at the moment // We're okay being explicit at the moment
"@typescript-eslint/no-empty-interface": "off", "@typescript-eslint/no-empty-interface": "off",
// We disable this while we're transitioning // We disable this while we're transitioning
@ -28,8 +49,6 @@ module.exports = {
// We'd rather not do this but we do // We'd rather not do this but we do
"@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-ts-comment": "off",
"quotes": "off",
"no-extra-boolean-cast": "off",
"no-restricted-properties": [ "no-restricted-properties": [
"error", "error",
...buildRestrictedPropertiesOptions( ...buildRestrictedPropertiesOptions(

View file

@ -104,6 +104,8 @@
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.12.10", "@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10", "@babel/core": "^7.12.10",
"@babel/eslint-parser": "^7.12.10",
"@babel/eslint-plugin": "^7.12.10",
"@babel/parser": "^7.12.11", "@babel/parser": "^7.12.11",
"@babel/plugin-proposal-class-properties": "^7.12.1", "@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.12.12", "@babel/plugin-proposal-decorators": "^7.12.12",
@ -137,17 +139,16 @@
"@types/react-transition-group": "^4.4.0", "@types/react-transition-group": "^4.4.0",
"@types/sanitize-html": "^2.3.1", "@types/sanitize-html": "^2.3.1",
"@types/zxcvbn": "^4.4.0", "@types/zxcvbn": "^4.4.0",
"@typescript-eslint/eslint-plugin": "^4.14.0", "@typescript-eslint/eslint-plugin": "^4.17.0",
"@typescript-eslint/parser": "^4.14.0", "@typescript-eslint/parser": "^4.17.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.1", "@wojtekmaj/enzyme-adapter-react-17": "^0.6.1",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.6.3", "babel-jest": "^26.6.3",
"chokidar": "^3.5.1", "chokidar": "^3.5.1",
"concurrently": "^5.3.0", "concurrently": "^5.3.0",
"enzyme": "^3.11.0", "enzyme": "^3.11.0",
"eslint": "7.18.0", "eslint": "7.18.0",
"eslint-config-matrix-org": "^0.2.0", "eslint-config-google": "^0.14.0",
"eslint-plugin-babel": "^5.3.1", "eslint-plugin-matrix-org": "github:matrix-org/eslint-plugin-matrix-org#main",
"eslint-plugin-react": "^7.22.0", "eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react-hooks": "^4.2.0",
"glob": "^7.1.6", "glob": "^7.1.6",

View file

@ -5,6 +5,6 @@ module.exports = {
// mocha defines a 'this' // mocha defines a 'this'
rules: { rules: {
"babel/no-invalid-this": "off", "@babel/no-invalid-this": "off",
}, },
}; };

794
yarn.lock

File diff suppressed because it is too large Load diff