lit-analyzer
- Version 2.0.3
- Published
- 770 kB
- 9 dependencies
- MIT license
Install
npm i lit-analyzer
yarn add lit-analyzer
pnpm add lit-analyzer
Overview
CLI that type checks bindings in lit-html templates
Index
Variables
variable ALL_RULE_IDS
const ALL_RULE_IDS: LitAnalyzerRuleId[];
variable DIAGNOSTIC_SOURCE
const DIAGNOSTIC_SOURCE: string;
variable LIT_HTML_ATTRIBUTE_MODIFIERS
const LIT_HTML_ATTRIBUTE_MODIFIERS: LitHtmlAttributeModifier[];
variable LIT_HTML_BOOLEAN_ATTRIBUTE_MODIFIER
const LIT_HTML_BOOLEAN_ATTRIBUTE_MODIFIER: string;
variable LIT_HTML_EVENT_LISTENER_ATTRIBUTE_MODIFIER
const LIT_HTML_EVENT_LISTENER_ATTRIBUTE_MODIFIER: string;
variable LIT_HTML_PROP_ATTRIBUTE_MODIFIER
const LIT_HTML_PROP_ATTRIBUTE_MODIFIER: string;
variable MAX_RUNNING_TIME_PER_OPERATION
const MAX_RUNNING_TIME_PER_OPERATION: number;
variable RULE_ID_CODE_MAP
const RULE_ID_CODE_MAP: Record<LitAnalyzerRuleId, number>;
variable TS_IGNORE_FLAG
const TS_IGNORE_FLAG: string;
variable VERSION
const VERSION: string;
Functions
function cli
cli: () => Promise<void>;
The main function of the cli.
function isRuleDisabled
isRuleDisabled: ( config: LitAnalyzerConfig, ruleId: LitAnalyzerRuleId) => boolean;
function isRuleEnabled
isRuleEnabled: (config: LitAnalyzerConfig, ruleId: LitAnalyzerRuleId) => boolean;
function litDiagnosticRuleSeverity
litDiagnosticRuleSeverity: ( config: LitAnalyzerConfig, ruleId: LitAnalyzerRuleId) => LitDiagnosticSeverity;
function makeConfig
makeConfig: (userOptions?: Partial<LitAnalyzerConfig>) => LitAnalyzerConfig;
Parses a partial user configuration and returns a full options object with defaults.
Parameter userOptions
function makeRules
makeRules: (userOptions: Partial<LitAnalyzerConfig>) => LitAnalyzerRules;
function ruleIdCode
ruleIdCode: (ruleId: LitAnalyzerRuleId) => number;
function ruleSeverity
ruleSeverity: ( rules: LitAnalyzerConfig | LitAnalyzerRules, ruleId: LitAnalyzerRuleId) => LitAnalyzerRuleSeverity;
Classes
class DefaultLitAnalyzerContext
class DefaultLitAnalyzerContext implements LitAnalyzerContext {}
constructor
constructor(handler: LitPluginContextHandler);
property componentSourceFileIterator
protected componentSourceFileIterator: ChangedSourceFileIterator;
property config
readonly config: LitAnalyzerConfig;
property currentFile
readonly currentFile: SourceFile;
property currentRunningTime
readonly currentRunningTime: number;
property definitionStore
readonly definitionStore: DefaultAnalyzerDefinitionStore;
property dependencyStore
readonly dependencyStore: DefaultAnalyzerDependencyStore;
property documentStore
readonly documentStore: DefaultAnalyzerDocumentStore;
property hasAnalyzedSubclassExtensions
protected hasAnalyzedSubclassExtensions: boolean;
property htmlStore
readonly htmlStore: DefaultAnalyzerHtmlStore;
property isCancellationRequested
readonly isCancellationRequested: boolean;
property logger
readonly logger: DefaultLitAnalyzerLogger;
property program
readonly program: Program;
property project
readonly project: any;
property rules
readonly rules: RuleCollection;
property ts
readonly ts: any;
method setContextBase
setContextBase: ({ file, timeout, throwOnCancellation,}: LitAnalyzerContextBaseOptions) => void;
method updateComponents
updateComponents: (file: SourceFile) => void;
method updateConfig
updateConfig: (config: LitAnalyzerConfig) => void;
method updateDependencies
updateDependencies: (file: SourceFile) => void;
class DefaultLitAnalyzerLogger
class DefaultLitAnalyzerLogger implements LitAnalyzerLogger {}
property level
level: LitAnalyzerLoggerLevel;
method debug
debug: (...args: any[]) => void;
Logs if this.level >= DEBUG
Parameter args
method error
error: (...args: any[]) => void;
Logs if this.level >= ERROR
Parameter args
method severityPrefix
protected severityPrefix: (level: LitAnalyzerLoggerLevel) => string;
method verbose
verbose: (...args: any[]) => void;
Logs if level >= VERBOSE
Parameter args
method warn
warn: (...args: any[]) => void;
Logs if level >= WARN
Parameter args
class LitAnalyzer
class LitAnalyzer {}
constructor
constructor(context: LitAnalyzerContext);
method getClosingTagAtPosition
getClosingTagAtPosition: ( file: SourceFile, position: SourceFilePosition) => LitClosingTagInfo | undefined;
method getCodeFixesAtPositionRange
getCodeFixesAtPositionRange: ( file: SourceFile, sourceFileRange: Range) => LitCodeFix[];
method getCompletionDetailsAtPosition
getCompletionDetailsAtPosition: ( file: SourceFile, position: SourceFilePosition, name: string) => LitCompletionDetails | undefined;
method getCompletionsAtPosition
getCompletionsAtPosition: ( file: SourceFile, position: SourceFilePosition) => LitCompletion[] | undefined;
method getDefinitionAtPosition
getDefinitionAtPosition: ( file: SourceFile, position: SourceFilePosition) => LitDefinition | undefined;
method getDiagnosticsInFile
getDiagnosticsInFile: (file: SourceFile) => LitDiagnostic[];
method getFormatEditsInFile
getFormatEditsInFile: ( file: SourceFile, settings: FormatCodeSettings) => LitFormatEdit[];
method getOutliningSpansInFile
getOutliningSpansInFile: (file: SourceFile) => LitOutliningSpan[];
method getQuickInfoAtPosition
getQuickInfoAtPosition: ( file: SourceFile, position: SourceFilePosition) => LitQuickInfo | undefined;
method getRenameInfoAtPosition
getRenameInfoAtPosition: ( file: SourceFile, position: SourceFilePosition) => LitRenameInfo | undefined;
method getRenameLocationsAtPosition
getRenameLocationsAtPosition: ( file: SourceFile, position: SourceFilePosition) => LitRenameLocation[];
method indexFile
indexFile: (file: SourceFile) => IterableIterator<LitIndexEntry>;
Yields entries that describe regions of code in the given file, and what the analyzer knows about them.
This is useful for generating a static index of analysis output. Two such indexing systems are Kythe and the Language Server Index Format.
Interfaces
interface LitAnalyzerConfig
interface LitAnalyzerConfig {}
property cssTemplateTags
cssTemplateTags: string[];
property customHtmlData
customHtmlData: (string | HTMLDataV1)[] | string | HTMLDataV1;
property cwd
cwd: string;
property disable
disable: boolean;
property dontShowSuggestions
dontShowSuggestions: boolean;
property dontSuggestConfigChanges
dontSuggestConfigChanges: boolean;
property format
format: { disable: boolean;};
property globalAttributes
globalAttributes: string[];
property globalEvents
globalEvents: string[];
property globalTags
globalTags: string[];
property htmlTemplateTags
htmlTemplateTags: string[];
property logging
logging: LitAnalyzerLogging;
property maxNodeModuleImportDepth
maxNodeModuleImportDepth: number;
property maxProjectImportDepth
maxProjectImportDepth: number;
property rules
rules: LitAnalyzerRules;
property securitySystem
securitySystem: LitSecuritySystem;
property strict
strict: boolean;
interface LitAnalyzerContext
interface LitAnalyzerContext {}
property config
readonly config: LitAnalyzerConfig;
property currentFile
readonly currentFile: SourceFile;
property currentRunningTime
readonly currentRunningTime: number;
property definitionStore
readonly definitionStore: AnalyzerDefinitionStore;
property dependencyStore
readonly dependencyStore: AnalyzerDependencyStore;
property documentStore
readonly documentStore: AnalyzerDocumentStore;
property htmlStore
readonly htmlStore: AnalyzerHtmlStore;
property isCancellationRequested
readonly isCancellationRequested: boolean;
property logger
readonly logger: LitAnalyzerLogger;
property program
readonly program: Program;
property project
readonly project: tsServer.server.Project | undefined;
property rules
readonly rules: RuleCollection;
property ts
readonly ts: typeof tsMod;
method setContextBase
setContextBase: (contextBase: LitAnalyzerContextBaseOptions) => void;
method updateComponents
updateComponents: (file: SourceFile) => void;
method updateConfig
updateConfig: (config: LitAnalyzerConfig) => void;
method updateDependencies
updateDependencies: (file: SourceFile) => void;
interface LitAnalyzerContextBaseOptions
interface LitAnalyzerContextBaseOptions {}
property file
file: SourceFile | undefined;
property throwOnCancellation
throwOnCancellation?: boolean;
property timeout
timeout?: number;
interface LitAnalyzerLogger
interface LitAnalyzerLogger {}
interface LitClosingTagInfo
interface LitClosingTagInfo {}
property newText
newText: string;
interface LitCodeFix
interface LitCodeFix {}
interface LitCodeFixAction
interface LitCodeFixAction {}
interface LitCompletion
interface LitCompletion {}
property importance
importance?: 'high' | 'medium' | 'low';
property insert
insert: string;
property kind
kind: LitTargetKind;
property kindModifiers
kindModifiers?: 'color';
property name
name: string;
property range
range?: SourceFileRange;
property sortText
sortText?: string;
method documentation
documentation: () => string | undefined;
interface LitCompletionDetails
interface LitCompletionDetails {}
property kind
kind: LitTargetKind;
property name
name: string;
property primaryInfo
primaryInfo: string;
property secondaryInfo
secondaryInfo?: string;
interface LitDefinition
interface LitDefinition {}
interface LitDefinitionTargetBase
interface LitDefinitionTargetBase {}
property kind
kind: LitDefinitionTargetKind;
interface LitDefinitionTargetNode
interface LitDefinitionTargetNode extends LitDefinitionTargetBase {}
interface LitDefinitionTargetRange
interface LitDefinitionTargetRange {}
property kind
kind: 'range';
property name
name?: string;
property range
range: SourceFileRange;
property sourceFile
sourceFile: SourceFile;
interface LitDiagnostic
interface LitDiagnostic {}
property code
code?: number;
property file
file: SourceFile;
property fixMessage
fixMessage?: string;
property location
location: SourceFileRange;
property message
message: string;
property severity
severity: LitDiagnosticSeverity;
property source
source: LitAnalyzerRuleId;
property suggestion
suggestion?: string;
interface LitFormatEdit
interface LitFormatEdit {}
interface LitOutliningSpan
interface LitOutliningSpan {}
property autoCollapse
autoCollapse?: boolean;
property bannerText
bannerText: string;
property kind
kind: LitOutliningSpanKind;
property location
location: SourceFileRange;
interface LitPluginContextHandler
interface LitPluginContextHandler {}
property ts
ts?: typeof tsMod;
method getProgram
getProgram: () => Program;
method getProject
getProject: () => tsServer.server.Project;
interface LitQuickInfo
interface LitQuickInfo {}
property primaryInfo
primaryInfo: string;
property range
range: SourceFileRange;
property secondaryInfo
secondaryInfo?: string;
interface LitRenameLocation
interface LitRenameLocation {}
property fileName
fileName: string;
property prefixText
prefixText?: string;
property range
range: SourceFileRange;
property suffixText
suffixText?: string;
interface RenameComponentDefinitionInfo
interface RenameComponentDefinitionInfo extends RenameInfoBase {}
property target
target: ComponentDefinition;
interface RenameHtmlNodeInfo
interface RenameHtmlNodeInfo extends RenameInfoBase {}
interface RenameInfoBase
interface RenameInfoBase {}
property displayName
displayName: string;
property fullDisplayName
fullDisplayName: string;
property kind
kind: LitTargetKind;
property range
range: SourceFileRange;
Enums
enum LitAnalyzerLoggerLevel
enum LitAnalyzerLoggerLevel { OFF = 0, ERROR = 1, WARN = 2, DEBUG = 3, VERBOSE = 4,}
enum LitOutliningSpanKind
enum LitOutliningSpanKind { Comment = 'comment', Region = 'region', Code = 'code', Imports = 'imports',}
Type Aliases
type DocumentOffset
type DocumentOffset = number;
type DocumentRange
type DocumentRange = { start: DocumentOffset; end: DocumentOffset;} & { _brand: 'document';};
type LitAnalyzerLogging
type LitAnalyzerLogging = 'off' | 'error' | 'warn' | 'debug' | 'verbose';
type LitAnalyzerRuleId
type LitAnalyzerRuleId = | 'no-unknown-tag-name' | 'no-missing-import' | 'no-unclosed-tag' | 'no-unknown-attribute' | 'no-unknown-property' | 'no-unknown-event' | 'no-unknown-slot' | 'no-unintended-mixed-binding' | 'no-invalid-boolean-binding' | 'no-expressionless-property-binding' | 'no-noncallable-event-binding' | 'no-boolean-in-attribute-binding' | 'no-complex-attribute-binding' | 'no-nullable-attribute-binding' | 'no-incompatible-type-binding' | 'no-invalid-directive-binding' | 'no-incompatible-property-type' | 'no-invalid-attribute-name' | 'no-invalid-tag-name' | 'no-invalid-css' | 'no-property-visibility-mismatch' | 'no-legacy-attribute' | 'no-missing-element-type-definition';
type LitAnalyzerRules
type LitAnalyzerRules = Partial< Record<LitAnalyzerRuleId, LitAnalyzerRuleSeverity | [LitAnalyzerRuleSeverity]>>;
type LitAnalyzerRuleSeverity
type LitAnalyzerRuleSeverity = | 'on' | 'off' | 'warn' | 'warning' | 'error' | 0 | 1 | 2 | true | false;
type LitDefinitionTarget
type LitDefinitionTarget = LitDefinitionTargetNode | LitDefinitionTargetRange;
type LitDefinitionTargetKind
type LitDefinitionTargetKind = 'node' | 'range';
type LitDiagnosticSeverity
type LitDiagnosticSeverity = 'error' | 'warning';
type LitHtmlAttributeModifier
type LitHtmlAttributeModifier = '.' | '?' | '@';
type LitRenameInfo
type LitRenameInfo = RenameHtmlNodeInfo | RenameComponentDefinitionInfo;
type LitSecuritySystem
type LitSecuritySystem = 'off' | 'ClosureSafeTypes';
type LitTargetKind
type LitTargetKind = | 'memberFunctionElement' | 'functionElement' | 'constructorImplementationElement' | 'variableElement' | 'classElement' | 'interfaceElement' | 'moduleElement' | 'memberVariableElement' | 'constElement' | 'enumElement' | 'keyword' | 'constElement' | 'alias' | 'moduleElement' | 'member' | 'label' | 'unknown';
type SourceFilePosition
type SourceFilePosition = number;
type SourceFileRange
type SourceFileRange = { start: SourceFilePosition; end: SourceFilePosition;} & { _brand: 'sourcefile';};
Package Files (22)
- index.d.ts
- lib/analyze/constants.d.ts
- lib/analyze/default-lit-analyzer-context.d.ts
- lib/analyze/lit-analyzer-config.d.ts
- lib/analyze/lit-analyzer-context.d.ts
- lib/analyze/lit-analyzer-logger.d.ts
- lib/analyze/lit-analyzer.d.ts
- lib/analyze/types/lit-closing-tag-info.d.ts
- lib/analyze/types/lit-code-fix-action.d.ts
- lib/analyze/types/lit-code-fix.d.ts
- lib/analyze/types/lit-completion-details.d.ts
- lib/analyze/types/lit-completion.d.ts
- lib/analyze/types/lit-definition.d.ts
- lib/analyze/types/lit-diagnostic.d.ts
- lib/analyze/types/lit-format-edit.d.ts
- lib/analyze/types/lit-outlining-span.d.ts
- lib/analyze/types/lit-quick-info.d.ts
- lib/analyze/types/lit-rename-info.d.ts
- lib/analyze/types/lit-rename-location.d.ts
- lib/analyze/types/lit-target-kind.d.ts
- lib/analyze/types/range.d.ts
- lib/cli/cli.d.ts
Dependencies (9)
Dev Dependencies (11)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/lit-analyzer
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/lit-analyzer)
- HTML<a href="https://www.jsdocs.io/package/lit-analyzer"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 5475 ms. - Missing or incorrect documentation? Open an issue for this package.