Skip to content

Commit

Permalink
chore(linting): restore some ESLint rules (#9123)
Browse files Browse the repository at this point in the history
**Related Issue:** N/A

## Summary

Restores the following rules:

* `@jest/expect-expect`
* `@stencil-community/decorators-context`
* `@stencil-community/strict-boolean-conditions`
* `@stencil-community/reserved-member-names`
* `@stencil-community/ban-exported-const-enums`
* `@typescript-eslint/no-duplicate-enum-values`

Disables the following: 

* `@esri/calcite-components/strict-boolean-attributes` (replaced by
`@stencil-community/ban-default-true`)
  • Loading branch information
jcfranco authored Apr 13, 2024
1 parent 0d6b890 commit 13ba953
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 220 deletions.
7 changes: 1 addition & 6 deletions packages/calcite-components/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,13 @@ module.exports = {
message: "Use keydown instead for consistent interaction behavior (e.g., closing, moving focus, etc.).",
},
],
"@stencil-community/decorators-context": "off",
"@esri/calcite-components/strict-boolean-attributes": "off",
"@stencil-community/decorators-style": "warn",
"@stencil-community/no-unused-watch": "off",
"@stencil-community/own-methods-must-be-private": "off",
"@stencil-community/own-props-must-be-private": "off",
"@stencil-community/prefer-vdom-listener": "warn",
"@stencil-community/required-jsdoc": "off",
"@stencil-community/strict-boolean-conditions": "off",
"@stencil-community/reserved-member-names": "off",
"@stencil-community/ban-exported-const-enums": "off",
"@typescript-eslint/no-duplicate-enum-values": "off",
"@typescript-eslint/ban-types": "warn",
"@typescript-eslint/explicit-module-boundary-types": [
"error",
Expand All @@ -76,7 +72,6 @@ module.exports = {
curly: "error",
"import/no-dynamic-require": ["error", { esmodule: true }],
"import/order": ["error", { "newlines-between": "never" }],
"jest/expect-expect": "off",
"jest/no-export": "warn",
"jsdoc/check-tag-names": "off",
"jsdoc/require-jsdoc": "off",
Expand Down
100 changes: 0 additions & 100 deletions packages/calcite-components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1950,11 +1950,6 @@ export namespace Components {
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete)
*/
"autocomplete": string;
/**
* When `true`, the component is focused on page load. Only one element can contain `autofocus`. If multiple elements have `autofocus`, the first element will receive focus.
* @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
*/
"autofocus": boolean;
/**
* When `true`, a clear button is displayed when the component has a value. The clear button shows by default for `"search"`, `"time"`, and `"date"` types, and will not display for the `"textarea"` type.
*/
Expand All @@ -1965,11 +1960,6 @@ export namespace Components {
*/
"disabled": boolean;
"editingEnabled": boolean;
/**
* Specifies the action label or icon for the Enter key on virtual keyboards. Read the native attribute's documentation on MDN for more info.
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)
*/
"enterKeyHint": string;
/**
* When `type` is `"file"`, specifies the component's selected files.
* @mdn https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/files
Expand All @@ -1991,11 +1981,6 @@ export namespace Components {
* When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`).
*/
"iconFlipRtl": boolean;
/**
* Specifies the type of content to help devices display an appropriate virtual keyboard. Read the native attribute's documentation on MDN for more info.
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)
*/
"inputMode": string;
/**
* Accessible name for the component.
*/
Expand Down Expand Up @@ -2283,11 +2268,6 @@ export namespace Components {
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete)
*/
"autocomplete": string;
/**
* When `true`, the component is focused on page load. Only one element can contain `autofocus`. If multiple elements have `autofocus`, the first element will receive focus.
* @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
*/
"autofocus": boolean;
/**
* When `true`, a clear button is displayed when the component has a value.
*/
Expand All @@ -2298,11 +2278,6 @@ export namespace Components {
*/
"disabled": boolean;
"editingEnabled": boolean;
/**
* Specifies the action label or icon for the Enter key on virtual keyboards. Read the native attribute's documentation on MDN for more info.
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)
*/
"enterKeyHint": string;
/**
* The `id` of the form that will be associated with the component. When not set, the component will be associated with its ancestor form element, if any.
*/
Expand All @@ -2320,11 +2295,6 @@ export namespace Components {
* When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`).
*/
"iconFlipRtl": boolean;
/**
* Specifies the type of content to help devices display an appropriate virtual keyboard. Read the native attribute's documentation on MDN for more info.
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)
*/
"inputMode": string;
/**
* When `true`, restricts the component to integer numbers only and disables exponential notation.
*/
Expand Down Expand Up @@ -2450,11 +2420,6 @@ export namespace Components {
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete)
*/
"autocomplete": string;
/**
* When `true`, the component is focused on page load. Only one element can contain `autofocus`. If multiple elements have `autofocus`, the first element will receive focus.
* @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
*/
"autofocus": boolean;
/**
* When `true`, a clear button is displayed when the component has a value.
*/
Expand All @@ -2465,11 +2430,6 @@ export namespace Components {
*/
"disabled": boolean;
"editingEnabled": boolean;
/**
* Specifies the action label or icon for the Enter key on virtual keyboards. Read the native attribute's documentation on MDN for more info.
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)
*/
"enterKeyHint": string;
/**
* The `id` of the form that will be associated with the component. When not set, the component will be associated with its ancestor form element, if any.
*/
Expand All @@ -2483,11 +2443,6 @@ export namespace Components {
* When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`).
*/
"iconFlipRtl": boolean;
/**
* Specifies the type of content to help devices display an appropriate virtual keyboard. Read the native attribute's documentation on MDN for more info.
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)
*/
"inputMode": string;
/**
* Accessible name for the component's button or hyperlink.
*/
Expand Down Expand Up @@ -4910,11 +4865,6 @@ export namespace Components {
"scale": Scale;
}
interface CalciteTextArea {
/**
* When `true`, the component is focused on page load. Only one element can contain `autofocus`. If multiple elements have `autofocus`, the first element will receive focus.
* @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
*/
"autofocus": boolean;
/**
* Specifies the component's number of columns.
* @mdn [cols](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-cols)
Expand Down Expand Up @@ -9433,11 +9383,6 @@ declare namespace LocalJSX {
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete)
*/
"autocomplete"?: string;
/**
* When `true`, the component is focused on page load. Only one element can contain `autofocus`. If multiple elements have `autofocus`, the first element will receive focus.
* @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
*/
"autofocus"?: boolean;
/**
* When `true`, a clear button is displayed when the component has a value. The clear button shows by default for `"search"`, `"time"`, and `"date"` types, and will not display for the `"textarea"` type.
*/
Expand All @@ -9448,11 +9393,6 @@ declare namespace LocalJSX {
*/
"disabled"?: boolean;
"editingEnabled"?: boolean;
/**
* Specifies the action label or icon for the Enter key on virtual keyboards. Read the native attribute's documentation on MDN for more info.
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)
*/
"enterKeyHint"?: string;
/**
* When `type` is `"file"`, specifies the component's selected files.
* @mdn https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/files
Expand All @@ -9474,11 +9414,6 @@ declare namespace LocalJSX {
* When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`).
*/
"iconFlipRtl"?: boolean;
/**
* Specifies the type of content to help devices display an appropriate virtual keyboard. Read the native attribute's documentation on MDN for more info.
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)
*/
"inputMode"?: string;
/**
* Accessible name for the component.
*/
Expand Down Expand Up @@ -9779,11 +9714,6 @@ declare namespace LocalJSX {
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete)
*/
"autocomplete"?: string;
/**
* When `true`, the component is focused on page load. Only one element can contain `autofocus`. If multiple elements have `autofocus`, the first element will receive focus.
* @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
*/
"autofocus"?: boolean;
/**
* When `true`, a clear button is displayed when the component has a value.
*/
Expand All @@ -9794,11 +9724,6 @@ declare namespace LocalJSX {
*/
"disabled"?: boolean;
"editingEnabled"?: boolean;
/**
* Specifies the action label or icon for the Enter key on virtual keyboards. Read the native attribute's documentation on MDN for more info.
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)
*/
"enterKeyHint"?: string;
/**
* The `id` of the form that will be associated with the component. When not set, the component will be associated with its ancestor form element, if any.
*/
Expand All @@ -9816,11 +9741,6 @@ declare namespace LocalJSX {
* When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`).
*/
"iconFlipRtl"?: boolean;
/**
* Specifies the type of content to help devices display an appropriate virtual keyboard. Read the native attribute's documentation on MDN for more info.
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)
*/
"inputMode"?: string;
/**
* When `true`, restricts the component to integer numbers only and disables exponential notation.
*/
Expand Down Expand Up @@ -9948,11 +9868,6 @@ declare namespace LocalJSX {
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete)
*/
"autocomplete"?: string;
/**
* When `true`, the component is focused on page load. Only one element can contain `autofocus`. If multiple elements have `autofocus`, the first element will receive focus.
* @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
*/
"autofocus"?: boolean;
/**
* When `true`, a clear button is displayed when the component has a value.
*/
Expand All @@ -9963,11 +9878,6 @@ declare namespace LocalJSX {
*/
"disabled"?: boolean;
"editingEnabled"?: boolean;
/**
* Specifies the action label or icon for the Enter key on virtual keyboards. Read the native attribute's documentation on MDN for more info.
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)
*/
"enterKeyHint"?: string;
/**
* The `id` of the form that will be associated with the component. When not set, the component will be associated with its ancestor form element, if any.
*/
Expand All @@ -9981,11 +9891,6 @@ declare namespace LocalJSX {
* When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`).
*/
"iconFlipRtl"?: boolean;
/**
* Specifies the type of content to help devices display an appropriate virtual keyboard. Read the native attribute's documentation on MDN for more info.
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)
*/
"inputMode"?: string;
/**
* Accessible name for the component's button or hyperlink.
*/
Expand Down Expand Up @@ -12535,11 +12440,6 @@ declare namespace LocalJSX {
"scale"?: Scale;
}
interface CalciteTextArea {
/**
* When `true`, the component is focused on page load. Only one element can contain `autofocus`. If multiple elements have `autofocus`, the first element will receive focus.
* @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
*/
"autofocus"?: boolean;
/**
* Specifies the component's number of columns.
* @mdn [cols](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-cols)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export enum StatusIconDefaults {
valid = "check-circle",
invalid = "exclamation-mark-triangle",
idle = "information",
}
export const StatusIconDefaults = {
valid: "check-circle",
invalid: "exclamation-mark-triangle",
idle: "information",
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Element,
Event,
EventEmitter,
forceUpdate,
h,
Host,
Method,
Expand Down Expand Up @@ -95,6 +96,19 @@ export class InputNumber
TextualInputComponent,
LoadableComponent
{
//--------------------------------------------------------------------------
//
// Global attributes
//
//--------------------------------------------------------------------------

@Watch("autofocus")
@Watch("enterkeyhint")
@Watch("inputmode")
handleGlobalAttributesChanged(): void {
forceUpdate(this);
}

//--------------------------------------------------------------------------
//
// Properties
Expand All @@ -104,13 +118,6 @@ export class InputNumber
/** Specifies the text alignment of the component's value. */
@Prop({ reflect: true }) alignment: Extract<"start" | "end", Alignment> = "start";

/**
* When `true`, the component is focused on page load. Only one element can contain `autofocus`. If multiple elements have `autofocus`, the first element will receive focus.
*
* @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
*/
@Prop({ reflect: true }) autofocus = false;

/**
* When `true`, a clear button is displayed when the component has a value.
*/
Expand Down Expand Up @@ -274,22 +281,6 @@ export class InputNumber
*/
@Prop() autocomplete: string;

/**
* Specifies the type of content to help devices display an appropriate virtual keyboard.
* Read the native attribute's documentation on MDN for more info.
*
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)
*/
@Prop() inputMode = "decimal";

/**
* Specifies the action label or icon for the Enter key on virtual keyboards.
* Read the native attribute's documentation on MDN for more info.
*
* @mdn [step](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)
*/
@Prop() enterKeyHint: string;

/** Adds text to the end of the component. */
@Prop() suffixText: string;

Expand Down Expand Up @@ -1042,11 +1033,11 @@ export class InputNumber
<input
aria-label={getLabelText(this)}
autocomplete={this.autocomplete}
autofocus={this.autofocus ? true : null}
autofocus={this.el.autofocus ? true : null}
defaultValue={this.defaultValue}
disabled={this.disabled ? true : null}
enterKeyHint={this.enterKeyHint}
inputMode={this.inputMode}
enterKeyHint={this.el.enterKeyHint}
inputMode={this.el.inputMode}
key="localized-input"
maxLength={this.maxLength}
minLength={this.minLength}
Expand Down
Loading

0 comments on commit 13ba953

Please sign in to comment.