Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NoWebpackLoaderSyntax = rule.Rule{ Name: "import/no-webpack-loader-syntax", Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { return rule.RuleListeners{ ast.KindImportDeclaration: func(node *ast.Node) { specifier := node.ModuleSpecifier() if specifier == nil || specifier.Kind != ast.KindStringLiteral { return } modulePath := specifier.AsStringLiteral().Text if hasWebpackLoaderSyntax(modulePath) { ctx.ReportNode(specifier, buildRuleMessage(modulePath)) } }, ast.KindCallExpression: func(node *ast.Node) { callExpression := node.AsCallExpression() expr := callExpression.Expression if expr.Kind != ast.KindIdentifier || expr.AsIdentifier().Text != "require" { return } if len(callExpression.Arguments.Nodes) == 0 { return } arg := callExpression.Arguments.Nodes[0] if arg.Kind != ast.KindStringLiteral { return } modulePath := arg.AsStringLiteral().Text if hasWebpackLoaderSyntax(modulePath) { ctx.ReportNode(arg, buildRuleMessage(modulePath)) } }, } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.