# developtools_ets_lint_rules **Repository Path**: openharmony-sig/developtools_ets_lint_rules ## Basic Information - **Project Name**: developtools_ets_lint_rules - **Description**: An ESLint plugin which provides lint rules for Extend-TypeScript codebase. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-01-26 - **Last Updated**: 2025-05-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 🚨 **重要提示 | IMPORTANT** > > **⚠️ 此代码仓已归档。新地址请访问 [developtools_ets_lint_rules](https://gitcode.com/openharmony-sig/developtools_ets_lint_rules)。| ⚠️ This repository has been archived. For the new address, please visit [developtools_ets_lint_rules](https://gitcode.com/openharmony-sig/developtools_ets_lint_rules).** > --- >

ESLint Plugin Extend-TypeScript

An ESLint plugin which provides lint rules for Extend-TypeScript codebase.

## Getting Started - rules: The folder contains all rules for ets - utils: The utility tools ## Quick Start ### Installation Make sure you have `@typescript-eslint/parser` and `ESLint` installed: ```bash yarn add @typescript-eslint/parser@4.8.0 eslint@7.7.0 npm i @typescript-eslint/parser@4.8.0 eslint@7.7.0 ``` Then install the plugin: ```bash yarn add -D @hw-ets-eslint/eslint-plugin npm i --save-dev @hw-ets-eslint/eslint-plugin ``` It is important that you use ESLint version `<8.0.0` ### Usage Add `@typescript-eslint/parser` to the `parser` field and `@hw-ets-eslint` to the plugins sections of your `.eslintrc` configuration file, then configure the rules you want to use under the rules section. ```json { "parser": "@typescript-eslint/parser", "plugins": ["@hw-ets-eslint"], "extends": ["plugin:@hw-ets-eslint/all"] } ``` **Note: Make sure to use `eslint --ext .ets` since by [default](https://eslint.org/docs/user-guide/command-line-interface#--ext)`eslint` will only search for `.js` files.** ## Supported Rules **Key**: :heavy_check_mark: = recommended, :wrench: = fixable, :thought_balloon: = requires type information | Name | Description | :heavy_check_mark: | :wrench: | :thought_balloon: | |------|-------------|--------------------|----------|-------------------| | [`@hw-ets-eslint/ets-build-in-low-code-mode`](./docs/rules/ets-build-in-low-code-mode.md) | The build function of the entry modification should be empty in low code mode.| | | | | [`@hw-ets-eslint/ets-build-root-node`](./docs/rules/ets-build-root-node) | Checking the root node of the build function. | | | | | [`@hw-ets-eslint/ets-check-storagelink-and-storageprop-parm`](./docs/rules/ets-check-storagelink-and-storageprop-parm) | Validate StorageLink/StorageProp param in a component. | | | | | [`@hw-ets-eslint/ets-construct-parameter`](./docs/rules/ets-construct-parameter) | validate Ets custom component construct parameter type. | | | | | [`@hw-ets-eslint/ets-import-path`](./docs/rules/ets-import-path) | Checking the import path. | | | | | [`@hw-ets-eslint/ets-link-init-in-struct-constructor`](./docs/rules/ets-link-init-in-struct-constructor) | The `@Link` property should initialize using `$` to create a reference. | | :wrench: | | | [`@hw-ets-eslint/ets-nested-relationship`](./docs/rules/ets-nested-relationship) | Checking the nesting relationship between ETS compoents. | | | | | [`@hw-ets-eslint/ets-no-dupe-decorators`](./docs/rules/ets-no-dupe-decorators) | Disallow duplicate decorators. | | :wrench: | | | [`@hw-ets-eslint/ets-no-duplicate-entry`](./docs/rules/ets-no-duplicate-entry) | Duplicate Entry in an ETS file. | | | | | [`@hw-ets-eslint/ets-no-duplicate-state-manager`](./docs/rules/ets-no-duplicate-state-manager) | The property cannot have mutilate state management decorators. | | | | | [`@hw-ets-eslint/ets-no-non-ui-syntax`](./docs/rules/ets-no-non-ui-syntax) | Disallow non UI component syntax under `build` and `@Builder` method. | | | | | [`@hw-ets-eslint/ets-no-prop-link-objectlink-in-entry`](./docs/rules/ets-no-prop-link-objectlink-in-entry) | Disallow @Prop/@Link/@ObjectLink in entry component. | | :wrench: | | | [`@hw-ets-eslint/ets-one-decorator-on-function`](./docs/rules/ets-one-decorator-on-function) | Disallow multiple decorators. | | | | | [`@hw-ets-eslint/ets-property-type`](./docs/rules/ets-property-type) | Checking the type of decorator-modified attributes in a struct component. | | | | | [`@hw-ets-eslint/ets-struct-missing-decorator`](./docs/rules/ets-struct-missing-decorator) | Missing identifier @Component or @CustomDialog. | | | | | [`@hw-ets-eslint/ets-struct-no-extends`](./docs/rules/ets-struct-no-extends) | Struct component is not allowed to extends or implements other class. | | | | | [`@hw-ets-eslint/ets-struct-variable-initialization`](./docs/rules/ets-struct-variable-initialization) | Struct variable initialization. | | :wrench: | | | [`@hw-ets-eslint/ets-validate-build-in-struct`](./docs/rules/ets-validate-build-in-struct) | Validate build function in a struct. | | | | | [`@hw-ets-eslint/ets-variable-initialization-via-component-constructor`](./docs/rules/ets-variable-initialization-via-component-constructor) | Check variable initialization via component constructor. | | | | [`@hw-ets-eslint/ets-watch-decorator-function`](./docs/rules/ets-watch-decorator-function) | The watch decorator must have a callback function defined in struct. | | :wrench: | | | [`@hw-ets-eslint/ets-watch-decorator-regular`](./docs/rules/ets-watch-decorator-regular) | Disallow `@watch` decorate regular variables. | | :wrench: | |