AGLint icon indicating copy to clipboard operation
AGLint copied to clipboard

Linter rule ideas

Open scripthunter7 opened this issue 2 years ago • 41 comments

In this issue, we can collect the main linter rule ideas. A linter rule basically targets a specific problem and the rules can be enabled / disabled individually in the linter config. Let's try to define each rule as best as possible.

Example rules:

  • Check unopened / unclosed if directives. For example:
    ! Unopened if:
    !#endif
    rule
    ! Unclosed if:
    !#if (adguard)
    rule
    
  • Warning on multilple selectors. For example:
    ! Multiple selectors are used simultaneously within the rule:
    example.com##.ad, .ad2
    ! But this is ok:
    example.net###.ad
    
    • Suggest fix (the linter can suggest a fix):
      example.com##.ad
      example.com##.ad2
      example.net###.ad
      
  • Check redundant wildcards. For example:
    ! Redundant *^
    example.*^
    ! Redundant *
    ex**ample.com
    

@ameshkov @Alex-302

scripthunter7 avatar Dec 21 '22 17:12 scripthunter7