 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
- func GetAllRulesForPlugin(plugin string) []rule.Rule
- func InitDefaultConfig(directory string) error
- func RegisterAllRules()
- type ConfigEntry
- type ConfigLoader
- func (loader *ConfigLoader) LoadConfiguration(configPath string) (RslintConfig, []string, string, error)
- func (loader *ConfigLoader) LoadDefaultRslintConfig() (RslintConfig, string, error)
- func (loader *ConfigLoader) LoadRslintConfig(configPath string) (RslintConfig, string, error)
- func (loader *ConfigLoader) LoadTsConfigsFromRslintConfig(rslintConfig RslintConfig, configDirectory string) ([]string, error)
 
- type LanguageOptions
- type ParserOptions
- type ProjectPaths
- type RslintConfig
- type RuleConfig
- type RuleRegistry
- type Rules
- type TypedRules
Constants ¶
This section is empty.
Variables ¶
var GlobalRuleRegistry = NewRuleRegistry()
    Global rule registry instance
Functions ¶
func GetAllRulesForPlugin ¶
func InitDefaultConfig ¶ added in v0.1.10
initialize a default config in the directory
func RegisterAllRules ¶ added in v0.1.8
func RegisterAllRules()
Types ¶
type ConfigEntry ¶
type ConfigEntry struct {
	Language        string           `json:"language"`
	Files           []string         `json:"files"`
	Ignores         []string         `json:"ignores,omitempty"` // List of file patterns to ignore
	LanguageOptions *LanguageOptions `json:"languageOptions,omitempty"`
	Rules           Rules            `json:"rules"`
	Plugins         []string         `json:"plugins,omitempty"` // List of plugin names
}
    ConfigEntry represents a single configuration entry in the rslint.json array
type ConfigLoader ¶
type ConfigLoader struct {
	// contains filtered or unexported fields
}
    ConfigLoader handles loading and parsing of rslint and tsconfig files
func NewConfigLoader ¶
func NewConfigLoader(fs vfs.FS, currentDirectory string) *ConfigLoader
NewConfigLoader creates a new configuration loader
func (*ConfigLoader) LoadConfiguration ¶
func (loader *ConfigLoader) LoadConfiguration(configPath string) (RslintConfig, []string, string, error)
LoadConfiguration is a convenience method that loads both rslint and tsconfig configurations
func (*ConfigLoader) LoadDefaultRslintConfig ¶
func (loader *ConfigLoader) LoadDefaultRslintConfig() (RslintConfig, string, error)
LoadDefaultRslintConfig attempts to load default configuration files
func (*ConfigLoader) LoadRslintConfig ¶
func (loader *ConfigLoader) LoadRslintConfig(configPath string) (RslintConfig, string, error)
LoadRslintConfig loads and parses a rslint configuration file
func (*ConfigLoader) LoadTsConfigsFromRslintConfig ¶
func (loader *ConfigLoader) LoadTsConfigsFromRslintConfig(rslintConfig RslintConfig, configDirectory string) ([]string, error)
LoadTsConfigsFromRslintConfig extracts and validates TypeScript configuration paths from rslint config
type LanguageOptions ¶
type LanguageOptions struct {
	ParserOptions *ParserOptions `json:"parserOptions,omitempty"`
}
    LanguageOptions contains language-specific configuration options
type ParserOptions ¶
type ParserOptions struct {
	ProjectService bool         `json:"projectService"`
	Project        ProjectPaths `json:"project,omitempty"`
}
    ParserOptions contains parser-specific configuration
type ProjectPaths ¶ added in v0.1.13
type ProjectPaths []string
ProjectPaths represents project paths that can be either a single string or an array of strings
func (*ProjectPaths) UnmarshalJSON ¶ added in v0.1.13
func (p *ProjectPaths) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom JSON unmarshaling to support both string and string[] formats
type RslintConfig ¶
type RslintConfig []ConfigEntry
RslintConfig represents the top-level configuration array
func LoadConfigurationWithFallback ¶
func LoadConfigurationWithFallback(configPath string, currentDirectory string, fs vfs.FS) (RslintConfig, []string, string)
LoadConfigurationWithFallback loads configuration and handles errors by printing to stderr and exiting This is for backward compatibility with the existing cmd behavior
func (RslintConfig) GetRulesForFile ¶
func (config RslintConfig) GetRulesForFile(filePath string) map[string]*RuleConfig
GetRulesForFile returns enabled rules for a given file based on the configuration
type RuleConfig ¶
type RuleConfig struct {
	Level   string                 `json:"level,omitempty"`   // "error", "warn", "off"
	Options map[string]interface{} `json:"options,omitempty"` // Rule-specific options
}
    RuleConfig represents individual rule configuration
