@treblefm/eslint-config
v3.3.4
Published
Shared ESLint config for Treble.fm
Downloads
155
Readme
@treblefm/eslint-config
Shared ESLint config for Treble.fm
Quick Install
(Copy/paste into your terminal)
npm install --save-dev \
@treblefm/eslint-config \
eslint@4 \
[email protected] \
eslint-import-resolver-typescript@1 \
eslint-plugin-import@2 \
eslint-plugin-node@5Dependencies
This config requires the following peer dependencies:
[email protected](obviously)[email protected]1[email protected]1[email protected][email protected]
Additionally, these optional peer dependencies will automatically be used if installed:
[email protected]2[email protected][email protected][email protected]3[email protected]4[email protected]4[email protected]4
Usage
By default, this config assumes a Node.js project with ES2017 syntax (though unsupported features will be reported as errors by eslint-plugin-node):
{
"extends": "@treblefm" // or @treblefm/eslint-config/node
}Browser (ES6):
{
"extends": "@treblefm/eslint-config/browser"
}React Native (includes JSX support):
{
"extends": "@treblefm/eslint-config/react-native"
}JSX support can be added to any of the above configs:
{
"extends": [
"@treblefm",
"@treblefm/eslint-config/jsx"
]
}Similarly, TypeScript support can also be added (includes JSX support):
{
"extends": [
"@treblefm",
"@treblefm/eslint-config/typescript"
]
}Note about GraphQL
While GraphQL is supported, the rules are disabled by default and some configuration is required (click here for more info).
{
"schemaPath": "./path/to/schema.json"
}.eslintrc
{
"extends": "@treblefm",
"rules": {
"graphql/template-strings": [2, {
"env": "apollo",
// "validators": [/* see GraphQL's `specifiedRules` */]
}],
"graphql/named-operations": [2, {
"env": "apollo"
}],
"graphql/required-fields": [2, {
"env": "apollo",
"requiredFields": ["id"]
}],
"graphql/capitalized-type-name": [2, {
"env": "apollo"
}]
}
}