Skip to content

Commit

Permalink
refactor: update ESLint, fix member-ordering warnings (#5264)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan authored Jan 9, 2023
1 parent 071ef87 commit ba89fda
Show file tree
Hide file tree
Showing 53 changed files with 974 additions and 904 deletions.
101 changes: 80 additions & 21 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,50 +64,108 @@
"error",
{
"default": [
"signature",
"call-signature",

"static-field",
"public-static-field",
"protected-static-field",
"private-static-field",
"#private-static-field",

"static-initialization",

"static-get",
"public-static-get",
"static-set",
"public-static-set",
"static-method",
"public-static-method",

"protected-static-get",
"protected-static-set",
"protected-static-method",

"private-static-get",
"private-static-set",
"private-static-method",

"public-instance-field",
"protected-instance-field",
"private-instance-field",
"#private-static-get",
"#private-static-set",
"#private-static-method",

"field",
"instance-field",
"public-field",
"public-instance-field",
"abstract-field",
"public-abstract-field",
"protected-abstract-field",
"private-abstract-field",

"public-field",
"protected-field",
"private-field",
"protected-instance-field",
"protected-abstract-field",

"static-field",
"instance-field",
"abstract-field",
"private-field",
"private-instance-field",

"field",
"#private-field",
"#private-instance-field",

"constructor",
"public-constructor",
"protected-constructor",
"private-constructor",

"public-instance-method",
"protected-instance-method",
"private-instance-method",
"get",
"instance-get",
"public-get",
"public-instance-get",
"abstract-get",
"public-abstract-get",

"public-abstract-method",
"protected-abstract-method",
"private-abstract-method",
"set",
"instance-set",
"public-set",
"public-instance-set",
"abstract-set",
"public-abstract-set",

"protected-get",
"protected-instance-get",
"protected-abstract-get",

"protected-set",
"protected-instance-set",
"protected-abstract-set",

"private-get",
"private-instance-get",

"private-set",
"private-instance-set",

"#private-get",
"#private-instance-get",

"#private-set",
"#private-instance-set",

"method",
"instance-method",
"public-method",
"public-instance-method",
"abstract-method",
"public-abstract-method",

"protected-method",
"protected-instance-method",
"protected-abstract-method",

"private-method",
"private-instance-method",

"static-method",
"instance-method",
"abstract-method",
"method"
"#private-method",
"#private-instance-method"
],
"interfaces": ["field", "constructor", "method"],
"typeLiterals": ["field", "constructor", "method"]
Expand Down Expand Up @@ -196,6 +254,7 @@
"mocha": true
},
"rules": {
"@typescript-eslint/member-ordering": "off",
"no-await-in-loop": "off",
// TODO: Use chai-friendly plugin
"no-unused-expressions": "off",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"@esm-bundle/chai": "^4.3.4",
"@fontsource/roboto": "^4.5.1",
"@polymer/iron-component-page": "^4.0.1",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"@vaadin/testing-helpers": "^0.3.2",
"@web/dev-server": "^0.1.35",
"@web/rollup-plugin-html": "^1.11.0",
Expand All @@ -44,7 +44,7 @@
"@web/test-runner-visual-regression": "^0.7.0",
"axios": "^1.1.3",
"dotenv": "^16.0.3",
"eslint": "^8.26.0",
"eslint": "^8.31.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^4.2.1",
Expand Down
24 changes: 12 additions & 12 deletions packages/accordion/src/vaadin-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ class Accordion extends KeyboardDirectionMixin(ThemableMixin(ElementMixin(Polyme
this._boundUpdateOpened = this._updateOpened.bind(this);
}

/**
* Override getter from `KeyboardDirectionMixin`
* to check if the heading element has focus.
*
* @return {Element | null}
* @protected
* @override
*/
get focused() {
return (this._getItems() || []).find((item) => isElementFocused(item.focusElement));
}

/**
* @protected
* @override
Expand All @@ -142,18 +154,6 @@ class Accordion extends KeyboardDirectionMixin(ThemableMixin(ElementMixin(Polyme
});
}

/**
* Override getter from `KeyboardDirectionMixin`
* to check if the heading element has focus.
*
* @return {Element | null}
* @protected
* @override
*/
get focused() {
return (this._getItems() || []).find((item) => isElementFocused(item.focusElement));
}

/**
* Override method inherited from `KeyboardDirectionMixin`
* to use the stored list of accordion panels as items.
Expand Down
136 changes: 68 additions & 68 deletions packages/charts/src/vaadin-chart-series.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,55 +61,6 @@ class ChartSeries extends PolymerElement {
return 'vaadin-chart-series';
}

get options() {
const options = deepMerge({}, this.additionalOptions);

if (this.type) {
options.type = this.type;
}

if (this.title) {
options.name = this.title;
}

if (this.values) {
options.data = this.values;
}

if (this.markers) {
if (!this.__isMarkersValid()) {
this.markers = 'auto';
}
options.marker = this.__markersConfiguration;
}

if (this.unit) {
options.yAxis = this.unit;
}

if (this.stack) {
options.stack = this.stack;
}

if (isFinite(this.valueMin)) {
options.yAxisValueMin = this.valueMin;
}

if (isFinite(this.valueMax)) {
options.yAxisValueMax = this.valueMax;
}

if (this.neckWidth) {
options.neckWidth = this.neckWidth;
}

if (this.neckPosition) {
options.neckHeight = this.neckPosition;
}

return options;
}

static get properties() {
return {
/**
Expand Down Expand Up @@ -274,6 +225,74 @@ class ChartSeries extends PolymerElement {
];
}

get options() {
const options = deepMerge({}, this.additionalOptions);

if (this.type) {
options.type = this.type;
}

if (this.title) {
options.name = this.title;
}

if (this.values) {
options.data = this.values;
}

if (this.markers) {
if (!this.__isMarkersValid()) {
this.markers = 'auto';
}
options.marker = this.__markersConfiguration;
}

if (this.unit) {
options.yAxis = this.unit;
}

if (this.stack) {
options.stack = this.stack;
}

if (isFinite(this.valueMin)) {
options.yAxisValueMin = this.valueMin;
}

if (isFinite(this.valueMax)) {
options.yAxisValueMax = this.valueMax;
}

if (this.neckWidth) {
options.neckWidth = this.neckWidth;
}

if (this.neckPosition) {
options.neckHeight = this.neckPosition;
}

return options;
}

/** @private */
get __markersConfiguration() {
const config = {};
switch (this.markers) {
case 'shown':
config.enabled = true;
break;
case 'hidden':
config.enabled = false;
break;
case 'auto':
default:
config.enabled = null;
break;
}

return config;
}

/**
* Method to attach a series object of type `Highcharts.Series`.
* @param {!Series} series Object of type `Highcharts.Series`
Expand Down Expand Up @@ -418,25 +437,6 @@ class ChartSeries extends PolymerElement {
});
}

/** @private */
get __markersConfiguration() {
const config = {};
switch (this.markers) {
case 'shown':
config.enabled = true;
break;
case 'hidden':
config.enabled = false;
break;
case 'auto':
default:
config.enabled = null;
break;
}

return config;
}

/** @private */
__showWarn(propertyName, acceptedValues) {
console.warn(`<vaadin-chart-series> Acceptable values for "${propertyName}" are ${acceptedValues}`);
Expand Down
Loading

0 comments on commit ba89fda

Please sign in to comment.