func (*RuleConfig) GetLevel ¶
func (rc *RuleConfig) GetLevel() string
GetLevel returns the rule level, defaulting to "error" if not specified
func (*RuleConfig) GetOptions ¶
func (rc *RuleConfig) GetOptions() map[string]interface{}
GetOptions returns the rule options, ensuring we return a usable value
func (*RuleConfig) GetSeverity ¶
func (rc *RuleConfig) GetSeverity() rule.DiagnosticSeverity
GetSeverity returns the diagnostic severity for this rule configuration
func (*RuleConfig) IsEnabled ¶
func (rc *RuleConfig) IsEnabled() bool
IsEnabled returns true if the rule is enabled (not "off")
func (*RuleConfig) SetOptions ¶
func (rc *RuleConfig) SetOptions(options map[string]interface{})
SetOptions sets the rule options
type RuleRegistry ¶
type RuleRegistry struct {
	// contains filtered or unexported fields
}
    RuleRegistry manages all available rules
func NewRuleRegistry ¶
func NewRuleRegistry() *RuleRegistry
NewRuleRegistry creates a new rule registry
func (*RuleRegistry) GetAllRules ¶
func (r *RuleRegistry) GetAllRules() map[string]rule.Rule
GetAllRules returns all registered rules
func (*RuleRegistry) GetEnabledRules ¶
func (r *RuleRegistry) GetEnabledRules(config RslintConfig, filePath string) []linter.ConfiguredRule
GetEnabledRules returns rules that are enabled in the configuration for a given file
type Rules ¶
type Rules map[string]interface{}
Rules represents the rules configuration This can be extended to include specific rule configurations
type TypedRules ¶
type TypedRules struct {
	// Example rule configurations - extend as needed
	AdjacentOverloadSignatures         *RuleConfig `json:"@typescript-eslint/adjacent-overload-signatures,omitempty"`
	ArrayType                          *RuleConfig `json:"@typescript-eslint/array-type,omitempty"`
	ClassLiteralPropertyStyle          *RuleConfig `json:"@typescript-eslint/class-literal-property-style,omitempty"`
	NoArrayDelete                      *RuleConfig `json:"@typescript-eslint/no-array-delete,omitempty"`
	NoBaseToString                     *RuleConfig `json:"@typescript-eslint/no-base-to-string,omitempty"`
	NoForInArray                       *RuleConfig `json:"@typescript-eslint/no-for-in-array,omitempty"`
	NoImpliedEval                      *RuleConfig `json:"@typescript-eslint/no-implied-eval,omitempty"`
	OnlyThrowError                     *RuleConfig `json:"@typescript-eslint/only-throw-error,omitempty"`
	AwaitThenable                      *RuleConfig `json:"@typescript-eslint/await-thenable,omitempty"`
	NoConfusingVoidExpression          *RuleConfig `json:"@typescript-eslint/no-confusing-void-expression,omitempty"`
	NoDuplicateTypeConstituents        *RuleConfig `json:"@typescript-eslint/no-duplicate-type-constituents,omitempty"`
	NoFloatingPromises                 *RuleConfig `json:"@typescript-eslint/no-floating-promises,omitempty"`
	NoMeaninglessVoidOperator          *RuleConfig `json:"@typescript-eslint/no-meaningless-void-operator,omitempty"`
	NoMisusedPromises                  *RuleConfig `json:"@typescript-eslint/no-misused-promises,omitempty"`
	NoMisusedSpread                    *RuleConfig `json:"@typescript-eslint/no-misused-spread,omitempty"`
	NoMixedEnums                       *RuleConfig `json:"@typescript-eslint/no-mixed-enums,omitempty"`
	NoRedundantTypeConstituents        *RuleConfig `json:"@typescript-eslint/no-redundant-type-constituents,omitempty"`
	NoUnnecessaryBooleanLiteralCompare *RuleConfig `json:"@typescript-eslint/no-unnecessary-boolean-literal-compare,omitempty"`
	NoUnnecessaryTemplateExpression    *RuleConfig `json:"@typescript-eslint/no-unnecessary-template-expression,omitempty"`
	NoUnnecessaryTypeArguments         *RuleConfig `json:"@typescript-eslint/no-unnecessary-type-arguments,omitempty"`
	NoUnnecessaryTypeAssertion         *RuleConfig `json:"@typescript-eslint/no-unnecessary-type-assertion,omitempty"`
	NoUnsafeArgument                   *RuleConfig `json:"@typescript-eslint/no-unsafe-argument,omitempty"`
	NoUnsafeAssignment                 *RuleConfig `json:"@typescript-eslint/no-unsafe-assignment,omitempty"`
	NoUnsafeCall                       *RuleConfig `json:"@typescript-eslint/no-unsafe-call,omitempty"`
	NoUnsafeEnumComparison             *RuleConfig `json:"@typescript-eslint/no-unsafe-enum-comparison,omitempty"`
	NoUnsafeMemberAccess               *RuleConfig `json:"@typescript-eslint/no-unsafe-member-access,omitempty"`
	NoUnsafeReturn                     *RuleConfig `json:"@typescript-eslint/no-unsafe-return,omitempty"`
	NoUnsafeTypeAssertion              *RuleConfig `json:"@typescript-eslint/no-unsafe-type-assertion,omitempty"`
	NoUnsafeUnaryMinus                 *RuleConfig `json:"@typescript-eslint/no-unsafe-unary-minus,omitempty"`
}
    Alternative: If you want type-safe rule configurations