Shared linting configuration for braintree js projects.
- index.js: shared configuration
- client.js: client side configuration
- server.js: server side configuration
- jsdoc.js: jsdoc configuration
Install the eslint config
npm i --save-dev eslint-config-braintree
In your project's .eslintrc.*
:
default
---
extends: braintree
browserify
---
extends: braintree/client
node
---
extends: braintree/server
browserify + es6
---
extends:
- braintree/client
- braintree/es6
default
{
"extends": "braintree"
}
browserify
{
"extends": "braintree/client"
}
node
{
"extends": "braintree/server"
}
browserify + es6
{
"extends": ["braintree/client", "braintree/es6"]
}
You can specify a .eslintrc
for a subdirectory to change the rules that are enforced. For instance, in a node project you could extend from eslint-config-braintree/server
at the top-level, and eslint-braintree-config/client
at the public/.eslintrc
level.
See Configuration File Formats for information on all supported .eslintrc
file formats.
To override rules, add the new config under rules
in your rc file. Be sure to properly override any options set by the parent. See Extending Configuration Files for details.
For example, to change the no-new-object
rule to warn instead of error:
---
extends: braintree/server
rules:
no-new-object: 1
{
"extends": "braintree/server",
"rules": {
"no-new-object": 1
}
}
In another example, to allow end of line comments, you'd override the "no-multi-spaces"
rule options:
---
extends: braintree/server
rules:
no-multi-spaces:
- 2
- ignoreEOLComments: false
{
"extends": "braintree/server",
"rules": {
"no-multi-spaces": [2, { "ignoreEOLComments": false }]
}
}
By default, any files in a __tests__
folder, whether at the top level of the directory or within another directory will be configured to be used in the Jest and ES2020 environments.