A set of ESLint rules that enforce best practices used in Croct projects.
These are the current available presets:
Enforces Croct's standard JavaScript best practices.
To enable this preset, add the following to your .eslintrc
file:
{
"plugins": [
"@croct"
],
"extends": [
"plugin:@croct/javascript"
]
}
Enforces Croct's standard TypeScript best practices.
To enable this preset, add the following to your .eslintrc.js
file:
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-patch/modern-module-resolution');
module.exports = {
plugins: ['@croct'],
extends: ['plugin:@croct/typescript'],
parserOptions: {
project: ['**/tsconfig.json'],
},
};
This preset extends the JavaScript preset – no need to include it as well.
Enforces best practices for React-based projects.
To enable this preset, add the following to your .eslintrc
file:
{
"plugins": [
"@croct"
],
"extends": [
"plugin:@croct/react"
]
}
This preset extends the JavaScript preset – no need to include it as well.
Enforces Croct's best practices for writing Cypress acceptance tests
To enable this preset, add the following to your .eslintrc
file:
{
"plugins": [
"@croct"
],
"extends": [
"plugin:@croct/cypress"
]
}
This preset extends the JavaScript preset – no need to include it as well.
The plugin also ships with a few custom ESLint rules, all enabled by default in the related preset.
Rule | Description |
---|---|
newline-per-chained-call | Enforces a newline before chained calls. |
argument-spacing | Enforces a surrounding line break before and after the argument list in multiline functional calls. |
complex-expression-spacing | Enforces a surrounding line break in complex expression. |
jsx-attribute-spacing | Enforces a surrounding line break in multiline JSX attributes. |
min-chained-call-depth | Enforces a minimum depth for multiline chained calls. |