ESLint: enforce import formatting

Mainly to reduce merge conflict noise

- Order by origin & alphabetically
- Imports should be at the top of the file
- Newline between imports & the rest of the file
- Disallow duplicate imports
- Enforce single-line when only importing one object
- Enforce multi-line when importing two or more
This commit is contained in:
Yury Bondarenko
2023-05-20 09:56:35 +02:00
parent 917c36dbe7
commit fa404fff84
3 changed files with 29 additions and 1 deletions

View File

@@ -9,7 +9,9 @@
"unused-imports",
"eslint-plugin-lodash",
"eslint-plugin-jsonc",
"eslint-plugin-rxjs"
"eslint-plugin-rxjs",
"eslint-plugin-simple-import-sort",
"eslint-plugin-import-newlines"
],
"overrides": [
{
@@ -210,9 +212,23 @@
"deprecation/deprecation": "warn",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"import/order": "off",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"import/no-deprecated": "warn",
"import/no-namespace": "error",
"import-newlines/enforce": [
"error",
{
"items": 1,
"semi": true,
"forceSingleLine": true
}
],
"unused-imports/no-unused-imports": "error",
"lodash/import-scope": [
"error",