Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Detect pseudo modules of DataType #112

Merged
merged 24 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
27ba9b5
feat: Add datatypes to processing
d3xter666 Apr 22, 2024
6c931a4
fix: Eslint issues
d3xter666 May 10, 2024
01f0234
feat: Add datatypes
d3xter666 May 13, 2024
8634f28
feat: Differentiate dataTypes from enums
d3xter666 May 13, 2024
ea8b1f1
refactor: Relocate dataTypes.json
d3xter666 May 13, 2024
f91c21f
feat: Detect DataType misuse
d3xter666 May 13, 2024
2dfdd9e
fix: Record only data types
d3xter666 May 13, 2024
0cc339e
fix: Data types entry check
d3xter666 May 13, 2024
d9944a6
fix: Update snapshots
d3xter666 May 13, 2024
3946204
refactor: Move development guidelines in a separate file
d3xter666 May 13, 2024
e358aa7
refactor: Renames of vars
d3xter666 May 14, 2024
7d592ad
fix: Resolve topic links to the latest UI5 documentation
d3xter666 May 17, 2024
37d5abe
refactor: Simplify DataTypes/ENUM generation
d3xter666 May 23, 2024
6b5e819
fix: Update definitions
d3xter666 May 23, 2024
4e2fdef
fix: ESLint
d3xter666 May 23, 2024
245b019
refactor: Renames
d3xter666 May 23, 2024
4587a1b
refactor: Get dataTypes only once per execution
d3xter666 May 23, 2024
22900bc
feat: Consolidate messages and rules in a single place
d3xter666 May 23, 2024
9a244e7
refactor: Migrate SourceFileLinter to the new messaging mechanism
d3xter666 May 23, 2024
0f4b353
fix: Also check the kind prop for ENUM
d3xter666 May 23, 2024
cfe0df9
refactor: Update messages & test snapshots
d3xter666 May 27, 2024
e3bb228
refactor: Update messages & test snapshots
d3xter666 May 27, 2024
9a3c449
refactor: Update messages
d3xter666 May 27, 2024
acb3888
fix: Resolve merge conflicts
d3xter666 Jun 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,6 @@ Choose the output format. Currently, `stylish` (default) and `json` are supporte
ui5lint --format json
```

## Metadata generation

**Note:** This section is intended to support UI5 Linter developers and is not meant for end users of the linter!

The UI5 Linter requires metadata to accurately identify certain issues within the codebase. While the absence of this metadata does not hinder the linter's basic functionality, it may result in incomplete findings.

The extracted and generated metadata is stored within the repository under the `/resources` folder. This metadata plays a crucial role in enhancing the accuracy of the linter's analysis.

Regular updates to the metadata are necessary to ensure that the data is compatible with the corresponding UI5 type definitions.

```sh
npm run update-pseudo-modules-info -- $DOMAIN_NAME/com/sap/ui5/dist/sapui5-sdk-dist/1.120.13/sapui5-sdk-dist-1.120.13-api-jsons.zip 1.120.13
```

```sh
npm run update-semantic-model-info -- $DOMAIN_NAME/com/sap/ui5/dist/sapui5-sdk-dist/1.120.13/sapui5-sdk-dist-1.120.13-api-jsons.zip 1.120.13
```


## Support, Feedback, Contributing

This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/SAP/ui5-linter/issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md).
Expand Down
21 changes: 21 additions & 0 deletions docs/Development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
![UI5 logo](./docs/images/UI5_logo_wide.png)

# UI5 linter Development

**Note:** This document is intended to support UI5 Linter developers and is not meant for end users of the linter!

## Metadata generation

The UI5 Linter requires metadata to accurately identify certain issues within the codebase. While the absence of this metadata does not hinder the linter's basic functionality, it may result in incomplete findings.

The extracted and generated metadata is stored within the repository under the `/resources` folder. This metadata plays a crucial role in enhancing the accuracy of the linter's analysis.

Regular updates to the metadata are necessary to ensure that the data is compatible with the corresponding UI5 type definitions.

```sh
npm run update-pseudo-modules-info -- $DOMAIN_NAME/com/sap/ui5/dist/sapui5-sdk-dist/1.120.12/sapui5-sdk-dist-1.120.12-api-jsons.zip 1.120.12
```

```sh
npm run update-semantic-model-info -- $DOMAIN_NAME/com/sap/ui5/dist/sapui5-sdk-dist/1.120.12/sapui5-sdk-dist-1.120.12-api-jsons.zip 1.120.12
```
1 change: 1 addition & 0 deletions resources/dataTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"sap.ui.commons.SplitterSize":"SplitterSize","sap.ui.core.AbsoluteCSSSize":"AbsoluteCSSSize","sap.ui.core.Collision":"Collision","sap.ui.core.CSSColor":"CSSColor","sap.ui.core.CSSSize":"CSSSize","sap.ui.core.CSSSizeShortHand":"CSSSizeShortHand","sap.ui.core.Dock":"Dock","sap.ui.core.ID":"ID","sap.ui.core.Percentage":"Percentage","sap.ui.core.URI":"URI","sap.f.DynamicPageTitleShrinkRatio":"DynamicPageTitleShrinkRatio","sap.gantt.GenericArray":"GenericArray","sap.gantt.PaletteColor":"PaletteColor","sap.gantt.SVGLength":"SVGLength","sap.gantt.ValueSVGPaintServer":"ValueSVGPaintServer","sap.ui.layout.BoxesPerRowConfig":"BoxesPerRowConfig","sap.ui.layout.cssgrid.CSSGridGapShortHand":"cssgrid.CSSGridGapShortHand","sap.ui.layout.cssgrid.CSSGridLine":"cssgrid.CSSGridLine","sap.ui.layout.cssgrid.CSSGridTrack":"cssgrid.CSSGridTrack","sap.ui.layout.form.ColumnCells":"form.ColumnCells","sap.ui.layout.form.ColumnsL":"form.ColumnsL","sap.ui.layout.form.ColumnsM":"form.ColumnsM","sap.ui.layout.form.ColumnsXL":"form.ColumnsXL","sap.ui.layout.form.EmptyCells":"form.EmptyCells","sap.ui.layout.form.GridElementCells":"form.GridElementCells","sap.ui.layout.GridIndent":"GridIndent","sap.ui.layout.GridSpan":"GridSpan","sap.m.SelectColumnRatio":"SelectColumnRatio","sap.m.ValueCSSColor":"ValueCSSColor","sap.ui.vtm.Matrix":"Matrix","sap.uxap.BlockBaseColumnLayout":"BlockBaseColumnLayout"}
29 changes: 15 additions & 14 deletions resources/overrides/library/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
import "./sap.ca.ui";
import "./sap.chart";
import "./sap.collaboration";
import "./sap.f";
import "./sap.gantt";
import "./sap.m";
import "./sap.makit";
import "./sap.me";
import "./sap.rules.ui";
import "./sap.suite.ui.commons";
import "./sap.suite.ui.generic.template";
import "./sap.suite.ui.microchart";
import "./sap.tnt";
import "./sap.ui.commons";
import "./sap.ui.comp";
import "./sap.ui.core";
import "./sap.ui.export";
import "./sap.f";
import "./sap.gantt";
import "./sap.ui.generic.app";
import "./sap.ui.integration";
import "./sap.ui.layout";
import "./sap.makit";
import "./sap.ui.mdc";
import "./sap.m";
import "./sap.me";
import "./sap.ui.richtexteditor";
import "./sap.rules.ui";
import "./sap.suite.ui.generic.template";
import "./sap.ui.vtm";
import "./sap.ui.suite";
import "./sap.suite.ui.commons";
import "./sap.suite.ui.microchart";
import "./sap.ui.support";
import "./sap.ui.table";
import "./sap.tnt";
import "./sap.ca.ui";
import "./sap.ui.unified";
import "./sap.ushell";
import "./sap.ui.ux3";
import "./sap.uxap";
import "./sap.ui.vbm";
import "./sap.viz";
import "./sap.ui.webc.fiori";
import "./sap.ui.webc.main";
import "./sap.ushell";
import "./sap.uxap";
import "./sap.viz";
12 changes: 12 additions & 0 deletions resources/overrides/library/sap.f.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ declare module "sap/f/DynamicPageTitleArea" {
export default DynamicPageTitleArea;
}

declare module "sap/f/DynamicPageTitleShrinkRatio" {
import {DynamicPageTitleShrinkRatio} from "sap/f/library";

/**
* A string type that represents the shrink ratios of the areas within the <code>sap.f.DynamicPageTitle</code>.
*
* @public
* @since 1.54
*/
export default DynamicPageTitleShrinkRatio;
}

declare module "sap/f/LayoutType" {
import {LayoutType} from "sap/f/library";

Expand Down
51 changes: 51 additions & 0 deletions resources/overrides/library/sap.gantt.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,21 @@ declare module "sap/gantt/DragOrientation" {
export default DragOrientation;
}

declare module "sap/gantt/GenericArray" {
import {GenericArray} from "sap/gantt/library";

/**
* A hybrid data type that can represent an array of string, or array of object. The result value parsed by this data type are "string[]" or "object[]"
*
* Examples of valid values in js: <ol> <li>["order", "activity"]</li> <li>[{name:"order", idName:"OrderNo"},{name:"activity"}]</li> <li>[{name:"order", idName:"OrderNo"},"activity"]</li> </ol>
*
* Examples of valid values in xml view: <ol> <li>"order,activity"</li> <li>"[order,activity]"</li> <li>[{"name":"order", "idName":"OrderNo"},{"name":"activity"}]</li> </ol>
*
* @public
*/
export default GenericArray;
}

declare module "sap/gantt/MouseWheelZoomType" {
import {MouseWheelZoomType} from "sap/gantt/library";

Expand All @@ -136,6 +151,18 @@ declare module "sap/gantt/MouseWheelZoomType" {
export default MouseWheelZoomType;
}

declare module "sap/gantt/PaletteColor" {
import {PaletteColor} from "sap/gantt/library";

/**
* Accepts only Gantt palette colors names.
*
* @public
* @since 1.69
*/
export default PaletteColor;
}

declare module "sap/gantt/SelectionMode" {
import {SelectionMode} from "sap/gantt/library";

Expand Down Expand Up @@ -324,3 +351,27 @@ declare module "sap/gantt/simple/yAxisColumnContent" {
*/
export default simple.yAxisColumnContent;
}

declare module "sap/gantt/SVGLength" {
import {SVGLength} from "sap/gantt/library";

/**
* A length is a distance measurement, given as a number along with a unit. If unit is not provided, the length value represents a distance in the current user coordinate system.
d3xter666 marked this conversation as resolved.
Show resolved Hide resolved
*
* @public
*/
export default SVGLength;
}

declare module "sap/gantt/ValueSVGPaintServer" {
import {ValueSVGPaintServer} from "sap/gantt/library";

/**
* A string type that represents SVG fill color values.
*
* Allowed values are {@link sap.ui.core.CSSColor} and {@link sap.m.ValueColor} and LESS parameter The empty string and invalid less parameter fall back to default black color.
d3xter666 marked this conversation as resolved.
Show resolved Hide resolved
*
* @public
*/
export default ValueSVGPaintServer;
}
27 changes: 27 additions & 0 deletions resources/overrides/library/sap.m.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,20 @@ declare module "sap/m/ScreenSize" {
export default ScreenSize;
}

declare module "sap/m/SelectColumnRatio" {
import {SelectColumnRatio} from "sap/m/library";

/**
* A string type that represents column ratio.
*
* Allowed values are strings that follow the number:number (3:2) format.
*
* @public
* @since 1.86
*/
export default SelectColumnRatio;
}

declare module "sap/m/SelectDialogInitialFocus" {
import {SelectDialogInitialFocus} from "sap/m/library";

Expand Down Expand Up @@ -1168,6 +1182,19 @@ declare module "sap/m/ValueColor" {
export default ValueColor;
}

declare module "sap/m/ValueCSSColor" {
import {ValueCSSColor} from "sap/m/library";

/**
* A string type that represents CSS color values, sap.m.ValueColor or less parameter values.
*
* Allowed values are {@link sap.ui.core.CSSColor}, {@link sap.m.ValueColor} or a less parameter name (string). In case the less parameter color cannot be determined, the validation fails. You need to check if less parameters are supported on control level. An empty string is also allowed and has the same effect as setting no color.
*
* @public
*/
export default ValueCSSColor;
}

declare module "sap/m/VerticalPlacementType" {
import {VerticalPlacementType} from "sap/m/library";

Expand Down
12 changes: 12 additions & 0 deletions resources/overrides/library/sap.ui.commons.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,18 @@ declare module "sap/ui/commons/RowRepeaterDesign" {
export default RowRepeaterDesign;
}

declare module "sap/ui/commons/SplitterSize" {
import {SplitterSize} from "sap/ui/commons/library";

/**
* A string type that represents subset of CSS size values. For the Splitter only px and % are allowed.
*
* @deprecated (since 1.38)
* @public
*/
export default SplitterSize;
}

declare module "sap/ui/commons/TextViewColor" {
import {TextViewColor} from "sap/ui/commons/library";

Expand Down
Loading