# Komaci Static Analyzer Rules

-   [`komaci1001`: no-unresolved-parent-class-reference](#komaci1001-no-unresolved-parent-class-reference)
-   [`komaci1002`: no-multiple-template-files](#komaci1002-no-multiple-template-files)
-   [`komaci1003`: no-private-wire-config-property](#komaci1003-no-private-wire-config-property)
-   [`komaci1004`: no-undefined-wire-config-property](#komaci1004-no-undefined-wire-config-property)
-   [`komaci1006`: no-wire-configuration-property-using-output-of-non-primeable-wire](#komaci1006-no-wire-configuration-property-using-output-of-non-primeable-wire)
-   [`komaci1007`: no-wire-adapter-of-resource-cannot-be-primed](#komaci1007-no-wire-adapter-of-resource-cannot-be-primed)
-   [`komaci1008`: no-missing-resource-cannot-prime-wire-adapter](#komaci1008-no-missing-resource-cannot-prime-wire-adapter)
-   [`komaci1009`: no-wire-config-property-uses-getter-function-returning-non-literal](#komaci1009-no-wire-config-property-uses-getter-function-returning-non-literal)
-   [`komaci1010`: no-wire-config-property-uses-getter-function-returning-inaccessible-import](#komaci1010-no-wire-config-property-uses-getter-function-returning-inaccessible-import)
-   [`komaci1011`: no-class-refers-to-parent-class-from-unsupported-namespace](#komaci1011-no-class-refers-to-parent-class-from-unsupported-namespace)
-   [`komaci1012`: no-wire-config-property-uses-imported-artifact-from-unsupported-namespace](#komaci1012-no-wire-config-property-uses-imported-artifact-from-unsupported-namespace)
-   [`komaci1013`: no-wire-config-references-non-local-property-reactive-value](#komaci1013-no-wire-config-references-non-local-property-reactive-value)
-   [`komaci1014`: no-composition-on-unanalyzable-property-from-unresolvable-wire](#komaci1014-no-composition-on-unanalyzable-property-from-unresolvable-wire)
-   [`komaci1015`: no-composition-on-unanalyzable-property-non-public](#komaci1015-no-composition-on-unanalyzable-property-non-public)
-   [`komaci1016`: no-composition-on-unanalyzable-getter-property](#komaci1016-no-composition-on-unanalyzable-getter-property)
-   [`komaci1017`: no-composition-on-unanalyzable-property-missing](#komaci1017-no-composition-on-unanalyzable-property-missing)
-   [`komaci1018`: no-wire-config-property-circular-wire-dependency](#komaci1018-no-wire-config-property-circular-wire-dependency)
-   [`komaci1022`: no-assignment-expression-assigns-value-to-member-variable](#komaci1022-no-assignment-expression-assigns-value-to-member-variable)
-   [`komaci1023`: no-assignment-expression-for-external-components](#komaci1023-no-assignment-expression-for-external-components)
-   [`komaci1024`: no-tagged-template-expression-contains-unsupported-namespace](#komaci1024-no-tagged-template-expression-contains-unsupported-namespace)
-   [`komaci1025`: no-getter-contains-more-than-return-statement](#komaci1025-no-getter-contains-more-than-return-statement)
-   [`komaci1026`: no-expression-contains-module-level-variable-ref](#komaci1026-no-expression-contains-module-level-variable-ref)
-   [`komaci1027`: no-call-expression-references-unsupported-namespace](#komaci1027-no-call-expression-references-unsupported-namespace)
-   [`komaci1028`: no-eval-usage](#komaci1028-no-eval-usage)
-   [`komaci1029`: no-reference-to-class-functions](#komaci1029-no-reference-to-class-functions)
-   [`komaci1030`: no-reference-to-module-functions](#komaci1030-no-reference-to-module-functions)
-   [`komaci1031`: no-functions-declared-within-getter-method](#komaci1031-no-functions-declared-within-getter-method)
-   [`komaci1032`: no-unsupported-member-variable-in-member-expression](#komaci1032-no-unsupported-member-variable-in-member-expression)
-   [`komaci1033`: no-member-expression-reference-to-non-existent-member-variable](#komaci1033-no-member-expression-reference-to-non-existent-member-variable)
-   [`komaci1034`: no-member-expression-reference-to-unsupported-namespace-reference](#komaci1034-no-member-expression-reference-to-unsupported-namespace-reference)
-   [`komaci1035`: no-member-expression-contains-non-portable-identifier](#komaci1035-no-member-expression-contains-non-portable-identifier)
-   [`komaci1036`: no-member-expression-reference-to-super-class](#komaci1036-no-member-expression-reference-to-super-class)
-   [`komaci1037`: no-member-expression-reference-to-unsupported-global](#komaci1037-no-member-expression-reference-to-unsupported-global)
-   [`komaci1038`: no-reference-to-unsupported-namespace-reference](#komaci1038-no-reference-to-unsupported-namespace-reference)

## `komaci1001`: no-unresolved-parent-class-reference

| Code         | Description                                               | Message                                         | Severity |
| ------------ | --------------------------------------------------------- | ----------------------------------------------- | -------- |
| `komaci1001` | Flags when a component extends from an unresolable class. | This class refers to an unresolved parent class | error    |

### ❌ Incorrect

```js
const Foo = {}; // Not a class!
export default class Example extends Foo {} // flags
```

```js
// Foo is not defined
export default class Example extends Foo {} // flags
```

### ✅ Correct

```js
import Foo from 'x/foo';

export default class Example extends Foo {}
```

### 😟 Limitations

Using mixins with a parent class are currently not supported.

```js
import Foo from 'x/foo';
import Mixin from 'x/mixin';

export default class Example extends Mixin(Foo) {}
```

## `komaci1002`: no-multiple-template-files

| Code         | Description                                              | Message                                                                  | Severity |
| ------------ | -------------------------------------------------------- | ------------------------------------------------------------------------ | -------- |
| `komaci1002` | Flags when a component is using multiple template files. | This analyzer does not support LWCs which render multiple template files | warning  |

### ❌ Incorrect

```js
// example.js
import { LightningElement } from 'lwc';
import tmpl1 from './example.html';
import tmpl2 from './example.2.html';
export default class Example extends LightningElement {
    @api someInput;
    render() {
        return this.someInput ? tmpl1 : tmpl2;
    }
}
```

```html
<!-- example.html -->
<template></template>
```

```html
<!-- example.2.html -->
<template></template>
<!-- flags -->
```

### ✅ Correct

The only way to fix this is to not use multiple templates, or simply ignore the error.

## `komaci1003`: no-private-wire-config-property

| Code         | Description                                                              | Message                                                       | Severity |
| ------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------- | -------- |
| `komaci1003` | Flags when a component is using a private property within a wire config. | This wire configuration uses a property '{0}' that is private | error    |

### ❌ Incorrect

Private properties used in wire configs are not resolvable.

```js
import { LightningElement, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';

export default class Example extends LightningElement {
    recordId;

    @wire(getRecord, { recordId: '$recordId' })
    record;
}
```

### ✅ Correct

Make the property public.

```js
import { LightningElement, wire, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';

export default class Example extends LightningElement {
    @api recordId;

    @wire(getRecord, { recordId: '$recordId' })
    record;
}
```

### 😟 Limitations

Public properties decorated with `@api` cannot be reassigned.

```js
import { LightningElement, wire, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';

export default class Example extends LightningElement {
    recordId;

    connectedCallback() {
        this.recordId = '1234'; // Prevents recordId from being made public
    }

    @wire(getRecord, { recordId: '$recordId' })
    record;
}
```

## `komaci1004`: no-undefined-wire-config-property

| Code         | Description                                 | Message                                                          | Severity |
| ------------ | ------------------------------------------- | ---------------------------------------------------------------- | -------- |
| `komaci1004` | **⛔️ This diagnostic is no longer valid.** | This wire configuration uses a property '{0}' which is undefined | warning  |

## `komaci1006`: no-wire-configuration-property-using-output-of-non-primeable-wire

| Code         | Description                                                                            | Message                                                                                                                 | Severity |
| ------------ | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -------- |
| `komaci1006` | Flags when a wire's config is referencing the output of a wire that is not resolvable. | The wire configuration uses a property '{0}' that is the output of a non-primeable wire, making this wire non-primeable | error    |

### ❌ Incorrect

```js
import { LightningElement, wire, api } from 'lwc';
import { invalid } from 'x/invalid';
im `komaci1007`:port { getObjectInfo } from 'lightning/uiObjectInfoApi';

export default class Example extends LightningElement {
    // "invalid" is not a known wire, and thus is not primable
    @wire(invalid, {}) // komaci1007: "The wire adapter 'invalid' of resource 'x/invalid' cannot be primed"
    wiredOutput1;

    // Since "invalid" is not primable, its output "wiredOutput1.data" cannot be used as input in another wire
    @wire(getObjectInfo, { input: '$wiredOutput1.data' })
    wiredOutput2;
}
```

### ✅ Correct

```js
import { LightningElement, wire, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import { getObjectInfo } from 'lightning/uiObjectInfoApi';

export default class Example extends LightningElement {
    // "getRecord" from "lightning/uiRecordApi" is a known wire, and thus primeable
    @wire(getRecord, {})
    wiredOutput1;

    // valid
    @wire(getObjectInfo, { input: '$wiredOutput1.data' })
    wiredOutput2;
}
```

### Alternatives

This rule will flag if any wire is using input from another wire that's not primeable. Reference the diagnostic on the non-primeable wire's in order to address this issue.

## `komaci1007`: no-wire-adapter-of-resource-cannot-be-primed

| Code         | Description                               | Message                                                   | Severity |
| ------------ | ----------------------------------------- | --------------------------------------------------------- | -------- |
| `komaci1007` | Flags when an invalid wire is being used. | The wire adapter '{0}' of resource '{1}' cannot be primed | error    |

### ❌ Incorrect

Only wires from valid resources, such as [LDS wires](https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_ui_api) in the `lightning` namespace, are allowed.

```js
import { LightningElement, wire } from 'lwc';
import { invalid } from 'x/invalid';
import { alsoInvalid } from './invalid'; //

export default class Example extends LightningElement {
    @wire(invalid, {})
    wireOutput1;

    @wire(alsoInvalid, {})
    wireOutput2;
}
```

### ✅ Correct

```js
import { LightningElement, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import { getObjectInfo } from 'lightning/uiObjectInfoApi';

export default class Example extends LightningElement {
    @wire(getRecord, {})
    wireOutput1;

    @wire(getObjectInfo, {})
    wireOutput2;
}
```

### When To Ignore

If the wire you're using does not need to be primed for offline use.

## `komaci1008`: no-missing-resource-cannot-prime-wire-adapter

| Code         | Description                     | Message                                                                   | Severity |
| ------------ | ------------------------------- | ------------------------------------------------------------------------- | -------- |
| `komaci1008` | Flags when wire is not defined. | The wire adapter cannot be primed because it refers to a missing resource | error    |

### ❌ Incorrect

```js
import { LightningElement, wire } from 'lwc';

export default class ScriptTestClass extends LightningElement {
    // getRecord has not been imported
    @wire(getRecord, {})
    record;
}
```

### ✅ Correct

```js
import { LightningElement, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';

export default class ScriptTestClass extends LightningElement {
    @wire(getRecord, {})
    record;
}
```

## `komaci1009`: no-wire-config-property-uses-getter-function-returning-non-literal

| Code         | Description                                                                             | Message                                                                                               | Severity |
| ------------ | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -------- |
| `komaci1009` | Flags when a wire uses a getter that returns an unsupported value that's not a literal. | This wire configuration uses a property from a getter function named '{0}' that returns a non-literal | error    |

### ❌ Incorrect

```js
import { LightningElement, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
export default class Example extends LightningElement {
    prop; // unsupported
    get value() {
        return this.prop;
    }

    @wire(getRecord, { input: '$value' }) // flags
    record;
}
```

### ✅ Correct

```js
import { LightningElement, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
export default class Example extends LightningElement {
    prop; // unsupported
    get value() {
        return this.prop;
    }

    @wire(getRecord, { input: '$value' }) // flags
    record;
}
```

## `komaci1010`: no-wire-config-property-uses-getter-function-returning-inaccessible-import

| Code         | Description                                                                                    | Message                                                                                                        | Severity |
| ------------ | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------- |
| `komaci1010` | Flags when an unknown resource is imported and used in a getter referenced by a wire's config. | This wire configuration uses a property from a getter function named '{0}' that returns an inaccessible import | error    |

### ❌ Incorrect

```js
import { LightningElement, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import { invalid } from 'x/invalid';

export default class ScriptTestClass extends LightningElement {
    get label() {
        return invalid;
    }

    @wire(getRecord, { label: '$label' })
    record1;
}
```

### ✅ Correct

Only known resources, such as those imported from `@salesforce/*`, can be used in wires.

```js
import { LightningElement, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import myLabel from '@salesforce/label/My.Label';

export default class ScriptTestClass extends LightningElement {
    get label() {
        return myLabel;
    }

    @wire(getRecord, { label: '$label' })
    record1;
}
```

## `komaci1011`: no-class-refers-to-parent-class-from-unsupported-namespace

| Code         | Description                                                    | Message                                                           | Severity |
| ------------ | -------------------------------------------------------------- | ----------------------------------------------------------------- | -------- |
| `komaci1011` | Flags when the component extends from an invalid parent class. | This class refers to a parent class from an unsupported namespace | error    |

### ❌ Incorrect

```js
import Foo from './foo';
export default class Example extends Foo {}
```

### ✅ Correct

```js
import Foo from 'lightning/recordForm';

export default class Example extends Foo {}
```

## `komaci1012`: no-wire-config-property-uses-imported-artifact-from-unsupported-namespace

| Code         | Description                                                                                | Message                                                                                  | Severity |
| ------------ | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | -------- |
| `komaci1012` | Flags when a wire references an imported artifacted that is not from a supported resource. | This wire configuration uses an imported artifact '{0}' from unsupported namespace '{1}' | error    |

### ❌ Incorrect

```js
import { LightningElement, wire, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import invalid from 'x/invalid';

export default class Example extends LightningElement {
    @wire(getRecord, { label: invalid })
    records;
}
```

### ✅ Correct

Only reference imported artifacts from `@salesforce/*`.

```js
import { LightningElement, wire, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import label from '@salesforce/label/My.Label';

export default class Example extends LightningElement {
    @wire(getRecord, { recordId: label })
    records;
}
```

## `komaci1013`: no-wire-config-references-non-local-property-reactive-value

| Code         | Description                                                                                     | Message                                                                                | Severity |
| ------------ | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------- |
| `komaci1013` | Flags when a wire config references a non-local property via dollar-sign syntax, e.g., '$prop'. | This wire configuration references a reactive value '{0}' that is not a local property | warning  |

Wire configs that use the dollar-sign syntax must only reference component properties. It cannot reference imported values, or other values defined outside the component's class.

### ❌ Incorrect

```js
import { LightningElement, wire, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import label from '@salesforce/label/My.Label';

export default class Example extends LightningElement {
    @wire(getRecord, { recordId: '$label' })
    records;
}
```

### ✅ Correct

Try referencing the value directly.

```js
import { LightningElement, wire, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import label from '@salesforce/label/My.Label';

export default class Example extends LightningElement {
    @wire(getRecord, { recordId: label })
    records;
}
```

Or, try setting the value to a property before referencing.

```js
import { LightningElement, wire, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import label from '@salesforce/label/My.Label';

export default class Example extends LightningElement {
    @api label;
    @wire(getRecord, { recordId: '$label' })
    records;
}
```

Or, try using a getter that returns the value.

```js
import { LightningElement, wire, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import label from '@salesforce/label/My.Label';

export default class Example extends LightningElement {
    get label() {
        return label;
    }
    @wire(getRecord, { recordId: '$label' })
    records;
}
```

## `komaci1014`: no-composition-on-unanalyzable-property-from-unresolvable-wire

| Code         | Description                                                       | Message                                                                      | Severity |
| ------------ | ----------------------------------------------------------------- | ---------------------------------------------------------------------------- | -------- |
| `komaci1014` | Flags when a property referenced in a template is not analyzable. | This {0} an unanalyzable property '{1}' that is wired by a unresolvable wire | error    |

This flags when a template references a value that is not analyzable, such as invalid getter, or a wire output from an unsupported or unprimeable wire. Note, `{0}` in the message may reference iterators, image tags, or inputs to a child component.

### ❌ Incorrect

```js
import { LightningElement, wire, api } from 'lwc';
import { invalid } from 'x/invalid';
export default class Example extends LightningElement {
    @wire(invalid, {})
    wireOutput;
}
```

```html
<template>
    <c-child input="{wireOutput}"></c-child>
</template>
```

### ✅ Correct

```js
import { LightningElement, wire, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
export default class Example extends LightningElement {
    @wire(getRecord, {})
    wireOutput;
}
```

```html
<template>
    <c-child input="{wireOutput}"></c-child>
</template>
```

## `komaci1015`: no-composition-on-unanalyzable-property-non-public

| Code         | Description                                           | Message                                                               | Severity |
| ------------ | ----------------------------------------------------- | --------------------------------------------------------------------- | -------- |
| `komaci1015` | Flags property binding used in a template is private. | This {0} an unanalyzable property '{1}' that is not a public property | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    notPublic;
}
```

```html
<template>
    <c-child input="{notPublic}"></c-child>
</template>
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    @api public;
}
```

```html
<template>
    <c-child input="{public}"></c-child>
</template>
```

## `komaci1016`: no-composition-on-unanalyzable-getter-property

| Code         | Description                                                           | Message                                        | Severity |
| ------------ | --------------------------------------------------------------------- | ---------------------------------------------- | -------- |
| `komaci1016` | Flags template property bindings that reference unanalyzable getters. | This {0} an unanalyzable getter property '{1}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    prop;
    get invalidGetter() {
        this.prop = 'new value'; // mutations not allowed
        return this.prop;
    }
}
```

```html
<template>
    <c-child input="{invalidGetter}"></c-child>
</template>
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    @api prop;
    get getter() {
        return this.prop;
    }
}
```

```html
<template>
    <c-child input="{getter}"></c-child>
</template>
```

## `komaci1017`: no-composition-on-unanalyzable-property-missing

| Code         | Description                                                                                  | Message                                                                         | Severity |
| ------------ | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -------- |
| `komaci1017` | Property binding within the template references a property not found in the javascript file. | This {0} a property '{1}' which does not exist in the corresponding script file | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {}
```

```html
<template>
    <c-child input="{doesNotExist}"></c-child>
</template>
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    @api doesExist;
}
```

```html
<template>
    <c-child input="{doesExist}"></c-child>
</template>
```

### 😟 Limitations

This will flag if a child class is referencing a property that's only defined on the parent class.

#### ❌ Incorrect

```js
import Parent from 'x/parent';
export default class Example extends Parent {}
```

```html
<template>
    <c-child input="{existsOnParent}"></c-child>
</template>
```

### ✅ Correct

To fix this, you must update the javascript file to explicitly define properties that are references in the template.

```js
import Parent from 'x/parent';
export default class Example extends Parent {
    @api existsOnParent;
}
```

```html
<template>
    <c-child input="{existsOnParent}"></c-child>
</template>
```

## `komaci1018`: no-wire-config-property-circular-wire-dependency

| Code         | Description                                                                                                         | Message                                                                                                                                                                                                                                     | Severity |
| ------------ | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| `komaci1018` | Flags when a wire's output is used as input into another wire, and that wire's output is used in the original wire. | The wire configuration input property '{0}' of this wire is part of a chain of circular wire dependencies, and will result an infinite loop during runtime. Please refactor code to remove the circular dependency. Dependency chain: '{1}' | error    |

### ❌ Incorrect

```js
import { LightningElement, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
export default class Example extends LightningElement {
    @wire(getRecord, { input: '$wireOutput2' })
    wireOutput1;

    @wire(getRecord, { input: '$wireOutput1' })
    wireOutput2;
}
```

### ✅ Correct

Remove the ciruclar dependency.

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    @api input;
    @wire(getRecord, { input: '$input' })
    wireOutput;
}
```

## `komaci1022`: no-assignment-expression-assigns-value-to-member-variable

| Code         | Description                                  | Message                                                              | Severity |
| ------------ | -------------------------------------------- | -------------------------------------------------------------------- | -------- |
| `komaci1022` | Flags getters that mutate member properties. | Assignment expression cannot assign a value to member variable '{0}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    prop;
    get input() {
        const value = 'value';
        this.prop = value;
        return value;
    }
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    prop;
    get input() {
        return 'value';
    }
}
```

## `komaci1023`: no-assignment-expression-for-external-components

| Code         | Description | Message                                                          | Severity |
| ------------ | ----------- | ---------------------------------------------------------------- | -------- |
| `komaci1023` | Flags       | Assignment Expressions are not supported for external components | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    prop;
    get getter() {
        return (this.prop = 'hi'), this.prop;
    }
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    @api prop;
    get getter() {
        return this.prop;
    }
}
```

## `komaci1024`: no-tagged-template-expression-contains-unsupported-namespace

| Code         | Description                                                             | Message                                                                           | Severity |
| ------------ | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -------- |
| `komaci1024` | Flags when the tag in a tagged template is from an unspported resource. | Tagged Template Expression contains a reference to an unsupported namespace '{0}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
import invalid from 'x/invalid';

export default class Example extends LightningElement {
    invalidProp = invalid`normal string`;
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
import { gql } from 'lightning/uiGraphQLApi';

export default class Example extends LightningElement {
    validProp = gql`normal string`;
}
```

## `komaci1025`: no-getter-contains-more-than-return-statement

| Code         | Description                                          | Message                                               | Severity |
| ------------ | ---------------------------------------------------- | ----------------------------------------------------- | -------- |
| `komaci1025` | Flags getters that do more than just return a value. | Supported getters can only contain a return statement | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    get invalidGetter() {
        const val = 'val';
        return val;
    }
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    get invalidGetter() {
        return 'val';
    }
}
```

## `komaci1026`: no-expression-contains-module-level-variable-ref

| Code         | Description                                                          | Message                                                                  | Severity |
| ------------ | -------------------------------------------------------------------- | ------------------------------------------------------------------------ | -------- |
| `komaci1026` | Getter contains reference to a variable defined at the module level. | Expression contains a reference to a variable at the module level: '{0}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
const moduleValue = 'val';
export default class Example extends LightningElement {
    get invalid() {
        return moduleValue;
    }
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    get propValue() {
        return 'val';
    }
    get invalid() {
        return this.propValue;
    }
}
```

## `komaci1027`: no-call-expression-references-unsupported-namespace

| Code         | Description                                           | Message                                                              | Severity |
| ------------ | ----------------------------------------------------- | -------------------------------------------------------------------- | -------- |
| `komaci1027` | Getter invokes a function from an unsupported import. | Call expression contains reference to an unsupported namespace '{0}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
import invalid from 'x/invalid';
export default class Example extends LightningElement {
    get invalidGetter() {
        return invalid();
    }
}
```

### ✅ Correct

Invoking functions is not allowed in getters.

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {}
```

## `komaci1028`: no-eval-usage

| Code         | Description                                 | Message                                                | Severity |
| ------------ | ------------------------------------------- | ------------------------------------------------------ | -------- |
| `komaci1028` | Flags a getter that attempts to use `eval`. | Call expression contains non-portable identifier '{0}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    get invalid() {
        return eval('something evil');
    }
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    get valid() {
        return 'do no evil';
    }
}
```

## `komaci1029`: no-reference-to-class-functions

| Code         | Description                                            | Message                                                                   | Severity |
| ------------ | ------------------------------------------------------ | ------------------------------------------------------------------------- | -------- |
| `komaci1029` | Flags when an expression references a member function. | Call expression contains reference to function defined on the class '{0}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    doSomething() {
        return 'value';
    }

    get value() {
        return this.doSomething(); // flags
    }

    someProp = `${this.doSomething()}`; // flags
}
```

### ✅ Correct

Replace with getter if you can.

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    get something() {
        return 'value';
    }
    get value() {
        return this.something;
    }

    someProp = `${this.something}`;
}
```

## `komaci1030`: no-reference-to-module-functions

| Code         | Description                                                   | Message                                                                    | Severity |
| ------------ | ------------------------------------------------------------- | -------------------------------------------------------------------------- | -------- |
| `komaci1030` | Expression references a function defined at the module level. | Call expression contains reference to function defined on the module '{0}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';

// Module level function
function doSomething() {
    return 'value';
}

export default class Example extends LightningElement {
    get value() {
        return doSomething(); // flags
    }

    someProp = `${doSomething()}`; // flags
}
```

### ✅ Correct

Replace with getter if you can.

```js
import { LightningElement } from 'lwc';

export default class Example extends LightningElement {
    get something() {
        return 'value';
    }
    get value() {
        return this.something;
    }

    someProp = `${this.something}`;
}
```

## `komaci1031`: no-functions-declared-within-getter-method

| Code         | Description                                                    | Message                                              | Severity |
| ------------ | -------------------------------------------------------------- | ---------------------------------------------------- | -------- |
| `komaci1031` | Flags when a getter or template expression defines a function. | Functions may not be declared within a getter method | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';

export default class Example extends LightningElement {
    get value() {
        return (() => 'value')(); // flags
    }

    str = `${(() => 'value')()}`; // flags
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    get value() {
        return 'value';
    }

    str = `value`;
}
```

## `komaci1032`: no-unsupported-member-variable-in-member-expression

| Code         | Description                                                                                           | Message                                                                   | Severity |
| ------------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -------- |
| `komaci1032` | Flags when a getter or template expression references an unsupported (e.g., private) member variable. | Member expression contains reference to unsupported member variable '{0}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    privateProp; // unsupported member variable

    get value() {
        return this.privateProp; // flags
    }

    otherValue = `${this.privateProp}`; // flags
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    @api prop;

    get value() {
        return this.prop;
    }

    otherValue = `${this.prop}`;
}
```

## `komaci1033`: no-member-expression-reference-to-non-existent-member-variable

| Code         | Description                                                                                | Message                                                                    | Severity |
| ------------ | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | -------- |
| `komaci1033` | Expression references a member variable that has not been explicitly defined on the class. | Member expression contains reference to non-existent member variable '{0}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    get value() {
        return this.doesNotExist;
    }

    otherValue = `${this.doesNotExist}`;
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    @api doesExist;
    get value() {
        return this.doesExist;
    }

    otherValue = `${this.doesExist}`;
}
```

## `komaci1034`: no-member-expression-reference-to-unsupported-namespace-reference

| Code         | Description                                                                      | Message                                                                        | Severity |
| ------------ | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | -------- |
| `komaci1034` | Flags when an expression references a property on a resouce that is unsupported. | Member expression contains reference to unsupported namespace reference: '{0}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
import invalid from 'x/invalid';
export default class Example extends LightningElement {
    get value() {
        return invalid.foo;
    }

    str = `${invalid.foo}`;
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {}
```

## `komaci1035`: no-member-expression-contains-non-portable-identifier

| Code         | Description                                                                              | Message                                                  | Severity |
| ------------ | ---------------------------------------------------------------------------------------- | -------------------------------------------------------- | -------- |
| `komaci1035` | Flags when an expression references a non-portable variable like `document` or `window`. | Member expression contains non-portable identifier '{0}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    get value() {
        return window.foo;
    }

    str = `${window.foo}`;
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {}
```

## `komaci1036`: no-member-expression-reference-to-super-class

| Code         | Description                                 | Message                                                    | Severity |
| ------------ | ------------------------------------------- | ---------------------------------------------------------- | -------- |
| `komaci1036` | Flags when an expression references `super` | Member expression contains reference to super class: '{0}' | error    |

### ❌ Incorrect

```js
import Parent from 'x/parent';
export default class Example extends Parent {
    get value() {
        return super.value;
    }

    str = `${super.value}`;
}
```

### ✅ Correct

```js
import Parent from 'x/parent';
export default class Example extends Parent {
    @api value;
    get value() {
        return this.value;
    }

    str = `${this.value}`;
}
```

## `komaci1037`: no-member-expression-reference-to-unsupported-global

| Code         | Description                                                                     | Message                                                           | Severity |
| ------------ | ------------------------------------------------------------------------------- | ----------------------------------------------------------------- | -------- |
| `komaci1037` | Flags when an expression references a global variable like `String` or `Object` | Member expression contains reference to unsupported global: '{0}' | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    get value() {
        return new String.foo();
    }

    str = `${String.foo}`;
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {}
```

## `komaci1038`: no-reference-to-unsupported-namespace-reference

| Code         | Description                                                                            | Message                                                                | Severity |
| ------------ | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | -------- |
| `komaci1038` | Flags when a resource imported from an unspported namespaces is used in an expression. | Reference to import '{0}' from an unsupported namespace is not allowed | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
import invalid from 'x/invalid';
export default class Example extends LightningElement {
    get value() {
        return invalid;
    }
}
```

### ✅ Correct

You can only use values imported from supported namespaces like `@salesforce/*`.

```js
import { LightningElement } from 'lwc';
import valid from '@salesforce/label/My.Label';
export default class Example extends LightningElement {
    get value() {
        return valid;
    }
}
```

## `komaci1039`: no-render-function-contains-more-than-return-statement

| Code         | Description                                                   | Message                                                        | Severity |
| ------------ | ------------------------------------------------------------- | -------------------------------------------------------------- | -------- |
| `komaci1039` | Flags render functions that do more than just return a value. | Supported render functions can only contain a return statement | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
import template from './tesTemplate.html';
export default class Example extends LightningElement {
    render() {
        const val = 'val';
        return val ? template : undefined;
    }
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
import template from './tesTemplate.html';
export default class Example extends LightningElement {
    render() {
        return template;
    }
}
```

## `komaci1040`: no-render-function-return-statement

| Code         | Description                                                  | Message                                                       | Severity |
| ------------ | ------------------------------------------------------------ | ------------------------------------------------------------- | -------- |
| `komaci1040` | Flags render functions that don't contain a return statement | Supported render functions need to contain a return statement | error    |

### ❌ Incorrect

```js
import { LightningElement } from 'lwc';
export default class Example extends LightningElement {
    render() {
        const val = 'val';
    }
}
```

### ✅ Correct

```js
import { LightningElement } from 'lwc';
import template from './tesTemplate.html';
export default class Example extends LightningElement {
    render() {
        return template;
    }
}
```

## `komaci1041`: no-render-function-return-statement-not-returning-imported-template

| Code         | Description                                                                                   | Message                                                                 | Severity |
| ------------ | --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | -------- |
| `komaci1041` | Flags render functions that attempt to return something that isn't an imported local template | Supported render functions can only return supported imported templates | error    |

### ❌ Incorrect

```js
import { LightningElement, api } from 'lwc';
import template from 'lightning/something';
export default class Example extends LightningElement {
    @api
    firstOrSecondTemplate;

    @api
    passedInTemplate;

    render() {
        return this.firstOrSecondTemplate
            ? this.passedInTemplate //not suported because it's passed through the prop
            : template; // not supported because it's imported from another module
    }
}
```

### ✅ Correct

```js
import { LightningElement, api } from 'lwc';
import firstTemplate from './firstTemplate.html';
import secondTemplate from './secondTemplate.html';
export default class Example extends LightningElement {
    @api
    firstOrSecondTemplate;

    render() {
        return this.firstOrSecondTemplate ? firstTemplate : secondTemplate;
    }
}
```
