Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

eslint-config-braintree

braintree1.7kMIT6.0.1TypeScript support: included

Braintree's ESLint configuration

readme

eslint-config-braintree

Shared linting configuration for braintree js projects.

Consuming

Install eslint@^8

npm install eslint@^8

Install the eslint config

npm i --save-dev eslint-config-braintree

Eslint requires all the plugins that the configu uses to be installed at the root of the project as well.

npm i --save-dev @typescript-eslint/eslint-plugin eslint-plugin-prettier

In your project's .eslintrc.*:

yaml

default

---
extends: braintree

browserify

---
extends: braintree/client

node

---
extends: braintree/server

browserify + es6

---
extends:
  - braintree/client
  - braintree/es6

json

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 }]
  }
}

Test Files

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.

changelog

CHANGELOG

6.0.1

  • Update (sub-)dependencies
    • cross-spawn to 7.0.6
    • semver to 6.3.1
  • Updates braces to 3.0.3

5.0.0

  • Add typescript types
  • DevDependency Updates
    • typescript-eslint/eslint-plugin to v6
    • @typescript-eslint/parser to v6
    • typescript to v5
    • eslint-config-prettier to v9
    • eslint-plugin-prettier to v4
    • prettier to v3

Breaking Changes

  • Update Node to v18
  • Add jest config to __tests__ directories automatically
  • Require eslint@^8.1.0
  • Use prettier for style rules
  • Use typescript for syntax rules
  • Require @typescript-eslint/eslint-plugin@^5.2.0 as a peer dependency
  • Require eslint-plugin-prettier@^4.0.0 as a peer dependency

4.0.0

Breaking Changes

  • Update peer dependencies to require eslint@6

3.0.1

  • Readme updates

3.0.0

Breaking Changes

  • Update peer dependencies to require eslint@5

2.0.0

  • Requires eslint@4
  • Add additional rules
    • max-len
    • newline-before-return
    • no-mixed-operators
    • no-whitespace-before-property
    • object-property-newline
    • spaced-comment
    • no-path-concat in server.js
  • Update existing rules
    • ignoreEOLComments: true for no-multi-spaces
    • nestedBinaryExpressions: false for no-extra-parens