-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a basic mocha configuration (#85)
* add a basic mocha configuration * Update validate.test.js
- Loading branch information
Showing
13 changed files
with
1,976 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "twilio", | ||
"parserOptions": { | ||
"ecmaVersion": 9, | ||
"sourceType": "module" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# eslint-config-twilio-mocha | ||
|
||
[![Version](https://img.shields.io/npm/v/eslint-config-twilio-mocha.svg?style=square)](https://www.npmjs.com/package/eslint-config-twilio-mocha) | ||
[![Downloads](https://img.shields.io/npm/dt/eslint-config-twilio-mocha.svg?style=square)](https://www.npmjs.com/package/eslint-config-twilio-mocha) | ||
[![License](https://img.shields.io/npm/l/eslint-config-twilio.svg?style=square)](../../LICENSE) | ||
|
||
Twilio's approach to Mocha/Chai styling. | ||
|
||
## Plugins and Extensions | ||
|
||
This config includes the following plugins and extensions: | ||
|
||
- [`eslint-plugin-chai-friendly`](https://www.npmjs.com/package/eslint-plugin-chai-friendly) | ||
|
||
## Installation | ||
|
||
```bash | ||
$ npm install eslint eslint-config-twilio-mocha --save-dev | ||
``` | ||
|
||
## Usage | ||
|
||
Add the ESLint config to either your `package.json` or your `.eslintrc`: | ||
|
||
### package.json | ||
|
||
```json | ||
{ | ||
"name": "my-project", | ||
"eslintConfig": { | ||
"extends": [ | ||
"twilio-mocha" | ||
] | ||
} | ||
} | ||
``` | ||
|
||
### .eslintrc | ||
|
||
```json | ||
{ | ||
"extends": [ | ||
"twilio-mocha" | ||
] | ||
} | ||
``` | ||
|
||
Then add the following two scripts for running and fixing your codebase: | ||
|
||
```json | ||
{ | ||
"scripts": { | ||
"lint": "eslint --ext js --ext jsx src/ test/", | ||
"lint:fix": "npm run lint -- --fix" | ||
} | ||
} | ||
``` | ||
|
||
### .prettier.js | ||
|
||
If you want to allow your IDE to auto-format your code as you save it, then create a `.prettierrc.js` and add: | ||
|
||
```js | ||
const baseConfig = require('./node_modules/eslint-config-twilio/rules/prettier'); | ||
|
||
module.exports = { | ||
...baseConfig, | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const overrides = require('./overrides'); | ||
|
||
module.exports = { | ||
extends: ['twilio'], | ||
plugins: ['chai-friendly'], | ||
overrides: [overrides], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const base = require('./../../jest.base'); | ||
const pkg = require('./package'); | ||
|
||
module.exports = { | ||
...base, | ||
name: pkg.name, | ||
displayName: pkg.name, | ||
rootDir: '../..', | ||
testMatch: [ | ||
`<rootDir>/packages/${pkg.name}/test/**/*.test.js` | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
files: ['*.spec.js', '*.spec.jsx', '*.test.js', '*.test.jsx', '*.spec.ts', '*.spec.tsx', '*.test.ts', '*.test.tsx'], | ||
rules: { | ||
'no-unused-expressions': 'off', | ||
'chai-friendly/no-unused-expressions': 'error', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* eslint global-require: 0 */ | ||
|
||
module.exports = { | ||
...require('./chai'), | ||
}; |
Oops, something went wrong.