-
Notifications
You must be signed in to change notification settings - Fork 5
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
Import order #45
Import order #45
Conversation
Is this fixable? If it's not it's a no from me lol |
Yes, can be |
Can we ensure that we test this out with a web app. I have concerns around the ordering around things like importing the css reset, and other css related files that may have a side effect from their ordering. It might be ok, but i'd want to be certain before making it a standard. |
Yeah we've tested that. Should've linked this: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
We should also bump |
@@ -142,6 +142,7 @@ const baseConfig = { | |||
// prefer TypeScript exhaustiveness checking | |||
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking | |||
'default-case': OFF, | |||
'import/order': [ERROR, { 'newlines-between': 'always' }], |
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.
A bit more testing on the frontend led me to:
'import/order': [ERROR, { 'newlines-between': 'always' }], | |
'import/order': [ | |
ERROR, | |
{ | |
alphabetize: { | |
order: 'asc', | |
}, | |
'newlines-between': 'always', | |
pathGroups: [ | |
{ | |
pattern: 'src/**', | |
group: 'external', | |
position: 'after', | |
}, | |
], | |
pathGroupsExcludedImportTypes: [ | |
{ | |
pattern: 'src/**', | |
group: 'external', | |
position: 'after', | |
}, | |
], | |
}, | |
], |
Which is scary (the pathGroups
don't seem to work very intuitively) but nets
// doesn't touch this
import 'braid-design-system/reset';
import { BraidLoadableProvider } from 'braid-design-system';
import { Header } from 'src/components/Header';
import * as styleRefs from './App.treat.ts';
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.
Was looking at this as well. Not sure pattern: 'src/**'
makes sense though as not all projects use src
and some have other top-level folders.
Closing this out, as it will need to be implemented directly in sku/smt |
To keep things nice and readable, it's a bit nicer if the imports are split into packages, siblings, and other local, and alphabetised within their groups. This rule enforces that (which tbh we were doing most of the time anyway)