-
Notifications
You must be signed in to change notification settings - Fork 0
Chore: Configure ESLint import order rules #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ee5a5f1
ef60649
6d4e169
6e4d0ff
4612aa0
22377e6
06a14ea
0f80163
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,13 +12,38 @@ | |
| "jsx": true | ||
| } | ||
| }, | ||
| "extends": ["next/core-web-vitals", "airbnb-base"], | ||
| "extends": [ | ||
| "eslint:recommended", | ||
| "plugin:@typescript-eslint/recommended", | ||
| "plugin:import/recommended", | ||
| "next/core-web-vitals", | ||
| "airbnb-base" | ||
| ], | ||
| "settings": { | ||
| "import/resolver": { | ||
| "typescript": true, | ||
| "node": true | ||
| } | ||
| }, | ||
| "parser": "@typescript-eslint/parser", | ||
| "plugins": ["@typescript-eslint"], | ||
| "globals": { | ||
| "allowTemplateLiterals": true | ||
| }, | ||
| "rules": { | ||
| "global-require": 0, | ||
| "import/prefer-default-export": 0, | ||
| "import/order": [ | ||
| "error", | ||
| { | ||
| "groups": ["builtin", "external", "internal", "type"], | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In order:
Everything else not classified under these groups will be put last. You can read more about the config here. There are some other options but I don't think we're currently using them so I want to wait until we do before we configure them. |
||
| "newlines-between": "always", | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure there's a newline between import groups |
||
| "alphabetize": { | ||
| "order": "asc", | ||
| "caseInsensitive": true | ||
| } | ||
|
Comment on lines
+41
to
+44
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sort imports within each group. This make sure for example that Personally don't see a compelling need to be opinionated on sorting within each group so alphabet order seems the best choice to me. |
||
| } | ||
| ], | ||
| "no-nested-ternary": "off", | ||
| "quotes": "off", | ||
| "default-param-last": "off", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { | ||
| import type { | ||
| Direction, JunctionTile, StartTile, World, | ||
| } from "@src/types"; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion for another rule (take it or leave it!) that ensures react and next are always the first import for the external group
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind this, although unsure why it's not working at all when I added this 🤔 It was also clashing with type imports from
next/app. I'm going to table this for now but good note nonetheless!