Skip to content

Commit

Permalink
feat: add mocha rules
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoAbu committed Mar 8, 2022
1 parent c587a68 commit 28d7fe0
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,30 @@ yarn add --dev eslint-plugin-jest
}
```

### Usage with Mocha

1. Install dependencies:

```sh
yarn add --dev eslint-plugin-mocha
```

2. Update your `.eslintrc` file:

```jsonc
{
"extends": [
"superop",
// "superop/import-resolver-babel", // Uncomment if using directory alises
// "superop/typescript", // Uncomment if using TypeScript
// "superop/react", // Uncomment if using React
// "superop/react-new-jsx", // Uncomment if using the new JSX transform
// "superop/react-native", // Uncomment if using React Native
"superop/mocha",
]
}
```

### Usage with Prettier

This is all you need on your `.prettierrc` file:
Expand Down
23 changes: 23 additions & 0 deletions mocha.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
overrides: [
{
extends: ['plugin:mocha/recommended'],
files: [
'.mocharc.js',
'*.{spec,test}.{js,jsx,ts,tsx}',
'**/test/**/*.{js,jsx,ts,tsx}',
'**/__{mocks,tests}__/**/*.{js,jsx,ts,tsx}',
],
plugins: ['mocha'],
rules: {
'@typescript-eslint/no-misused-promises': [
'error',
{
checksVoidReturn: false,
},
],
'prefer-arrow-callback': [0],
},
},
],
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
".prettierrc.js",
"import-resolver-babel.js",
"jest.js",
"mocha.js",
"react-jest.js",
"react-native.js",
"react-new-jsx.js",
Expand Down

0 comments on commit 28d7fe0

Please sign in to comment.