Skip to content

Commit

Permalink
feat(sdk/skyux-eslint): add linting rule to detect the use of legacy …
Browse files Browse the repository at this point in the history
…icons (#3061)
  • Loading branch information
Blackbaud-TrevorBurch authored Jan 30, 2025
1 parent e364c04 commit 1abcf12
Show file tree
Hide file tree
Showing 10 changed files with 1,089 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"import": "@skyux/dev-infra-private/.cspell-shared.json",
"words": [
"cyclomatic",
"checkmark",
"gantt",
"fetchpriority",
"interactable",
"ngsrc",
Expand Down
44 changes: 44 additions & 0 deletions libs/sdk/skyux-eslint/docs/rules/template/no-legacy-icons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# `skyux-eslint-template/no-legacy-icons`

Prevents usage of legacy icons in HTML templates.

- Type: problem

<br>

## Rule Options

The rule does not have any configuration options.

<br>

## Usage Examples

#### Default Config

```json
{
"rules": {
"skyux-eslint-template/no-legacy-icons": ["error"]
}
}
```

#### ❌ Invalid Code

```html
<sky-icon icon="plus-circle"></sky-icon>
~~~~~~~~~~~~~~~~~~
```
```html
<sky-action-button-container>
<sky-action-button (actionClick)="filterActionClick()">
<sky-action-button-icon iconType="trash" />
~~~~~~~~~~~~~~~~
<sky-action-button-header> Delete a list </sky-action-button-header>
<sky-action-button-details>
Delete an existing list.
</sky-action-button-details>
</sky-action-button>
</sky-action-button-container>
```
3 changes: 2 additions & 1 deletion libs/sdk/skyux-eslint/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/libs/sdk/skyux-eslint"],
"options": {
"jestConfig": "libs/sdk/skyux-eslint/jest.config.ts"
"jestConfig": "libs/sdk/skyux-eslint/jest.config.ts",
"coverage": true
}
}
}
Expand Down
1 change: 1 addition & 0 deletions libs/sdk/skyux-eslint/src/configs/template-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default [
rules: {
'skyux-eslint-template/no-deprecated-classnames': 'error',
'skyux-eslint-template/no-deprecated-directives': 'error',
'skyux-eslint-template/no-legacy-icons': 'error',
'skyux-eslint-template/no-radio-group-with-nested-list': 'error',
'skyux-eslint-template/no-unbound-id': 'error',
'skyux-eslint-template/prefer-label-text': 'error',
Expand Down
1 change: 1 addition & 0 deletions libs/sdk/skyux-eslint/src/configs/template-recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default [
rules: {
'skyux-eslint-template/no-deprecated-classnames': 'error',
'skyux-eslint-template/no-deprecated-directives': 'error',
'skyux-eslint-template/no-legacy-icons': 'error',
'skyux-eslint-template/no-radio-group-with-nested-list': 'error',
'skyux-eslint-template/no-unbound-id': 'error',
'skyux-eslint-template/prefer-label-text': 'error',
Expand Down
5 changes: 5 additions & 0 deletions libs/sdk/skyux-eslint/src/plugins/template-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import {
rule as noDeprecatedDirectives,
RULE_NAME as noDeprecatedDirectivesRuleName,
} from '../rules/template/no-deprecated-directives';
import {
rule as noLegacyIcons,
RULE_NAME as noLegacyIconsRuleName,
} from '../rules/template/no-legacy-icons';
import {
rule as noRadioGroupWithNestedList,
RULE_NAME as noRadioGroupWithNestedListRuleName,
Expand All @@ -30,6 +34,7 @@ export default {
rules: {
[noDeprecatedClassnamesRuleName]: noDeprecatedClassnames,
[noDeprecatedDirectivesRuleName]: noDeprecatedDirectives,
[noLegacyIconsRuleName]: noLegacyIcons,
[noRadioGroupWithNestedListRuleName]: noRadioGroupWithNestedList,
[noUnboundIdRuleName]: noUnboundId,
[preferLabelTextRuleName]: preferLabelText,
Expand Down
Loading

0 comments on commit 1abcf12

Please sign in to comment.