rust/editors/code/.eslintrc.js
Andrei Listochkin 00a97272f2 automate braceless return substitution for long lines
Per [bjorn3][https://github.com/bjorn3] suggestion resolves cases where
an early return is moved to a separate line due to line width formatting.

This setting changes
```
if (a very long condition) return;
```
to
```
if (a very long
    condition) {
  return;
}
```
while keeping
```
if (short) return;
```
as is.

In pathological cases this may cause `npm run fix` not to fix formatting
in one go and may require running it twice.
2022-05-17 18:31:51 +01:00

38 lines
1.1 KiB
JavaScript

module.exports = {
env: {
es6: true,
node: true,
},
extends: ["prettier"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.eslint.json",
tsconfigRootDir: __dirname,
sourceType: "module",
},
plugins: ["@typescript-eslint"],
rules: {
camelcase: ["error"],
eqeqeq: ["error", "always", { null: "ignore" }],
curly: ["error", "multi-line"],
"no-console": ["error", { allow: ["warn", "error"] }],
"prefer-const": "error",
"@typescript-eslint/member-delimiter-style": [
"error",
{
multiline: {
delimiter: "semi",
requireLast: true,
},
singleline: {
delimiter: "semi",
requireLast: false,
},
},
],
"@typescript-eslint/semi": ["error", "always"],
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-floating-promises": "error",
},
};