-
Notifications
You must be signed in to change notification settings - Fork 168
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
Standardize imports #2477
base: master
Are you sure you want to change the base?
Standardize imports #2477
Conversation
Gonna leave this as draft for a while because the changes across the files might cause merge conflicts with other PRs; let us merge as many of them in as possible first. |
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.
LGTM! Only checked the changes made by hand in detail; briefly scrolled through the linter/formatter changes and they seem to be correct.
Just one minor clarification.
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/ban-ts-comment': 'warn', | ||
'@typescript-eslint/ban-types': 'off', | ||
'no-relative-import-paths/no-relative-import-paths': ['error', { allowSameFolder: true }], |
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.
Motivation: Copied over from their own documentation
Moving a file to different folder, could result in changing all imports statement in that file. This will not happen is the import paths are absolute.
Also, the current way of importing leads to stuff like
import { a } from 'src/.../file' import { b } from '../file'Even though
a
andb
are defined in the same file, which does not really look nice at best and potentially misleading at worst.
Hmm, given the motivation for this change, is there a reason why the allowSameFolder
option is set to true? More specifically, why are relative import paths for imported files from the same folder allowed? Moving a file containing such relative import paths will result in these import statements changing.
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 was thinking that it might encourage better organisation of code (e.g perhaps splitting a 1000+ line component into multiple files in the same folder, where applicable). Since this makes the distinction clear (whether the files are closely related or not), this might improve readability.
What do you think?
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.
No strong preferences! Just wanted to know if there was a rationale (which you do have) because it would be good to state it somewhere for future reference.
Pull Request Test Coverage Report for Build 5219070096
💛 - Coveralls |
Refer to #1376 |
Thanks! Is there a way to lint this, though? I tried searching for eslint plugins but couldn't find anything that offers this level of customisation |
…y-frontend into 23-summer/standardize-imports
…y-frontend into 23-summer/standardize-imports
…y-frontend into 23-summer/standardize-imports
…y-frontend into 23-summer/standardize-imports
…y-frontend into 23-summer/standardize-imports
…y-frontend into 23-summer/standardize-imports
Must have been added unintentionally following all the merges.
…y-frontend into 23-summer/standardize-imports
…y-frontend into 23-summer/standardize-imports
…y-frontend into 23-summer/standardize-imports
…y-frontend into 23-summer/standardize-imports
…y-frontend into 23-summer/standardize-imports
…y-frontend into 23-summer/standardize-imports
…y-frontend into 23-summer/standardize-imports
…y-frontend into 23-summer/standardize-imports
Description
Motivation: Copied over from their own documentation
Also, the current way of importing leads to stuff like
Even though
a
andb
are defined in the same file, which does not really look nice at best and potentially misleading at worst.Changes:
.eslintrc
from JSON to a JS file to allow for greater readability when writing rulesType of change
How to test
Checklist