Open PaulTaykalo opened 2 weeks ago
This PR tries to resolve an issue, when unused import resolved incorrectly, since swiflint doesn't check transitive imports
swiflint
For example, if we have
import Cocoa let viewController = NSViewController()
Cocoa module is actually
import AppKit import Foundation import CoreData
So this PR actually tries to account transitive_modules configuration to prevent incorrect import removals
transitive_modules
As an alternative we can try to generate interfaces of all imported modules (once per module) And parse their imports on the top level
So , for example, if we found some missing modules, we'll check if those can be found in the generated interface.
For example,
import SwiftUI
Will allow to use any of the underlying modules
/// Generated SwifTUI interface import Accessibility import AppKit import Combine import CoreData import CoreFoundation import CoreGraphics import CoreTransferable import Darwin import DeveloperToolsSupport import Foundation import OSLog import Observation import Spatial import SwiftUICore import Symbols import TargetConditionals import UniformTypeIdentifiers import _Concurrency import _StringProcessing import _SwiftConcurrencyShims import os import os.log import simd
Related Issues: https://github.com/realm/SwiftLint/issues/5167
This PR tries to resolve an issue, when unused import resolved incorrectly, since
swiflint
doesn't check transitive importsFor example, if we have
Cocoa module is actually
So this PR actually tries to account
transitive_modules
configuration to prevent incorrect import removalsAlternative
As an alternative we can try to generate interfaces of all imported modules (once per module) And parse their imports on the top level
So , for example, if we found some missing modules, we'll check if those can be found in the generated interface.
For example,
Will allow to use any of the underlying modules
Related Issues: https://github.com/realm/SwiftLint/issues/5167