Swiftlint: Rule Request: Redundant import

Created on 18 Jun 2018  路  5Comments  路  Source: realm/SwiftLint

New Issue Checklist

Rule Request

Redundant imports often lead to the confusion about the responsibilities of declarations within a file. I don't know any reasons for why anyone would want to have import declarations of the module they don't use.

  1. Why should this rule be added? Share links to existing discussion about what
    the community thinks about this.

I didn't find any

  1. Provide several examples of what _would_ and _wouldn't_ trigger violations.

Would trigger:

import UIKit
class Foo { }

Wouldn't trigger:

import UIKit
class Foo { let bar = UIView() }
  1. Should the rule be configurable, if so what parameters should be configurable?

No

  1. Should the rule be opt-in or enabled by default? Why?
    See README.md for guidelines on when to mark a
    rule as opt-in.

Such rule should be enabled by default

rule-request

Most helpful comment

Nice find, yes! 8fd15b0b

All 5 comments

This would require SwiftLint to run in a "compiled mode" as I've discussed before.

@jpsim is it something you don鈥檛 consider for implementation?

@jpsim can we close this as https://github.com/realm/SwiftLint/pull/2381 was merged?

Nice find, yes! 8fd15b0b

Hey - looks like you forgot to add a T:* label - could you please add one?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jcarroll-mediafly picture jcarroll-mediafly  路  3Comments

mildm8nnered picture mildm8nnered  路  3Comments

Tableau-David-Potter picture Tableau-David-Potter  路  3Comments

larslockefeer picture larslockefeer  路  3Comments

muzamilhassan1987 picture muzamilhassan1987  路  3Comments