Caleb Eby's ESLint Configuration. This exports itself as a "super-plugin" because of a limitation of ESLint.
The way this works is that it requires all of the plugin dependencies, and exports them from this plugin under a prefix.
The plugins that this exposes are:
This also exposes a couple rules from
shopify
:
To override settings for any of these plugins, you must prefix the configuration
with caleb/
, because the plugins are exposed through this "super-plugin".
{
"extends": ["plugin:calebeby/recommended"],
"rules": {
"caleb/unicorn/catch-error-name": "off",
"caleb/@shopify/prefer-early-return": "off"
}
}
npm i -D eslint-plugin-caleb eslint prettier
Add this to your package.json
:
{
"scripts": {
"check-lint": "eslint . && prettier --check .",
"lint": "eslint --fix . && prettier --write ."
},
"eslintConfig": {
"extends": ["plugin:caleb/recommended"]
},
"prettier": {
"singleQuote": true,
"trailingComma": "all",
"semi": false
}
}
This plugin exposes the following configurations:
recommended
: This is the main configuration. This exposes base rules, as well as some overrides for.ts
/.tsx
filesreact
: This adds some settings for React-specific rulespreact
: This is the same asreact
, except it excludes rules that are irrelevant for Preactjest
: This adds some jest rules for test files, and declares the jest globals in those files
To include these configurations, add the ones you want to your extends
array:
["plugin:caleb/recommended", "plugin:caleb/jest"]
npm run check-lint
(this will automatically fix many linting issues)
npm run lint