@mracette/eslint-config v1.0.0
@mracette/eslint-config
A personalized ESLint config with Typescript support
Usage
Initialize your project with
package.jsonif you haven't alreadyInstall
@mracette/eslint-configand its peer dependencies into your project:If using npm:
npx install-peerdeps --dev @mracette/eslint-configIf using yarn: same as above, but pass
--yarnCreate a file
.eslintrcat the root of your project's directory and add the following:
{
"extends": [
"@mracette"
],
"parserOptions": {
"project": "./tsconfig.json"
}
}Alternatively, you can put this object in your package.json under the property "eslintConfig". This makes one less file in your projects.
Extra Configuration
There are a few more optional steps which could help you get the most out of your eslint configuration.
- Add
.eslintignore. At a very minimum, you should ignore node_modules. Here are some more to get you started:
**/.git/**
**/node_modules/**- You can override rules in the config or extend it by adding a
rulessection to your project's.eslintrc:
"rules": {
"no-alert": "warn"
}
## Understanding ESlint plugins vs. configs
In short:
- a plugin provides new rules
- a plugin may also contain 0, 1, or multiple configs
- a config applies a set of rules when added to the extends array
Here is a good Stack Overflow answer with more detail on this: https://stackoverflow.com/a/54522973/3064334
## mracette/eslint-config rules hierarchy:
- `@mracette` (the config provided by this package)
- `plugin:@typescript-eslint` (provides lint rules for TS)
- `plugin:@typescript-eslint/recommended` (the set of rules which are recommended for all projects by the ESLint team and _do not require_ type-checking to run)
- `plugin:@typescript-eslint/recommended-requiring-type-checking` (recommended rules which _do require_ type-checking in order to be implemented correctly)
- `prettier:/@typescript-eslint` (turns _off_ all rules that are unnecessary or might conflict with Prettier)2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago