diff --git a/README.md b/README.md index 781409b..34f1d18 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,10 @@ This package contains several main ESLint configs for different project styles: - `matrix-org/typescript`: The style for TypeScript projects. It extends `matrix-org/javascript`. -There is also a mixin config that can be used together with any of the above: +There are also some mixin configs that can be used together with any of the above: - `matrix-org/react`: The style for React projects. +- `matrix-org/jest`: The style for projects that use Jest for testing. # Getting started @@ -101,7 +102,7 @@ Standard TypeScript with React } ``` -Standard TypeScript with React and jsx a11y +Standard TypeScript with React, jsx a11y, and Jest ```js { plugins: [ @@ -111,6 +112,7 @@ Standard TypeScript with React and jsx a11y "plugin:matrix-org/typescript", "plugin:matrix-org/react", "plugin:matrix-org/a11y" + "plugin:matrix-org/jest" ] } ``` @@ -145,6 +147,7 @@ following depending on the configs you enable: * eslint-config-google * eslint-config-prettier * eslint-plugin-deprecate +* eslint-plugin-jest * eslint-plugin-jsx-a11y * eslint-plugin-react * eslint-plugin-react-hooks diff --git a/index.js b/index.js index e2b15a8..f722493 100644 --- a/index.js +++ b/index.js @@ -8,5 +8,6 @@ module.exports = { "react": require("./react"), "typescript": require("./typescript"), "a11y": require("./a11y"), + "jest": require("./jest"), }, }; diff --git a/jest.js b/jest.js new file mode 100644 index 0000000..ee0a648 --- /dev/null +++ b/jest.js @@ -0,0 +1,18 @@ +module.exports = { + plugins: ["jest"], + extends: ["plugin:jest/recommended"], + rules: { + "jest/no-standalone-expect": [ + "error", + { + additionalTestBlockFunctions: [ + "beforeAll", + "beforeEach", + ], + }, + ], + // It's ok to have no expect assertions in your test. Maybe you're testing that + // things just don't blow up. + "jest/expect-expect": "off", + }, +}; diff --git a/package.json b/package.json index 2484450..3df9951 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "eslint-config-prettier": "*", "eslint-plugin-deprecate": "*", "eslint-plugin-import": "*", + "eslint-plugin-jest": "*", "eslint-plugin-jsx-a11y": "*", "eslint-plugin-react": "*", "eslint-plugin-react-hooks": "*",