@jarrodldavis/eslint-config v0.1.0-pre
@jarrodldavis/eslint-config
Shareable ESLint config for Prettier and TypeScript
Install
yarn add --dev @jarrodldavis/eslint-config
Since this is an ESLint Shareable Config, ESLint must be installed directly into your package if it isn't already:
yarn add --dev eslint
TypeScript is also required for linting TypeScript source (.ts
) and
declaration (.d.ts
) files:
yarn add --dev typescript
Peer Dependencies
ESLint requires configs, plugins, and parsers referenced in configs to be
sibling modules of ESLint (i.e. they must be in exactly the same node_modules
directory).
This package specifies additional ESLint dependencies as both direct
dependencies and peer dependencies. If you are using Yarn or npm (since
v3), these dependencies should be automatically hoisted into your package's
top-level node_modules
directory.
If they are not, you will need to install these additional dependencies directly:
yarn add --dev prettier eslint-config-prettier eslint-plugin-prettier
yarn add --dev typescript-eslint-parser eslint-plugin-typescript
Usage
In your ESLint config, extend from this config:
{
"root": true,
"extends": ["@jarrodldavis"]
}
If you want to override any rule configurations, you can specify your own rule settings as normal:
{
"root": true,
"extends": ["@jarrodldavis"],
"rules": {
"no-console": "off"
}
}
For TypeScript source and declaration files, you'll need to use glob overrides:
{
"root": true,
"extends": ["@jarrodldavis"],
"rules": {
"no-console": "off"
},
"overrides": [
{
"files": "*.ts",
"rules": {
"typescript/class-name-casing": "off"
}
},
{
"files": "*.d.ts",
"rules": {
"typescript/interface-name-prefix": "warn"
}
}
]
}
6 years ago