diff --git a/.babelrc b/.babelrc index 6f4f54a93f1..6e6720bbf11 100644 --- a/.babelrc +++ b/.babelrc @@ -1,12 +1,15 @@ { "sourceMaps": true, "presets": [ - ["@babel/preset-env", { - "targets": { - "node": 10 - }, - "modules": "commonjs" - }], + [ + "@babel/preset-env", + { + "targets": { + "node": 10 + }, + "modules": "commonjs" + } + ], "@babel/preset-typescript" ], "plugins": [ diff --git a/.eslintrc.js b/.eslintrc.js index c73e8a44d3f..fd77e6c5e42 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,13 +1,6 @@ module.exports = { - plugins: [ - "matrix-org", - "import", - "jsdoc", - ], - extends: [ - "plugin:matrix-org/babel", - "plugin:import/typescript", - ], + plugins: ["matrix-org", "import", "jsdoc"], + extends: ["plugin:matrix-org/babel", "plugin:import/typescript"], env: { browser: true, node: true, @@ -28,12 +21,15 @@ module.exports = { "padded-blocks": ["error"], "no-extend-native": ["error"], "camelcase": ["error"], - "no-multi-spaces": ["error", { "ignoreEOLComments": true }], - "space-before-function-paren": ["error", { - "anonymous": "never", - "named": "never", - "asyncArrow": "always", - }], + "no-multi-spaces": ["error", { ignoreEOLComments: true }], + "space-before-function-paren": [ + "error", + { + anonymous: "never", + named: "never", + asyncArrow: "always", + }, + ], "arrow-parens": "off", "prefer-promise-reject-errors": "off", "no-constant-condition": "off", @@ -42,76 +38,78 @@ module.exports = { "no-console": "error", // restrict EventEmitters to force callers to use TypedEventEmitter - "no-restricted-imports": ["error", { - name: "events", - message: "Please use TypedEventEmitter instead", - }], - - "import/no-restricted-paths": ["error", { - "zones": [{ - "target": "./src/", - "from": "./src/index.ts", - "message": "The package index is dynamic between src and lib depending on " + - "whether release or development, target the specific module or matrix.ts instead", - }], - }], - }, - overrides: [{ - files: [ - "**/*.ts", - ], - plugins: [ - "eslint-plugin-tsdoc", + "no-restricted-imports": [ + "error", + { + name: "events", + message: "Please use TypedEventEmitter instead", + }, ], - extends: [ - "plugin:matrix-org/typescript", - ], - rules: { - // TypeScript has its own version of this - "@babel/no-invalid-this": "off", - // We're okay being explicit at the moment - "@typescript-eslint/no-empty-interface": "off", - // We disable this while we're transitioning - "@typescript-eslint/no-explicit-any": "off", - // We'd rather not do this but we do - "@typescript-eslint/ban-ts-comment": "off", - // We're okay with assertion errors when we ask for them - "@typescript-eslint/no-non-null-assertion": "off", + "import/no-restricted-paths": [ + "error", + { + zones: [ + { + target: "./src/", + from: "./src/index.ts", + message: + "The package index is dynamic between src and lib depending on " + + "whether release or development, target the specific module or matrix.ts instead", + }, + ], + }, + ], + }, + overrides: [ + { + files: ["**/*.ts"], + plugins: ["eslint-plugin-tsdoc"], + extends: ["plugin:matrix-org/typescript"], + rules: { + // TypeScript has its own version of this + "@babel/no-invalid-this": "off", - // The non-TypeScript rule produces false positives - "func-call-spacing": "off", - "@typescript-eslint/func-call-spacing": ["error"], + // We're okay being explicit at the moment + "@typescript-eslint/no-empty-interface": "off", + // We disable this while we're transitioning + "@typescript-eslint/no-explicit-any": "off", + // We'd rather not do this but we do + "@typescript-eslint/ban-ts-comment": "off", + // We're okay with assertion errors when we ask for them + "@typescript-eslint/no-non-null-assertion": "off", - "quotes": "off", - // We use a `logger` intermediary module - "no-console": "error", + // The non-TypeScript rule produces false positives + "func-call-spacing": "off", + "@typescript-eslint/func-call-spacing": ["error"], + "quotes": "off", + // We use a `logger` intermediary module + "no-console": "error", + }, }, - }, { - // We don't need amazing docs in our spec files - files: [ - "src/**/*.ts", - ], - rules: { - "tsdoc/syntax": "error", - // We use some select jsdoc rules as the tsdoc linter has only one rule - "jsdoc/no-types": "error", - "jsdoc/empty-tags": "error", - "jsdoc/check-property-names": "error", - "jsdoc/check-values": "error", - // These need a bit more work before we can enable - // "jsdoc/check-param-names": "error", - // "jsdoc/check-indentation": "error", + { + // We don't need amazing docs in our spec files + files: ["src/**/*.ts"], + rules: { + "tsdoc/syntax": "error", + // We use some select jsdoc rules as the tsdoc linter has only one rule + "jsdoc/no-types": "error", + "jsdoc/empty-tags": "error", + "jsdoc/check-property-names": "error", + "jsdoc/check-values": "error", + // These need a bit more work before we can enable + // "jsdoc/check-param-names": "error", + // "jsdoc/check-indentation": "error", + }, }, - }, { - files: [ - "spec/**/*.ts", - ], - rules: { - // We don't need super strict typing in test utilities - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/explicit-member-accessibility": "off", + { + files: ["spec/**/*.ts"], + rules: { + // We don't need super strict typing in test utilities + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-member-accessibility": "off", + }, }, - }], + ], }; diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c0b7939a69b..bbaaa050791 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,9 +2,9 @@ ## Checklist -* [ ] Tests written for new code (and old code if feasible) -* [ ] Linter and other CI checks pass -* [ ] Sign-off given on the changes (see [CONTRIBUTING.md](https://github.com/matrix-org/matrix-js-sdk/blob/develop/CONTRIBUTING.md)) +- [ ] Tests written for new code (and old code if feasible) +- [ ] Linter and other CI checks pass +- [ ] Sign-off given on the changes (see [CONTRIBUTING.md](https://github.com/matrix-org/matrix-js-sdk/blob/develop/CONTRIBUTING.md))