Skip to content

Commit

Permalink
Update readme about require
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Oct 9, 2021
1 parent a7dbeb8 commit d9a116f
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions README.md
Expand Up @@ -140,17 +140,7 @@ It is recommended to also set up [Prettier], to help formatting your imports (an
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error"
},
"overrides": [
{
"files": "server/**/*.js",
"env": { "node": true },
"rules": {
"simple-import-sort/imports": "off",
"import/order": ["error", { "newlines-between": "always" }]
}
}
]
}
}
```

Expand All @@ -159,9 +149,6 @@ It is recommended to also set up [Prettier], to help formatting your imports (an
- [import/first] makes sure all imports are at the top of the file. (autofixable)
- [import/newline-after-import] makes sure there’s a newline after the imports. (autofixable)
- [import/no-duplicates] merges import statements of the same file. (autofixable, mostly)
- For Node.js code, `simple-import-sort/imports` is turned off and replaced with [import/order] for sorting of `require` calls.

With the above configuration, you don’t need to scroll to the top of the file to add another import. Just put it above your function! ESLint will then snap it into place (at the top of the file, in order, and without duplicates).

## Not for everyone

Expand Down Expand Up @@ -532,7 +519,7 @@ The final whitespace rule is that this plugin puts one import/export per line. I

### Does it support `require`?

No. This is intentional to keep things simple. Use some other sorting rule, such as [import/order], for sorting `require`.
No. This is intentional to keep things simple. Use some other sorting rule, such as [import/order], for sorting `require`. Or consider migrating your code using `require` to `import`. `import` is well supported these days.

### Why sort on `from`?

Expand Down

0 comments on commit d9a116f

Please sign in to comment.